From 34d2b48578532d387b1466c82ae4a761cd1d1a4f Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Sun, 2 Nov 2025 20:13:57 +0000 Subject: feat: Add view options to show tag/title and control image fit. Fixes #1960 --- .../bookmarks/BookmarkLayoutAdaptingCard.tsx | 61 ++++++++++++++-------- 1 file changed, 40 insertions(+), 21 deletions(-) (limited to 'apps/web/components/dashboard/bookmarks/BookmarkLayoutAdaptingCard.tsx') diff --git a/apps/web/components/dashboard/bookmarks/BookmarkLayoutAdaptingCard.tsx b/apps/web/components/dashboard/bookmarks/BookmarkLayoutAdaptingCard.tsx index 26c1c72b..b53a14c5 100644 --- a/apps/web/components/dashboard/bookmarks/BookmarkLayoutAdaptingCard.tsx +++ b/apps/web/components/dashboard/bookmarks/BookmarkLayoutAdaptingCard.tsx @@ -18,6 +18,7 @@ import { useTheme } from "next-themes"; import type { ZBookmark } from "@karakeep/shared/types/bookmarks"; import { BookmarkTypes } from "@karakeep/shared/types/bookmarks"; import { isBookmarkStillTagging } from "@karakeep/shared/utils/bookmarkUtils"; +import { switchCase } from "@karakeep/shared/utils/switch"; import BookmarkActionBar from "./BookmarkActionBar"; import BookmarkFormattedCreatedAt from "./BookmarkFormattedCreatedAt"; @@ -117,7 +118,12 @@ function ListView({ footer, className, }: Props) { - const { showNotes } = useBookmarkDisplaySettings(); + const { showNotes, showTags, showTitle, imageFit } = + useBookmarkDisplaySettings(); + const imgFitClass = switchCase(imageFit, { + cover: "object-cover", + contain: "object-contain", + }); const note = showNotes ? bookmark.note?.trim() : undefined; return ( @@ -129,23 +135,25 @@ function ListView({ >
- {image("list", "object-cover rounded-lg size-32")} + {image("list", cn("size-32 rounded-lg", imgFitClass))}
- {title && ( + {showTitle && title && (
{title}
)} {content &&
{content}
} {note && } -
- -
+ {showTags && ( +
+ +
+ )}
@@ -164,9 +172,17 @@ function GridView({ layout, fitHeight = false, }: Props & { layout: BookmarksLayoutTypes }) { - const { showNotes } = useBookmarkDisplaySettings(); + const { showNotes, showTags, showTitle, imageFit } = + useBookmarkDisplaySettings(); + const imgFitClass = switchCase(imageFit, { + cover: "object-cover", + contain: "object-contain", + }); const note = showNotes ? bookmark.note?.trim() : undefined; - const img = image("grid", "h-52 min-h-52 w-full object-cover rounded-t-lg"); + const img = image( + "grid", + cn("h-52 min-h-52 w-full rounded-t-lg", imgFitClass), + ); return (
{img}
}
- {title && ( + {showTitle && title && (
{title}
)} {content &&
{content}
} {note && } -
- -
+ {showTags && ( +
+ +
+ )}
@@ -202,6 +220,7 @@ function GridView({ } function CompactView({ bookmark, title, footer, className }: Props) { + const { showTitle } = useBookmarkDisplaySettings(); return (
)} - { + {showTitle && (
{title ?? "Untitled"}
- } + )} {footer && (

•{footer}

)} -- cgit v1.2.3-70-g09d2