Remove recordings feature, replay sessions directly, bump to 0.6.0
Recordings were just a thin named pointer over an already-captured session's events, so the whole separate feature (recordings table, API routes, pages, UI) is gone: any completed session can now be named and replayed directly. Replaying no longer creates a session or duplicates events of its own - it just bumps the source session's playCount/lastPlayedAt. Also renames play_sessions/playSession(s) to sessions/session(s) throughout the schema, queries, API routes, and UI for consistency, and updates the README to match the new flow. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+24
-52
@@ -2,8 +2,7 @@ import Link from "next/link";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { BrandMark } from "@/components/layout/BrandMark";
|
||||
import { listRecordings } from "@/lib/db/queries/recordings";
|
||||
import { listPlaySessions } from "@/lib/db/queries/play-sessions";
|
||||
import { listSessions } from "@/lib/db/queries/sessions";
|
||||
import { getSessionsSummary } from "@/lib/db/queries/stats";
|
||||
|
||||
// Always reflects live DB state for an authenticated, single-tenant app -
|
||||
@@ -11,13 +10,8 @@ import { getSessionsSummary } from "@/lib/db/queries/stats";
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export default async function DashboardPage() {
|
||||
const [recordings, sessions, summary] = await Promise.all([
|
||||
listRecordings(),
|
||||
listPlaySessions(),
|
||||
getSessionsSummary(),
|
||||
]);
|
||||
const [sessions, summary] = await Promise.all([listSessions(), getSessionsSummary()]);
|
||||
|
||||
const recentRecordings = recordings.slice(0, 5);
|
||||
const recentSessions = [...sessions].reverse().slice(0, 5);
|
||||
|
||||
return (
|
||||
@@ -27,7 +21,7 @@ export default async function DashboardPage() {
|
||||
<BrandMark size={48} animated className="rounded-[9px]" />
|
||||
<h1 className="font-heading text-3xl font-semibold">Welcome back</h1>
|
||||
<p className="max-w-xl text-sm text-muted-foreground">
|
||||
Scan for nearby devices, take control, and record sessions to replay later - all running
|
||||
Scan for nearby devices, take control, and replay completed sessions later - all running
|
||||
directly from your browser over Web Bluetooth.
|
||||
</p>
|
||||
<Button asChild size="lg">
|
||||
@@ -53,53 +47,31 @@ export default async function DashboardPage() {
|
||||
</Card>
|
||||
<Card className="bp-glass">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-sm text-muted-foreground">Saved recordings</CardTitle>
|
||||
<CardTitle className="text-sm text-muted-foreground">Replays</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="bp-readout text-3xl">{recordings.length}</CardContent>
|
||||
<CardContent className="bp-readout text-3xl">{summary.totalReplays}</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-6 lg:grid-cols-2">
|
||||
<Card className="bp-glass">
|
||||
<CardHeader>
|
||||
<CardTitle>Recent recordings</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="flex flex-col">
|
||||
{recentRecordings.length === 0 && (
|
||||
<p className="text-sm text-muted-foreground">Nothing saved yet.</p>
|
||||
)}
|
||||
{recentRecordings.map((r, i) => (
|
||||
<Link key={r.id} href={`/recordings/${r.id}`} className="group">
|
||||
{i > 0 && <div className="bp-hairline" />}
|
||||
<div className="flex items-center justify-between px-1 py-2 text-sm">
|
||||
<span className="group-hover:text-primary">{r.name}</span>
|
||||
<span className="bp-readout text-xs text-muted-foreground">{r.playCount} plays</span>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card className="bp-glass">
|
||||
<CardHeader>
|
||||
<CardTitle>Recent sessions</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="flex flex-col">
|
||||
{recentSessions.length === 0 && <p className="text-sm text-muted-foreground">No sessions yet.</p>}
|
||||
{recentSessions.map((s, i) => (
|
||||
<Link key={s.id} href={`/sessions/${s.id}`} className="group">
|
||||
{i > 0 && <div className="bp-hairline" />}
|
||||
<div className="flex items-center justify-between px-1 py-2 text-sm">
|
||||
<span className="group-hover:text-primary">{s.name ?? `Session #${s.id}`}</span>
|
||||
<span className="bp-readout text-xs text-muted-foreground">
|
||||
{new Date(s.startedAt).toLocaleDateString()}
|
||||
</span>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
<Card className="bp-glass">
|
||||
<CardHeader>
|
||||
<CardTitle>Recent sessions</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="flex flex-col">
|
||||
{recentSessions.length === 0 && <p className="text-sm text-muted-foreground">No sessions yet.</p>}
|
||||
{recentSessions.map((s, i) => (
|
||||
<Link key={s.id} href={`/sessions/${s.id}`} className="group">
|
||||
{i > 0 && <div className="bp-hairline" />}
|
||||
<div className="flex items-center justify-between px-1 py-2 text-sm">
|
||||
<span className="group-hover:text-primary">{s.name ?? `Session #${s.id}`}</span>
|
||||
<span className="bp-readout text-xs text-muted-foreground">
|
||||
{new Date(s.startedAt).toLocaleDateString()}
|
||||
</span>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user