fix(home): keep finished series off the Continue-reading shelf

A "Continue reading" shelf listing series the reader already finished (read
to the last page, nothing new) is odd. Expose the last-read chapter's
page_count on the read-progress list, and filter the shelf to drop entries
that are caught up (on the last page of the latest chapter with no new
chapters). Mid-chapter and has-new-chapters entries stay; the full history
view is unaffected. Finished detection is a pure, unit-tested helper.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
MechaCat02
2026-07-04 21:52:58 +02:00
parent 3824eaafb2
commit bfaa166e0a
14 changed files with 133 additions and 6 deletions

View File

@@ -0,0 +1,20 @@
import type { ReadProgressSummary } from '$lib/api/read_progress';
// Whether a read-progress entry has nothing left to continue: the reader is
// on the last page of the latest chapter and no newer chapters exist. Such
// finished series are kept off the homepage "Continue reading" shelf (the
// full history view still shows them).
export function isCaughtUp(
e: Pick<
ReadProgressSummary,
'new_chapters_count' | 'chapter_number' | 'chapter_page_count' | 'page'
>
): boolean {
return (
e.new_chapters_count === 0 &&
e.chapter_number != null &&
e.chapter_page_count != null &&
e.chapter_page_count > 0 &&
e.page >= e.chapter_page_count
);
}