From d9b3757b1c974f73a5d87a3b5cb019c5f9de05ca Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Wed, 26 Nov 2025 21:49:07 +0800 Subject: [PATCH] fix(layout): fix layout for import book item in grid fit mode (#2554) --- .../src/app/library/components/BookItem.tsx | 1 + .../src/app/library/components/Bookshelf.tsx | 14 +++++++++++++- .../src/app/library/components/BookshelfItem.tsx | 4 +--- .../src/app/library/components/GroupItem.tsx | 3 ++- .../src/components/settings/MiscPanel.tsx | 13 +++++++++++-- 5 files changed, 28 insertions(+), 7 deletions(-) diff --git a/apps/readest-app/src/app/library/components/BookItem.tsx b/apps/readest-app/src/app/library/components/BookItem.tsx index 630ddac6..7f65893e 100644 --- a/apps/readest-app/src/app/library/components/BookItem.tsx +++ b/apps/readest-app/src/app/library/components/BookItem.tsx @@ -54,6 +54,7 @@ const BookItem: React.FC = ({ 'book-item flex', mode === 'grid' && 'h-full flex-col justify-end', mode === 'list' && 'h-28 flex-row gap-4 overflow-hidden', + mode === 'list' ? 'library-list-item' : 'library-grid-item', appService?.hasContextMenu ? 'cursor-pointer' : '', )} onClick={(e) => e.stopPropagation()} diff --git a/apps/readest-app/src/app/library/components/Bookshelf.tsx b/apps/readest-app/src/app/library/components/Bookshelf.tsx index fda7fcc5..fef4627c 100644 --- a/apps/readest-app/src/app/library/components/Bookshelf.tsx +++ b/apps/readest-app/src/app/library/components/Bookshelf.tsx @@ -11,6 +11,7 @@ import { useAutoFocus } from '@/hooks/useAutoFocus'; import { useSettingsStore } from '@/store/settingsStore'; import { useLibraryStore } from '@/store/libraryStore'; import { useTranslation } from '@/hooks/useTranslation'; +import { useResponsiveSize } from '@/hooks/useResponsiveSize'; import { navigateToLibrary, navigateToReader, showReaderWindow } from '@/utils/nav'; import { createBookFilter, createBookSorter } from '../utils/libraryUtils'; import { formatTitle } from '@/utils/book'; @@ -73,6 +74,7 @@ const Bookshelf: React.FC = ({ ); const [coverFit, setCoverFit] = useState(searchParams?.get('cover') || settings.libraryCoverFit); const isImportingBook = useRef(false); + const iconSize15 = useResponsiveSize(15); const { setCurrentBookshelf, setLibrary } = useLibraryStore(); const { setSelectedBooks, getSelectedBooks, toggleSelectedBook } = useLibraryStore(); @@ -354,7 +356,17 @@ const Bookshelf: React.FC = ({ /> ))} {viewMode === 'grid' && currentBookshelfItems.length > 0 && ( -
+