|
|
@ -41,7 +41,7 @@ export default function ProfileHeader({
|
|
|
|
setSelectedTab,
|
|
|
|
setSelectedTab,
|
|
|
|
}: ProfileHeaderProps) {
|
|
|
|
}: ProfileHeaderProps) {
|
|
|
|
const [isDialogOpen, setIsDialogOpen] = useState(false);
|
|
|
|
const [isDialogOpen, setIsDialogOpen] = useState(false);
|
|
|
|
// Const [saved, setSaved] = useState(isSaved);
|
|
|
|
const [saved, setSaved] = useState(isSaved);
|
|
|
|
const router = useRouter();
|
|
|
|
const router = useRouter();
|
|
|
|
const trpcContext = trpc.useContext();
|
|
|
|
const trpcContext = trpc.useContext();
|
|
|
|
const { offerProfileId = '', token = '' } = router.query;
|
|
|
|
const { offerProfileId = '', token = '' } = router.query;
|
|
|
@ -60,7 +60,7 @@ export default function ProfileHeader({
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
onSuccess: () => {
|
|
|
|
onSuccess: () => {
|
|
|
|
// SetSaved(true);
|
|
|
|
setSaved(true);
|
|
|
|
showToast({
|
|
|
|
showToast({
|
|
|
|
title: `Saved to dashboard!`,
|
|
|
|
title: `Saved to dashboard!`,
|
|
|
|
variant: 'success',
|
|
|
|
variant: 'success',
|
|
|
@ -79,7 +79,7 @@ export default function ProfileHeader({
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
onSuccess: () => {
|
|
|
|
onSuccess: () => {
|
|
|
|
// SetSaved(false);
|
|
|
|
setSaved(false);
|
|
|
|
showToast({
|
|
|
|
showToast({
|
|
|
|
title: `Removed from dashboard!`,
|
|
|
|
title: `Removed from dashboard!`,
|
|
|
|
variant: 'success',
|
|
|
|
variant: 'success',
|
|
|
@ -90,7 +90,7 @@ export default function ProfileHeader({
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
const toggleSaved = () => {
|
|
|
|
const toggleSaved = () => {
|
|
|
|
if (isSaved) {
|
|
|
|
if (saved) {
|
|
|
|
unsaveMutation.mutate({ profileId: offerProfileId as string });
|
|
|
|
unsaveMutation.mutate({ profileId: offerProfileId as string });
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
saveMutation.mutate({
|
|
|
|
saveMutation.mutate({
|
|
|
@ -111,10 +111,10 @@ export default function ProfileHeader({
|
|
|
|
disabled={
|
|
|
|
disabled={
|
|
|
|
isLoading || saveMutation.isLoading || unsaveMutation.isLoading
|
|
|
|
isLoading || saveMutation.isLoading || unsaveMutation.isLoading
|
|
|
|
}
|
|
|
|
}
|
|
|
|
icon={isSaved ? BookmarkIconSolid : BookmarkIconOutline}
|
|
|
|
icon={saved ? BookmarkIconSolid : BookmarkIconOutline}
|
|
|
|
isLabelHidden={true}
|
|
|
|
isLabelHidden={true}
|
|
|
|
isLoading={saveMutation.isLoading || unsaveMutation.isLoading}
|
|
|
|
isLoading={saveMutation.isLoading || unsaveMutation.isLoading}
|
|
|
|
label={isSaved ? 'Remove from account' : 'Save to your account'}
|
|
|
|
label={saved ? 'Remove from account' : 'Save to your account'}
|
|
|
|
size="md"
|
|
|
|
size="md"
|
|
|
|
variant="tertiary"
|
|
|
|
variant="tertiary"
|
|
|
|
onClick={toggleSaved}
|
|
|
|
onClick={toggleSaved}
|
|
|
|