mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-20 12:11:28 -07:00
- Add note ID resolution through merge redirects in stats API - Build Anki note previews using configured field names - Add session event helpers for merged note dedup and stable request keys - Refactor SessionDetail to prevent redundant note info requests - Add session event popover and API client tests
46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
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-cards-mined"
|
|
/>
|
|
<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>
|
|
);
|
|
}
|