import { useEffect, useState } from "react"; import { useTranslation } from "react-i18n-lite"; import styles from "./FinishedBooksShelf.module.css"; export interface ShelfBook { id: number; title: string; author: string; cover_image: string | null; format: string; genre: string; } interface FinishedBooksShelfProps { books: ShelfBook[]; defaultExpanded?: boolean; onOpenBook: (book: ShelfBook) => void; onContextMenu: (e: React.MouseEvent, book: ShelfBook) => void; } export function FinishedBooksShelf({ books, defaultExpanded = false, onOpenBook, onContextMenu, }: FinishedBooksShelfProps) { const { t } = useTranslation(); const [expanded, setExpanded] = useState(defaultExpanded); useEffect(() => { if (defaultExpanded) setExpanded(true); }, [defaultExpanded]); if (books.length === 0) return null; return (
{book.title}
{book.author}