2026-08-25 07:51:38 +02:00
|
|
|
|
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
|
|
|
|
|
|
|
|
|
|
|
export interface SessionsSummary {
|
|
|
|
|
|
count: number;
|
|
|
|
|
|
totalDurationMs: number;
|
|
|
|
|
|
avgDurationMs: number;
|
2026-08-27 21:38:51 +02:00
|
|
|
|
totalReplays: number;
|
2026-08-25 07:51:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function formatHours(ms: number): string {
|
|
|
|
|
|
return `${(ms / 3_600_000).toFixed(1)}h`;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-08-30 20:31:31 +02:00
|
|
|
|
function formatReplays(count: number): string {
|
|
|
|
|
|
return count === 0 ? "-" : `${count}×`;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-08-25 07:51:38 +02:00
|
|
|
|
export function SessionsSummaryCards({ summary }: { summary: SessionsSummary }) {
|
|
|
|
|
|
return (
|
2026-08-30 20:33:47 +02:00
|
|
|
|
<div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-4">
|
|
|
|
|
|
<Card className="bp-glass">
|
|
|
|
|
|
<CardHeader>
|
|
|
|
|
|
<CardTitle className="text-sm text-muted-foreground">Completed sessions</CardTitle>
|
|
|
|
|
|
</CardHeader>
|
|
|
|
|
|
<CardContent className="bp-readout text-3xl">{summary.count}</CardContent>
|
|
|
|
|
|
</Card>
|
|
|
|
|
|
<Card className="bp-glass">
|
|
|
|
|
|
<CardHeader>
|
|
|
|
|
|
<CardTitle className="text-sm text-muted-foreground">Total time</CardTitle>
|
|
|
|
|
|
</CardHeader>
|
|
|
|
|
|
<CardContent className="bp-readout text-3xl">{formatHours(summary.totalDurationMs)}</CardContent>
|
|
|
|
|
|
</Card>
|
|
|
|
|
|
<Card className="bp-glass">
|
|
|
|
|
|
<CardHeader>
|
|
|
|
|
|
<CardTitle className="text-sm text-muted-foreground">Avg session length</CardTitle>
|
|
|
|
|
|
</CardHeader>
|
|
|
|
|
|
<CardContent className="bp-readout text-3xl">
|
|
|
|
|
|
{Math.round(summary.avgDurationMs / 60_000)}m
|
|
|
|
|
|
</CardContent>
|
|
|
|
|
|
</Card>
|
|
|
|
|
|
<Card className="bp-glass">
|
|
|
|
|
|
<CardHeader>
|
|
|
|
|
|
<CardTitle className="text-sm text-muted-foreground">Replays</CardTitle>
|
|
|
|
|
|
</CardHeader>
|
|
|
|
|
|
<CardContent className="bp-readout text-3xl">{formatReplays(summary.totalReplays)}</CardContent>
|
|
|
|
|
|
</Card>
|
2026-08-25 07:51:38 +02:00
|
|
|
|
</div>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|