import { Check, X } from 'lucide-react' import type { ReactNode } from 'react' import { SHELF_GRID_COLUMNS, useReaderSettingsStore, } from '../../stores/readerSettings' import { SHELF_LAYOUT_OPTIONS, SHELF_SORT_OPTIONS, gridColumnsLabel } from './bookshelfModel' // 书架设置弹窗(对应 legado 的 dialog_bookshelf_config): // 布局(列表 / 紧凑列表 / 网格 + 列数)、排序、以及显示项开关。 // 所有选项直接落到 readerSettings store,关掉弹窗即生效。 function Section({ title, hint, children }: { title: string; hint?: string; children: ReactNode }) { return (

{title}

{hint &&

{hint}

}
{children}
) } function RadioOption({ active, label, hint, onClick, }: { active: boolean label: string hint?: string onClick: () => void }) { return ( ) } function ToggleOption({ active, label, hint, onToggle, }: { active: boolean label: string hint?: string onToggle: () => void }) { return ( ) } export function BookshelfSettingsDialog({ onClose }: { onClose: () => void }) { const layout = useReaderSettingsStore((s) => s.shelfLayout) const setLayout = useReaderSettingsStore((s) => s.setShelfLayout) const columns = useReaderSettingsStore((s) => s.shelfGridColumns) const setColumns = useReaderSettingsStore((s) => s.setShelfGridColumns) const sort = useReaderSettingsStore((s) => s.shelfSort) const setSort = useReaderSettingsStore((s) => s.setShelfSort) const showUnread = useReaderSettingsStore((s) => s.shelfShowUnread) const setShowUnread = useReaderSettingsStore((s) => s.setShelfShowUnread) const showUpdateTime = useReaderSettingsStore((s) => s.shelfShowUpdateTime) const setShowUpdateTime = useReaderSettingsStore((s) => s.setShelfShowUpdateTime) return (
event.stopPropagation()} >

书架设置

布局、排序与显示项

{SHELF_LAYOUT_OPTIONS.map((option) => ( setLayout(option.value)} /> ))}
{layout === 'grid' && (
列数 {SHELF_GRID_COLUMNS.map((value) => ( ))}
)}
{SHELF_SORT_OPTIONS.map((option) => ( setSort(option.value)} /> ))}
setShowUnread(!showUnread)} /> setShowUpdateTime(!showUpdateTime)} />
) }