Show anime progress from latest session position

- include anime ID in media detail data
- use latest session position for episode progress
- update stats UI and lookup tests
This commit is contained in:
2026-03-19 21:57:04 -07:00
parent 64a88020c9
commit 2258ededbd
11 changed files with 341 additions and 4 deletions

View File

@@ -166,9 +166,7 @@ export function App() {
? 'Back to Sessions'
: 'Back to Library'
}
onNavigateToAnime={
mediaDetail.origin.type === 'anime' ? undefined : navigateToAnime
}
onNavigateToAnime={navigateToAnime}
/>
</Suspense>
) : (

View File

@@ -38,7 +38,7 @@ export function MediaDetailView({
if (!data?.detail) return <div className="text-ctp-overlay2 p-4">Media not found</div>;
const sessions = localSessions ?? data.sessions;
const animeId = sessions.find((s) => s.animeId != null)?.animeId ?? null;
const animeId = data.detail.animeId;
const detail = {
...data.detail,
totalSessions: sessions.length,

View File

@@ -35,6 +35,7 @@ test('MediaHeader renders Yomitan lookup count and lookup rate copy', () => {
detail={{
videoId: 7,
canonicalTitle: 'Episode 7',
animeId: null,
totalSessions: 4,
totalActiveMs: 90_000,
totalCards: 12,
@@ -58,6 +59,7 @@ test('MediaHeader distinguishes token occurrences from known unique words', () =
detail={{
videoId: 7,
canonicalTitle: 'Episode 7',
animeId: null,
totalSessions: 4,
totalActiveMs: 90_000,
totalCards: 12,

View File

@@ -136,6 +136,7 @@ export interface MediaDetailData {
detail: {
videoId: number;
canonicalTitle: string;
animeId: number | null;
totalSessions: number;
totalActiveMs: number;
totalCards: number;