profileShare

rasmusjy / roundtable

Read-only snapshot

No repository description.

main default branch 181 files Expires Sep 13, 2026, 9:06 AM
page.tsx 1,117 bytes
1 import { ArrowLeft } from 'lucide-react';
2 import Link from 'next/link';
3 import { notFound } from 'next/navigation';
4 import { currentUserId } from '@/auth';
5 import { DebateReplay } from '@/components/debate/debate-replay';
6 import { getDebateOwnership, loadDebateResult } from '@/db/repositories';
7
8 export const dynamic = 'force-dynamic';
9
10 export default async function DebateReplayPage({ params }: { params: Promise<{ id: string }> }) {
11 const { id } = await params;
12 const ownership = await getDebateOwnership(id);
13 if (!ownership) notFound();
14
15 const userId = await currentUserId();
16 const canRead = ownership.isDemo || ownership.userId === null || ownership.userId === userId;
17 if (!canRead) notFound();
18
19 const result = await loadDebateResult(id);
20 if (!result) notFound();
21
22 return (
23 <div className="container py-8">
24 <Link
25 href="/history"
26 className="mb-4 inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground"
27 >
28 <ArrowLeft className="h-4 w-4" /> Back to history
29 </Link>
30 <DebateReplay result={result} />
31 </div>
32 );
33 }
34