From f0f26308e569e44037862e9fa39f9a7de20d9803 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Sat, 6 Sep 2025 14:13:12 +0800 Subject: [PATCH] feat: improve uni-feed layout and styling consistency - Adjusted highlight styles in the AllItem component to remove text color for better visual clarity. - Reduced the minimum height of media elements in AllItem for a more compact layout. - Updated the column width in AllMasonry for improved responsiveness and layout. - Simplified the class names in MasonryItemRender for cleaner code. These changes enhance the overall user interface by providing a more consistent and visually appealing layout across components. --- .../modules/entry-column/Items/all-item.tsx | 32 +++++++++---------- .../entry-column/Items/all-masonry.tsx | 9 ++---- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/apps/desktop/layer/renderer/src/modules/entry-column/Items/all-item.tsx b/apps/desktop/layer/renderer/src/modules/entry-column/Items/all-item.tsx index bacc42fd6..4d21bb6a5 100644 --- a/apps/desktop/layer/renderer/src/modules/entry-column/Items/all-item.tsx +++ b/apps/desktop/layer/renderer/src/modules/entry-column/Items/all-item.tsx @@ -91,19 +91,19 @@ const highlightStyle = [ // }, { type: "full", - className: "bg-blue-200 text-black", + className: "bg-blue-200", }, { type: "full", - className: "bg-yellow-200 text-black", + className: "bg-yellow-200", }, { type: "full", - className: "bg-green-200 text-black", + className: "bg-green-200", }, { type: "full", - className: "bg-orange-200 text-black", + className: "bg-orange-200", }, ] @@ -328,13 +328,13 @@ export const AllItem: EntryListItemFC = ({ entryId, entryPreview, translation }) src={mediaCover.url} type={mediaCover.type} previewImageUrl={mediaCover.preview_image_url} - className="min-h-[10em] w-full overflow-hidden" - mediaContainerClassName="size-full min-h-[10em] object-cover" - videoClassName="size-full min-h-[10em] object-cover" + className="min-h-[6em] w-full overflow-hidden" + mediaContainerClassName="size-full min-h-[6em] object-cover" + videoClassName="size-full min-h-[6em] object-cover" loading="lazy" proxy={{ - width: mediaCoverWidth ?? 200, - height: mediaCoverHeight ?? 200, + width: 600, + height: 0, }} blurhash={mediaCover.blurhash || undefined} style={{ @@ -342,7 +342,7 @@ export const AllItem: EntryListItemFC = ({ entryId, entryPreview, translation }) }} /> ) : ( -
+
{titleWithKeyword}
)} @@ -364,7 +364,7 @@ export const AllItem: EntryListItemFC = ({ entryId, entryPreview, translation }) onPreview={previewMedia} /> ) : ( -
+
{titleWithKeyword}
)} @@ -381,9 +381,9 @@ export const AllItem: EntryListItemFC = ({ entryId, entryPreview, translation }) src={mediaCover.url} type={mediaCover.type} previewImageUrl={mediaCover.preview_image_url} - className="min-h-[10em] w-full overflow-hidden" - mediaContainerClassName="size-full min-h-[10em] object-cover" - videoClassName="size-full min-h-[10em] object-cover" + className="min-h-[6em] w-full overflow-hidden" + mediaContainerClassName="size-full min-h-[6em] object-cover" + videoClassName="size-full min-h-[6em] object-cover" loading="lazy" proxy={{ width: mediaCover.width ?? 640, @@ -396,7 +396,7 @@ export const AllItem: EntryListItemFC = ({ entryId, entryPreview, translation }) showFallback={true} /> ) : ( -
+
{titleWithKeyword}
)} @@ -404,7 +404,7 @@ export const AllItem: EntryListItemFC = ({ entryId, entryPreview, translation })
)} diff --git a/apps/desktop/layer/renderer/src/modules/entry-column/Items/all-masonry.tsx b/apps/desktop/layer/renderer/src/modules/entry-column/Items/all-masonry.tsx index 91734329b..d9c7839dc 100644 --- a/apps/desktop/layer/renderer/src/modules/entry-column/Items/all-masonry.tsx +++ b/apps/desktop/layer/renderer/src/modules/entry-column/Items/all-masonry.tsx @@ -26,7 +26,7 @@ interface AllMasonryProps { } const GUTTER = 16 -const COLUMN_WIDTH = 250 +const COLUMN_WIDTH = 230 const OVERSCAN = 2 interface MasonryItem { @@ -83,7 +83,7 @@ export const AllMasonry: FC = ({ const columnCount = useMemo(() => { if (!width) return 1 - return Math.max(1, Math.floor(width / COLUMN_WIDTH)) + return Math.max(1, Math.round(width / COLUMN_WIDTH)) }, [width]) const columnWidth = useMemo(() => { @@ -268,10 +268,7 @@ const MasonryItemRender: React.ComponentType>