diff --git a/app/(app)/stats/page.tsx b/app/(app)/stats/page.tsx
index 42ae19c..3be683b 100644
--- a/app/(app)/stats/page.tsx
+++ b/app/(app)/stats/page.tsx
@@ -1,5 +1,4 @@
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 { getDeviceCommandCounts, getDeviceUsageStats, getSessionsSummary } from "@/lib/db/queries/stats";
@@ -24,18 +23,8 @@ export default async function StatsPage() {
Usage across sessions and devices.
-
-
- Sessions
- Devices
-
-
-
-
-
-
-
-
+
+
);
}
diff --git a/components/stats/SessionsSummaryCards.tsx b/components/stats/SessionsSummaryCards.tsx
index 464a73a..4014819 100644
--- a/components/stats/SessionsSummaryCards.tsx
+++ b/components/stats/SessionsSummaryCards.tsx
@@ -5,7 +5,6 @@ export interface SessionsSummary {
totalDurationMs: number;
avgDurationMs: number;
totalReplays: number;
- durationPerDevice: { deviceId: number; displayName: string | null; bleName: string; totalActiveMs: number }[];
}
function formatHours(ms: number): string {
@@ -18,50 +17,33 @@ function formatReplays(count: number): string {
export function SessionsSummaryCards({ summary }: { summary: SessionsSummary }) {
return (
-
-
-
-
- Completed sessions
-
- {summary.count}
-
-
-
- Total time
-
- {formatHours(summary.totalDurationMs)}
-
-
-
- Avg session length
-
-
- {Math.round(summary.avgDurationMs / 60_000)}m
-
-
-
-
- Replays
-
- {formatReplays(summary.totalReplays)}
-
-
- {summary.durationPerDevice.length > 0 && (
-
-
- Duration per device
-
-
- {summary.durationPerDevice.map((d) => (
-
- {d.displayName ?? d.bleName}
- {formatHours(d.totalActiveMs)}
-
- ))}
-
-
- )}
+
+
+
+ Completed sessions
+
+ {summary.count}
+
+
+
+ Total time
+
+ {formatHours(summary.totalDurationMs)}
+
+
+
+ Avg session length
+
+
+ {Math.round(summary.avgDurationMs / 60_000)}m
+
+
+
+
+ Replays
+
+ {formatReplays(summary.totalReplays)}
+
);
}
diff --git a/lib/db/queries/stats.ts b/lib/db/queries/stats.ts
index ef36fa9..87ad246 100644
--- a/lib/db/queries/stats.ts
+++ b/lib/db/queries/stats.ts
@@ -15,18 +15,7 @@ export async function getSessionsSummary() {
.from(sessions)
.where(eq(sessions.status, "completed"));
- const durationPerDevice = await db
- .select({
- deviceId: devices.id,
- displayName: devices.displayName,
- bleName: devices.bleName,
- totalActiveMs: sql
`coalesce(sum(coalesce(${sessionDevices.disconnectedAt}, ${sessionDevices.connectedAt}) - ${sessionDevices.connectedAt}), 0)`,
- })
- .from(sessionDevices)
- .innerJoin(devices, eq(sessionDevices.deviceId, devices.id))
- .groupBy(devices.id);
-
- return { ...totals, durationPerDevice };
+ return totals;
}
export async function getSessionTimeline(sessionId: number, bucketMs = 1000) {