From 3207264fc13c275d6dcfbd2628cc6b3974ceeaed Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Mon, 7 Apr 2025 01:03:26 +0100 Subject: feat: Allow editing bookmark details --- .../components/dashboard/preview/EditableTitle.tsx | 60 ---------------------- 1 file changed, 60 deletions(-) delete mode 100644 apps/web/components/dashboard/preview/EditableTitle.tsx (limited to 'apps/web/components/dashboard/preview/EditableTitle.tsx') diff --git a/apps/web/components/dashboard/preview/EditableTitle.tsx b/apps/web/components/dashboard/preview/EditableTitle.tsx deleted file mode 100644 index 03b95e74..00000000 --- a/apps/web/components/dashboard/preview/EditableTitle.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import { toast } from "@/components/ui/use-toast"; - -import { useUpdateBookmark } from "@hoarder/shared-react/hooks/bookmarks"; -import { BookmarkTypes, ZBookmark } from "@hoarder/shared/types/bookmarks"; - -import { EditableText } from "../EditableText"; - -export function EditableTitle({ bookmark }: { bookmark: ZBookmark }) { - const { mutate: updateBookmark, isPending } = useUpdateBookmark({ - onSuccess: () => { - toast({ - description: "Title updated!", - }); - }, - }); - - let title: string | null = null; - switch (bookmark.content.type) { - case BookmarkTypes.LINK: - title = bookmark.content.title ?? bookmark.content.url; - break; - case BookmarkTypes.TEXT: - title = null; - break; - case BookmarkTypes.ASSET: - title = bookmark.content.fileName ?? null; - break; - } - - title = bookmark.title ?? title; - if (title == "") { - title = null; - } - - return ( - { - updateBookmark( - { - bookmarkId: bookmark.id, - title: newTitle, - }, - { - onError: () => { - toast({ - description: "Something went wrong", - variant: "destructive", - }); - }, - }, - ); - }} - isSaving={isPending} - /> - ); -} -- cgit v1.2.3-70-g09d2