mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-21 12:11:28 -07:00
feat(stats): build anime-centric stats dashboard frontend
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
This commit is contained in:
51
stats/src/components/overview/HeroStats.tsx
Normal file
51
stats/src/components/overview/HeroStats.tsx
Normal file
@@ -0,0 +1,51 @@
|
||||
import { StatCard } from '../layout/StatCard';
|
||||
import { formatDuration, formatNumber, todayLocalDay, localDayFromMs } from '../../lib/formatters';
|
||||
import type { OverviewSummary } from '../../lib/dashboard-data';
|
||||
import type { SessionSummary } from '../../types/stats';
|
||||
|
||||
interface HeroStatsProps {
|
||||
summary: OverviewSummary;
|
||||
sessions: SessionSummary[];
|
||||
}
|
||||
|
||||
export function HeroStats({ summary, sessions }: HeroStatsProps) {
|
||||
const today = todayLocalDay();
|
||||
const sessionsToday = sessions.filter(
|
||||
(s) => localDayFromMs(s.startedAtMs) === today,
|
||||
).length;
|
||||
|
||||
return (
|
||||
<div className="grid grid-cols-2 xl:grid-cols-6 gap-3">
|
||||
<StatCard
|
||||
label="Watch Time Today"
|
||||
value={formatDuration(summary.todayActiveMs)}
|
||||
color="text-ctp-blue"
|
||||
/>
|
||||
<StatCard
|
||||
label="Cards Mined Today"
|
||||
value={formatNumber(summary.todayCards)}
|
||||
color="text-ctp-green"
|
||||
/>
|
||||
<StatCard
|
||||
label="Sessions Today"
|
||||
value={formatNumber(sessionsToday)}
|
||||
color="text-ctp-lavender"
|
||||
/>
|
||||
<StatCard
|
||||
label="Episodes Today"
|
||||
value={formatNumber(summary.episodesToday)}
|
||||
color="text-ctp-teal"
|
||||
/>
|
||||
<StatCard
|
||||
label="Current Streak"
|
||||
value={`${summary.streakDays}d`}
|
||||
color="text-ctp-peach"
|
||||
/>
|
||||
<StatCard
|
||||
label="Active Anime"
|
||||
value={formatNumber(summary.activeAnimeCount)}
|
||||
color="text-ctp-mauve"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user