import Link from "next/link"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { listRecordings } from "@/lib/db/queries/recordings"; import { listPlaySessions } from "@/lib/db/queries/play-sessions"; import { getSessionsSummary } from "@/lib/db/queries/stats"; // Always reflects live DB state for an authenticated, single-tenant app - // never worth prerendering (and the DB file doesn't exist at build time). export const dynamic = "force-dynamic"; export default async function DashboardPage() { const [recordings, sessions, summary] = await Promise.all([ listRecordings(), listPlaySessions(), getSessionsSummary(), ]); const recentRecordings = recordings.slice(0, 5); const recentSessions = [...sessions].reverse().slice(0, 5); return (

Welcome back

Scan for nearby devices, take control, and record sessions to replay later - all running directly from your browser over Web Bluetooth.

Completed sessions {summary.count} Total play time {(summary.totalDurationMs / 3_600_000).toFixed(1)}h Saved recordings {recordings.length}
Recent recordings {recentRecordings.length === 0 && (

Nothing saved yet.

)} {recentRecordings.map((r) => ( {r.name} {r.playCount} plays ))}
Recent sessions {recentSessions.length === 0 &&

No sessions yet.

} {recentSessions.map((s) => ( {s.name ?? `Session #${s.id}`} {new Date(s.startedAt).toLocaleDateString()} ))}
); }