From 7400914396eea0c9a1fb7bc59e022babc2186f42 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Fri, 9 Feb 2024 16:47:17 +0000 Subject: [feature] Add the ability to favourite and archive bookmarks --- .../dashboard/bookmarks/components/LinkCard.tsx | 55 ++-------------------- 1 file changed, 3 insertions(+), 52 deletions(-) (limited to 'packages/web/app/dashboard/bookmarks/components/LinkCard.tsx') diff --git a/packages/web/app/dashboard/bookmarks/components/LinkCard.tsx b/packages/web/app/dashboard/bookmarks/components/LinkCard.tsx index aeef6bae..039cb156 100644 --- a/packages/web/app/dashboard/bookmarks/components/LinkCard.tsx +++ b/packages/web/app/dashboard/bookmarks/components/LinkCard.tsx @@ -1,63 +1,14 @@ -"use client"; - import { Badge } from "@/components/ui/badge"; -import { Button } from "@/components/ui/button"; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuTrigger, -} from "@/components/ui/dropdown-menu"; import { ImageCard, ImageCardBody, ImageCardFooter, ImageCardTitle, } from "@/components/ui/imageCard"; -import { useToast } from "@/components/ui/use-toast"; -import APIClient from "@/lib/api"; import { ZBookmark } from "@/lib/types/api/bookmarks"; -import { MoreHorizontal, Trash2 } from "lucide-react"; import Link from "next/link"; -import { useRouter } from "next/navigation"; - -export function LinkOptions({ linkId }: { linkId: string }) { - const { toast } = useToast(); - const router = useRouter(); - - const unbookmarkLink = async () => { - const [_, error] = await APIClient.deleteBookmark(linkId); +import BookmarkOptions from "./BookmarkOptions"; - if (error) { - toast({ - variant: "destructive", - title: "Something went wrong", - description: "There was a problem with your request.", - }); - } else { - toast({ - description: "The link has been deleted!", - }); - } - - router.refresh(); - }; - return ( - - - - - - - - Delete - - - - ); -} export default function LinkCard({ bookmark }: { bookmark: ZBookmark }) { const link = bookmark.content; @@ -71,7 +22,7 @@ export default function LinkCard({ bookmark }: { bookmark: ZBookmark }) { image={link?.imageUrl ?? undefined} > - + {link?.title ?? parsedUrl.host} @@ -93,7 +44,7 @@ export default function LinkCard({ bookmark }: { bookmark: ZBookmark }) { {parsedUrl.host} - + -- cgit v1.2.3-70-g09d2