From 81e0b2849d837649da9adbc5d077b8c819fe7bee Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Mon, 15 Apr 2024 18:39:59 +0100 Subject: feature: Add title to bookmarks and allow editing them. Fixes #27 --- .../dashboard/preview/BookmarkPreview.tsx | 51 +++++++--------------- 1 file changed, 15 insertions(+), 36 deletions(-) (limited to 'apps/web/components/dashboard/preview/BookmarkPreview.tsx') diff --git a/apps/web/components/dashboard/preview/BookmarkPreview.tsx b/apps/web/components/dashboard/preview/BookmarkPreview.tsx index 73e49376..93f14c64 100644 --- a/apps/web/components/dashboard/preview/BookmarkPreview.tsx +++ b/apps/web/components/dashboard/preview/BookmarkPreview.tsx @@ -24,6 +24,7 @@ import type { ZBookmark } from "@hoarder/trpc/types/bookmarks"; import ActionBar from "./ActionBar"; import { AssetContentSection } from "./AssetContentSection"; +import { EditableTitle } from "./EditableTitle"; import { NoteEditor } from "./NoteEditor"; import { TextContentSection } from "./TextContentSection"; @@ -62,37 +63,6 @@ function CreationTime({ createdAt }: { createdAt: Date }) { ); } -function LinkHeader({ bookmark }: { bookmark: ZBookmark }) { - if (bookmark.content.type !== "link") { - throw new Error("Unexpected content type"); - } - - const title = bookmark.content.title ?? bookmark.content.url; - - return ( -
- - -

{title}

-
- - - {title} - - -
- - View Original - - - -
- ); -} - export default function BookmarkPreview({ initialData, }: { @@ -131,17 +101,26 @@ export default function BookmarkPreview({ } } - const linkHeader = bookmark.content.type == "link" && ( - - ); - return (
{isBookmarkStillCrawling(bookmark) ? : content}
- {linkHeader} +
+ + {bookmark.content.type == "link" && ( + + View Original + + + )} + +
+

Tags

-- cgit v1.2.3-70-g09d2