- Fix device rename input collapsing on mobile (fixed width vs w-full inside an auto-layout table column). - Add cascade-delete confirmation for sessions with a saved recording. - Fix header connection LED: derive state from scanning/device-count/ recording instead of the Buttplug client's raw connected flag; drop the label text and hide the indicator entirely when idle. - Add a per-device disconnect button (stop + remove from store, the closest equivalent Buttplug's protocol allows per device). - Fix replay ending early: duration now comes from the recording's actual durationMs, not the last event's timestamp. - Replay robustness: show which devices are being replayed to, reset actuators to zero on start/play/pause, fully disconnect devices and the whole client on stop/unmount, surface command failures via toast. - Stop flagging the header LED red during replay - recording is only for live sessions. - Add page-number pagination to recordings/sessions/devices lists. - Wordmark SEXY -> Sexy; add proper per-page <title>s including dynamic titles for recording/session detail and replay pages. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
48 lines
2.0 KiB
TypeScript
48 lines
2.0 KiB
TypeScript
import type { Metadata } from "next";
|
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
|
import { SessionsSummaryCards } from "@/components/stats/SessionsSummaryCards";
|
|
import { DeviceUsageTable } from "@/components/stats/DeviceUsageTable";
|
|
import { RecordingLibraryStats } from "@/components/stats/RecordingLibraryStats";
|
|
import { getDeviceCommandCounts, getDeviceUsageStats, getRecordingLibraryStats, getSessionsSummary } from "@/lib/db/queries/stats";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
export const metadata: Metadata = { title: "Stats" };
|
|
|
|
export default async function StatsPage() {
|
|
const [sessionsSummary, deviceUsage, commandCounts, recordingStats] = await Promise.all([
|
|
getSessionsSummary(),
|
|
getDeviceUsageStats(),
|
|
getDeviceCommandCounts(),
|
|
getRecordingLibraryStats(),
|
|
]);
|
|
|
|
const commandCountByDevice = new Map(commandCounts.map((c) => [c.deviceId, c.commandCount]));
|
|
const devices = deviceUsage.map((d) => ({ ...d, commandCount: commandCountByDevice.get(d.deviceId) ?? 0 }));
|
|
|
|
return (
|
|
<div className="flex flex-col gap-6">
|
|
<div>
|
|
<h1 className="font-heading text-2xl font-semibold">Stats</h1>
|
|
<p className="text-sm text-muted-foreground">Usage across sessions, devices, and your recording library.</p>
|
|
</div>
|
|
|
|
<Tabs defaultValue="sessions">
|
|
<TabsList>
|
|
<TabsTrigger value="sessions">Sessions</TabsTrigger>
|
|
<TabsTrigger value="devices">Devices</TabsTrigger>
|
|
<TabsTrigger value="recordings">Recordings</TabsTrigger>
|
|
</TabsList>
|
|
<TabsContent value="sessions" className="pt-4">
|
|
<SessionsSummaryCards summary={sessionsSummary} />
|
|
</TabsContent>
|
|
<TabsContent value="devices" className="pt-4">
|
|
<DeviceUsageTable devices={devices} />
|
|
</TabsContent>
|
|
<TabsContent value="recordings" className="pt-4">
|
|
<RecordingLibraryStats stats={recordingStats} />
|
|
</TabsContent>
|
|
</Tabs>
|
|
</div>
|
|
);
|
|
}
|