Skip to content

Commit 646589f

Browse files
committed
feat: add login prompt for bookmarking articles when user is not authenticated
1 parent d962e43 commit 646589f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/components/ArticleCard.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,13 @@ const ArticleCard = ({
156156
resource_id={id}
157157
render={({ bookmarked, toggle }) => (
158158
<button
159-
onClick={toggle}
159+
onClick={() => {
160+
if (!session?.user) {
161+
loginPopup.show();
162+
return;
163+
}
164+
toggle();
165+
}}
160166
className={clsx(
161167
"transition-colors duration-300 flex cursor-pointer px-2 py-1 rounded-sm hover:bg-primary/20",
162168
{ "bg-primary/20": bookmarked }

0 commit comments

Comments
 (0)