From 8b4fb49cc066eef602d9d089e7b71d183231a8fd Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Sat, 26 Jul 2025 12:29:17 +0000 Subject: feat: Render author, publisher and pub data in the bookmark view --- .../dashboard/preview/BookmarkPreview.tsx | 50 +++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) (limited to 'apps') diff --git a/apps/web/components/dashboard/preview/BookmarkPreview.tsx b/apps/web/components/dashboard/preview/BookmarkPreview.tsx index e213b9cb..01c86f6e 100644 --- a/apps/web/components/dashboard/preview/BookmarkPreview.tsx +++ b/apps/web/components/dashboard/preview/BookmarkPreview.tsx @@ -16,7 +16,7 @@ import { import useRelativeTime from "@/lib/hooks/relative-time"; import { useTranslation } from "@/lib/i18n/client"; import { api } from "@/lib/trpc"; -import { CalendarDays, ExternalLink } from "lucide-react"; +import { Building, CalendarDays, ExternalLink, User } from "lucide-react"; import { BookmarkTypes, ZBookmark } from "@karakeep/shared/types/bookmarks"; import { @@ -61,6 +61,53 @@ function CreationTime({ createdAt }: { createdAt: Date }) { ); } +function BookmarkMetadata({ bookmark }: { bookmark: ZBookmark }) { + if (bookmark.content.type !== BookmarkTypes.LINK) { + return null; + } + + const { author, publisher, datePublished } = bookmark.content; + + if (!author && !publisher && !datePublished) { + return null; + } + + return ( +
+ {author && ( +
+ + By {author} +
+ )} + {publisher && ( +
+ + {publisher} +
+ )} + {datePublished && } +
+ ); +} + +function PublishedDate({ datePublished }: { datePublished: Date }) { + const { fromNow, localCreatedAt } = useRelativeTime(datePublished); + return ( + + +
+ + Published {fromNow} +
+
+ + {localCreatedAt} + +
+ ); +} + export default function BookmarkPreview({ bookmarkId, initialData, @@ -142,6 +189,7 @@ export default function BookmarkPreview({ +

{t("common.tags")}

-- cgit v1.2.3-70-g09d2