mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-20 12:11:28 -07:00
5-tab React dashboard with Catppuccin Mocha theme: - Overview: hero stats, streak calendar, watch time chart, recent sessions - Anime: grid with cover art, episode list with completion %, detail view - Trends: 15 charts across Activity, Efficiency, Anime, and Patterns - Vocabulary: POS-filtered word/kanji lists with detail panels - Sessions: expandable session history with event timeline Features: - Cross-tab navigation (anime <-> vocabulary) - Global word detail panel overlay - Expandable episode detail with Anki card links (Expression field) - Per-anime multi-line trend charts - Watch time by day-of-week and hour-of-day - Collapsible sections with accessibility (aria-expanded) - Card size selector for anime grid - Cover art caching via AniList - HTTP API client with file:// protocol fallback for Electron overlay
22 lines
732 B
TypeScript
22 lines
732 B
TypeScript
import { useState, useEffect } from 'react';
|
|
import { getStatsClient } from './useStatsApi';
|
|
import type { AnimeLibraryItem } from '../types/stats';
|
|
|
|
export function useAnimeLibrary() {
|
|
const [anime, setAnime] = useState<AnimeLibraryItem[]>([]);
|
|
const [loading, setLoading] = useState(true);
|
|
const [error, setError] = useState<string | null>(null);
|
|
|
|
useEffect(() => {
|
|
let cancelled = false;
|
|
getStatsClient()
|
|
.getAnimeLibrary()
|
|
.then((data) => { if (!cancelled) setAnime(data); })
|
|
.catch((err: Error) => { if (!cancelled) setError(err.message); })
|
|
.finally(() => { if (!cancelled) setLoading(false); });
|
|
return () => { cancelled = true; };
|
|
}, []);
|
|
|
|
return { anime, loading, error };
|
|
}
|