import React from 'react'; import { useReaderStore } from '@/store/readerStore'; import FoliateViewer from './FoliateViewer'; import getGridTemplate from '@/utils/grid'; import SectionInfo from './SectionInfo'; import HeaderBar from './HeaderBar'; import FooterBar from './FooterBar'; import PageInfoView from './PageInfo'; import Ribbon from './Ribbon'; import SettingsDialog from './settings/SettingsDialog'; import Annotator from './annotator/Annotator'; interface BooksGridProps { bookKeys: string[]; onCloseBook: (bookKey: string) => void; } const BooksGrid: React.FC = ({ bookKeys, onCloseBook }) => { const { getConfig, getProgress, getBookData, getViewState, getViewSettings } = useReaderStore(); const { isFontLayoutSettingsDialogOpen, setFontLayoutSettingsDialogOpen } = useReaderStore(); const gridTemplate = getGridTemplate(bookKeys.length, window.innerWidth / window.innerHeight); return (
{bookKeys.map((bookKey, index) => { const bookData = getBookData(bookKey); const config = getConfig(bookKey); const progress = getProgress(bookKey); const viewSettings = getViewSettings(bookKey); const { book, bookDoc } = bookData || {}; if (!book || !config || !bookDoc || !viewSettings) return null; const { section, pageinfo, tocLabel: chapter } = progress || {}; const isBookmarked = getViewState(bookKey)?.ribbonVisible; const marginGap = `${viewSettings.gapPercent}%`; return (
{isBookmarked && } 2} onCloseBook={onCloseBook} onSetSettingsDialogOpen={setFontLayoutSettingsDialogOpen} /> {viewSettings.scrolled ? null : ( <> )} {isFontLayoutSettingsDialogOpen && }
); })}
); }; export default BooksGrid;