diff --git a/src/app/manga/detail/page.tsx b/src/app/manga/detail/page.tsx
index b032356..e934996 100644
--- a/src/app/manga/detail/page.tsx
+++ b/src/app/manga/detail/page.tsx
@@ -48,7 +48,7 @@ function MangaDetailSkeleton() {
);
}
-function formatChapterMeta(chapter: MangaChapter): string {
+function formatChapterMeta(chapter: MangaChapter): string | null {
if (typeof chapter.pageCount === 'number' && chapter.pageCount > 0) {
return `${chapter.pageCount} 页`;
}
@@ -64,7 +64,7 @@ function formatChapterMeta(chapter: MangaChapter): string {
}
}
- return '日期未知';
+ return null;
}
export default function MangaDetailPage() {
@@ -264,8 +264,11 @@ export default function MangaDetailPage() {
)}
- {formatChapterMeta(chapter)}
- {active && currentRecord ? ` · 上次看到第 ${currentRecord.pageIndex + 1} 页` : ''}
+ {(() => {
+ const meta = formatChapterMeta(chapter);
+ const progress = active && currentRecord ? `上次看到第 ${currentRecord.pageIndex + 1} 页` : null;
+ return [meta, progress].filter(Boolean).join(' · ');
+ })()}
);
diff --git a/src/app/manga/read/page.tsx b/src/app/manga/read/page.tsx
index af9495c..764d71d 100644
--- a/src/app/manga/read/page.tsx
+++ b/src/app/manga/read/page.tsx
@@ -102,6 +102,7 @@ export default function MangaReadPage() {
const requestVerticalPageSyncRef = useRef<(() => void) | null>(null);
const currentVerticalPageIndexRef = useRef(0);
const preloadedImageUrlsRef = useRef>(new Set());
+ const activeChapterRef = useRef(null);
const getCurrentVerticalPageIndex = () => {
if (!verticalPageRefs.current.length) return 0;
@@ -642,6 +643,22 @@ export default function MangaReadPage() {
[chapterList, chapterListDesc]
);
+ useEffect(() => {
+ if (!chapterListOpen) return;
+
+ const rafId = window.requestAnimationFrame(() => {
+ activeChapterRef.current?.scrollIntoView({
+ block: 'center',
+ inline: 'nearest',
+ behavior: 'auto',
+ });
+ });
+
+ return () => {
+ window.cancelAnimationFrame(rafId);
+ };
+ }, [chapterId, chapterListOpen, orderedChapterList]);
+
const pagedItems = useMemo(() => {
if (readMode === 'single') {
return pages[activePage] ? [pages[activePage]] : [];
@@ -798,6 +815,7 @@ export default function MangaReadPage() {
return (
{
+ if (typeof window === 'undefined' || !pathname?.startsWith('/manga') || pathname === '/manga/read') return;
+
+ const reset = () => {
+ window.scrollTo({ top: 0, left: 0, behavior: 'auto' });
+ document.documentElement.scrollTop = 0;
+ document.body.scrollTop = 0;
+ };
+
+ reset();
+ const rafId = window.requestAnimationFrame(reset);
+
+ return () => {
+ window.cancelAnimationFrame(rafId);
+ };
+ }, [pathname]);
+
+ return null;
+}