diff --git a/app/manga/[slug]/[chapter]/page.tsx b/app/manga/[slug]/[chapter]/page.tsx
index 1824e25..d9dad13 100644
--- a/app/manga/[slug]/[chapter]/page.tsx
+++ b/app/manga/[slug]/[chapter]/page.tsx
@@ -53,6 +53,11 @@ export default async function ChapterReaderPage({ params }: Props) {
? manga.chapters[chapterIndex + 1].number
: null;
+ const allChapters = manga.chapters.map((c) => ({
+ number: c.number,
+ title: c.title,
+ }));
+
return (
);
}
diff --git a/components/PageReader.tsx b/components/PageReader.tsx
index d8268c1..b28ecca 100644
--- a/components/PageReader.tsx
+++ b/components/PageReader.tsx
@@ -1,6 +1,6 @@
"use client";
-import { useState } from "react";
+import { useState, useEffect, useRef } from "react";
import Link from "next/link";
type PageData = {
@@ -8,6 +8,11 @@ type PageData = {
imageUrl: string;
};
+type ChapterInfo = {
+ number: number;
+ title: string;
+};
+
type PageReaderProps = {
pages: PageData[];
mangaSlug: string;
@@ -16,6 +21,7 @@ type PageReaderProps = {
chapterTitle: string;
prevChapter: number | null;
nextChapter: number | null;
+ chapters: ChapterInfo[];
};
export function PageReader({
@@ -26,8 +32,26 @@ export function PageReader({
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 (
@@ -106,9 +130,23 @@ export function PageReader({
) : (
)}
-
- {pages.length} pages
-
+
{nextChapter ? (
+ {/* Chapter drawer overlay */}
+ {showDrawer && (
+ setShowDrawer(false)}
+ >
+ {/* Backdrop */}
+
+
+ {/* Bottom sheet */}
+
e.stopPropagation()}
+ >
+ {/* Handle + header */}
+
+ {/* Chapter list */}
+
+ {chapters.map((ch) => (
+ setShowDrawer(false)}
+ >
+ Ch. {ch.number} — {ch.title}
+
+ ))}
+
+
+
+ )}
);
}