[offers][fix] fix toggle save

pull/471/head
Zhang Ziqing 3 years ago
parent 203043da3e
commit 0e38b64ef0

@ -7,7 +7,7 @@ const navigation: ProductNavigationItems = [
const navigationAuthenticated: ProductNavigationItems = [
{ href: '/offers/submit', name: 'Analyze your offers' },
{ href: '/offers/dashboard', name: 'Your repository' },
{ href: '/offers/dashboard', name: 'Your dashboard' },
{ href: '/offers/features', name: 'Features' },
];

@ -34,7 +34,7 @@ export default function OffersProfileSave({
},
onSuccess: () => {
showToast({
title: `Saved to your repository!`,
title: `Saved to your dashboard!`,
variant: 'success',
});
},
@ -95,8 +95,8 @@ export default function OffersProfileSave({
</div>
<p className="mb-5 text-slate-900">
If you do not want to keep the edit link, you can opt to save this
profile under your account's respository. It will still only be
editable by you.
profile under your account's dashboard. It will still only be editable
by you.
</p>
<div className="mb-20">
<Button

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

@ -71,11 +71,11 @@ export default function ProfilesDashboard() {
{!userProfilesQuery.isLoading && (
<div className="mt-8 overflow-y-auto">
<h1 className="mx-auto mb-4 w-3/4 text-start text-4xl font-bold text-slate-900">
Your repository
Your dashboard
</h1>
<p className="mx-auto w-3/4 text-start text-xl text-slate-900">
Save your offer profiles to respository to easily access and edit
them later.
Save your offer profiles to dashboard to easily access and edit them
later.
</p>
<div className="justfy-center mt-8 flex w-screen">
<ul className="mx-auto w-3/4 space-y-3" role="list">

Loading…
Cancel
Save