Files
valknarandClaude Sonnet 5 c4ed849d37 Remove stats tab switcher, drop duration-per-device, show devices inline
Sessions and Devices no longer live behind a Tabs switcher on the stats
page - both sections render directly, one after the other. Also drops
the "Duration per device" list from the sessions summary cards since
DeviceUsageTable already shows per-device active time in more detail.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzyfRyA7h5rs5SCAahLAWd
2026-08-30 20:33:47 +02:00

31 lines
1.1 KiB
TypeScript

import type { Metadata } from "next";
import { SessionsSummaryCards } from "@/components/stats/SessionsSummaryCards";
import { DeviceUsageTable } from "@/components/stats/DeviceUsageTable";
import { getDeviceCommandCounts, getDeviceUsageStats, 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] = await Promise.all([
getSessionsSummary(),
getDeviceUsageStats(),
getDeviceCommandCounts(),
]);
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 and devices.</p>
</div>
<SessionsSummaryCards summary={sessionsSummary} />
<DeviceUsageTable devices={devices} />
</div>
);
}