page.tsx
922 bytes
| 1 | import { ArrowLeft } from 'lucide-react'; |
|---|---|
| 2 | import Link from 'next/link'; |
| 3 | import { notFound } from 'next/navigation'; |
| 4 | import { DebatePlayer } from '@/components/debate/debate-player'; |
| 5 | import { getDebateOwnership, loadDebateResult } from '@/db/repositories'; |
| 6 | |
| 7 | export const dynamic = 'force-dynamic'; |
| 8 | |
| 9 | export default async function DemoReplayPage({ params }: { params: Promise<{ id: string }> }) { |
| 10 | const { id } = await params; |
| 11 | const ownership = await getDebateOwnership(id); |
| 12 | if (!ownership || !ownership.isDemo) notFound(); |
| 13 | |
| 14 | const result = await loadDebateResult(id); |
| 15 | if (!result) notFound(); |
| 16 | |
| 17 | return ( |
| 18 | <div className="container py-8"> |
| 19 | <Link |
| 20 | href="/demo" |
| 21 | className="mb-4 inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground" |
| 22 | > |
| 23 | <ArrowLeft className="h-4 w-4" /> All demos |
| 24 | </Link> |
| 25 | <DebatePlayer result={result} /> |
| 26 | </div> |
| 27 | ); |
| 28 | } |
| 29 | |