"use client"; import { useState, useEffect, useRef } from "react"; import Link from "next/link"; type PageData = { number: number; imageUrl: string; }; type ChapterInfo = { number: number; title: string; }; type PageReaderProps = { pages: PageData[]; mangaSlug: string; mangaTitle: string; chapterNumber: number; chapterTitle: string; prevChapter: number | null; nextChapter: number | null; chapters: ChapterInfo[]; }; export function PageReader({ pages, mangaSlug, mangaTitle, chapterNumber, chapterTitle, prevChapter, nextChapter, chapters, }: PageReaderProps) { const [showUI, setShowUI] = useState(true); const [showDrawer, setShowDrawer] = useState(false); const lastScrollY = useRef(0); useEffect(() => { const handleScroll = () => { const currentY = window.scrollY; if (currentY > lastScrollY.current && currentY > 50) { setShowUI(false); } else if (currentY < lastScrollY.current) { setShowUI(true); } lastScrollY.current = currentY; }; window.addEventListener("scroll", handleScroll, { passive: true }); return () => window.removeEventListener("scroll", handleScroll); }, []); return (
{mangaTitle}
Ch. {chapterNumber} — {chapterTitle}