diff --git a/src/components/reader/BookReader.tsx b/src/components/reader/BookReader.tsx index 9920570..c9c8752 100644 --- a/src/components/reader/BookReader.tsx +++ b/src/components/reader/BookReader.tsx @@ -18,6 +18,7 @@ import { useTranslate } from "@/hooks/useTranslate"; export function BookReader({ book, pages, onClose, nextBook }: BookReaderProps) { const [isDoublePage, setIsDoublePage] = useState(false); const [showControls, setShowControls] = useState(false); + const [showThumbnails, setShowThumbnails] = useState(false); const readerRef = useRef(null); const isLandscape = useOrientation(); const { direction, toggleDirection, isRTL } = useReadingDirection(); @@ -126,6 +127,8 @@ export function BookReader({ book, pages, onClose, nextBook }: BookReaderProps) onToggleFullscreen={() => toggleFullscreen(readerRef.current)} direction={direction} onToggleDirection={toggleDirection} + showThumbnails={showThumbnails} + onToggleThumbnails={() => setShowThumbnails(!showThumbnails)} /> diff --git a/src/components/reader/components/ControlButtons.tsx b/src/components/reader/components/ControlButtons.tsx index cf86039..0ce8307 100644 --- a/src/components/reader/components/ControlButtons.tsx +++ b/src/components/reader/components/ControlButtons.tsx @@ -9,6 +9,7 @@ import { Minimize2, MoveRight, MoveLeft, + Images, } from "lucide-react"; import { cn } from "@/lib/utils"; import { PageInput } from "./PageInput"; @@ -29,6 +30,8 @@ export const ControlButtons = ({ direction, onToggleDirection, onPageChange, + showThumbnails, + onToggleThumbnails, }: ControlButtonsProps) => { const { t } = useTranslation(); @@ -95,6 +98,21 @@ export const ControlButtons = ({ > {isFullscreen ? : } +
e.stopPropagation()}> { const [isTooSmall, setIsTooSmall] = useState(false); @@ -31,21 +32,21 @@ export const NavigationBar = ({ return () => window.removeEventListener("resize", checkHeight); }, []); - // Scroll à l'ouverture des contrôles et au changement de page + // Scroll à l'ouverture des vignettes et au changement de page useEffect(() => { - if (showControls && !isTooSmall) { + if (showThumbnails && !isTooSmall) { requestAnimationFrame(() => { const thumbnail = document.getElementById(`thumbnail-${currentPage}`); if (thumbnail) { thumbnail.scrollIntoView({ - behavior: showControls ? "instant" : "smooth", + behavior: showThumbnails ? "instant" : "smooth", block: "nearest", inline: "center", }); } }); } - }, [showControls, currentPage, isTooSmall]); + }, [showThumbnails, currentPage, isTooSmall]); if (isTooSmall) { return null; @@ -55,10 +56,10 @@ export const NavigationBar = ({
- {showControls && ( + {showThumbnails && ( <>
-
- Page {currentPage} / {pages.length} -
+ {showControls && ( +
+ Page {currentPage} / {pages.length} +
+ )} )}
diff --git a/src/components/reader/types.ts b/src/components/reader/types.ts index 3a896da..8b607ec 100644 --- a/src/components/reader/types.ts +++ b/src/components/reader/types.ts @@ -31,6 +31,7 @@ export interface NavigationBarProps { pages: number[]; onPageChange: (page: number) => void; showControls: boolean; + showThumbnails: boolean; book: KomgaBook; } @@ -49,6 +50,8 @@ export interface ControlButtonsProps { onToggleFullscreen: () => void; direction: "ltr" | "rtl"; onToggleDirection: () => void; + showThumbnails: boolean; + onToggleThumbnails: () => void; } export interface UsePageNavigationProps {