From 33f407797213c56dd2f13e98228a5305efdf90fd Mon Sep 17 00:00:00 2001 From: xuatz Date: Mon, 3 Nov 2025 04:32:18 +0900 Subject: feat: display notes on bookmark card (#2083) * feat: display notes on bookmark card * apply styling * include mobile impl * apply pr comments * add display options menu into PR * put it under app setting * cleanup * address pr comments * change the default for show notes to false * make the in-card note font lighter --------- Co-authored-by: Mohamed Bassem --- .../bookmarks/BookmarkLayoutAdaptingCard.tsx | 28 ++++++--- .../components/dashboard/bookmarks/NotePreview.tsx | 66 ++++++++++++++++++++++ 2 files changed, 86 insertions(+), 8 deletions(-) create mode 100644 apps/web/components/dashboard/bookmarks/NotePreview.tsx (limited to 'apps/web/components/dashboard/bookmarks') diff --git a/apps/web/components/dashboard/bookmarks/BookmarkLayoutAdaptingCard.tsx b/apps/web/components/dashboard/bookmarks/BookmarkLayoutAdaptingCard.tsx index 4b511a3c..26c1c72b 100644 --- a/apps/web/components/dashboard/bookmarks/BookmarkLayoutAdaptingCard.tsx +++ b/apps/web/components/dashboard/bookmarks/BookmarkLayoutAdaptingCard.tsx @@ -1,10 +1,14 @@ +"use client"; + import type { BookmarksLayoutTypes } from "@/lib/userLocalSettings/types"; -import React, { useEffect, useState } from "react"; +import type { ReactNode } from "react"; +import { useEffect, useState } from "react"; import Image from "next/image"; import Link from "next/link"; import useBulkActionsStore from "@/lib/bulkActions"; import { bookmarkLayoutSwitch, + useBookmarkDisplaySettings, useBookmarkLayout, } from "@/lib/userLocalSettings/bookmarksLayout"; import { cn } from "@/lib/utils"; @@ -17,14 +21,15 @@ import { isBookmarkStillTagging } from "@karakeep/shared/utils/bookmarkUtils"; import BookmarkActionBar from "./BookmarkActionBar"; import BookmarkFormattedCreatedAt from "./BookmarkFormattedCreatedAt"; +import { NotePreview } from "./NotePreview"; import TagList from "./TagList"; interface Props { bookmark: ZBookmark; - image: (layout: BookmarksLayoutTypes, className: string) => React.ReactNode; - title?: React.ReactNode; - content?: React.ReactNode; - footer?: React.ReactNode; + image: (layout: BookmarksLayoutTypes, className: string) => ReactNode; + title?: ReactNode; + content?: ReactNode; + footer?: ReactNode; className?: string; fitHeight?: boolean; wrapTags: boolean; @@ -34,7 +39,7 @@ function BottomRow({ footer, bookmark, }: { - footer?: React.ReactNode; + footer?: ReactNode; bookmark: ZBookmark; }) { return ( @@ -112,6 +117,9 @@ function ListView({ footer, className, }: Props) { + const { showNotes } = useBookmarkDisplaySettings(); + const note = showNotes ? bookmark.note?.trim() : undefined; + return (
)} {content &&
{content}
} + {note && }
- {img &&
{img}
} + {img &&
{img}
}
{title && ( @@ -175,6 +186,7 @@ function GridView({
)} {content &&
{content}
} + {note && }
+ +
+ +
+ {note} +
+
+
+ +
+
+ {note} +
+
+ + + +
+
+
+ + ); +} -- cgit v1.2.3-70-g09d2