page.tsx
3,543 bytes
| 1 | import { ArrowRight, PlayCircle, UsersRound } from 'lucide-react'; |
|---|---|
| 2 | import Link from 'next/link'; |
| 3 | import { Badge } from '@/components/ui/badge'; |
| 4 | import { Button } from '@/components/ui/button'; |
| 5 | import { displayNameForModel } from '@/core/types'; |
| 6 | import { listDemoDebates } from '@/db/repositories'; |
| 7 | import { formatUsd } from '@/lib/utils'; |
| 8 | |
| 9 | export const dynamic = 'force-dynamic'; |
| 10 | |
| 11 | export default async function DemoPage() { |
| 12 | let demos: Awaited<ReturnType<typeof listDemoDebates>> = []; |
| 13 | try { |
| 14 | demos = await listDemoDebates(); |
| 15 | } catch { |
| 16 | demos = []; |
| 17 | } |
| 18 | |
| 19 | return ( |
| 20 | <div className="container max-w-5xl py-12 sm:py-16"> |
| 21 | <div className="mx-auto max-w-2xl pb-12 text-center"> |
| 22 | <Badge variant="secondary" className="mb-4 gap-1.5 rounded-full"> |
| 23 | <PlayCircle className="h-3.5 w-3.5 text-primary" /> |
| 24 | Example results |
| 25 | </Badge> |
| 26 | <h1 className="font-display text-4xl font-semibold tracking-[-0.04em] sm:text-5xl"> |
| 27 | See how a better answer takes shape. |
| 28 | </h1> |
| 29 | <p className="mx-auto mt-4 max-w-xl leading-relaxed text-muted-foreground"> |
| 30 | Replay real roundtables from the first independent opinions through the final verdict. No |
| 31 | account or model connection is needed. |
| 32 | </p> |
| 33 | </div> |
| 34 | |
| 35 | {demos.length === 0 ? ( |
| 36 | <div className="rounded-2xl border border-dashed p-10 text-center text-sm text-muted-foreground"> |
| 37 | No examples are available on this deployment yet. |
| 38 | </div> |
| 39 | ) : ( |
| 40 | <ul className="grid gap-4 md:grid-cols-2"> |
| 41 | {demos.map((demo) => ( |
| 42 | <li key={demo.id}> |
| 43 | <Link |
| 44 | href={`/demo/${demo.id}`} |
| 45 | className="group flex h-full flex-col rounded-2xl border bg-card p-5 transition-all hover:-translate-y-0.5 hover:border-primary/35 hover:shadow-lg hover:shadow-primary/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring sm:p-6" |
| 46 | > |
| 47 | <div className="flex items-center justify-between"> |
| 48 | <span className="flex items-center gap-1.5 text-xs font-medium text-muted-foreground"> |
| 49 | <UsersRound className="h-3.5 w-3.5" /> |
| 50 | {demo.models.length} opinions |
| 51 | </span> |
| 52 | <span className="flex h-9 w-9 items-center justify-center rounded-full border text-muted-foreground transition-colors group-hover:border-primary group-hover:bg-primary group-hover:text-primary-foreground"> |
| 53 | <ArrowRight className="h-4 w-4 transition-transform group-hover:translate-x-0.5" /> |
| 54 | </span> |
| 55 | </div> |
| 56 | <h2 className="mt-8 font-display text-xl font-semibold leading-snug tracking-[-0.025em] sm:text-2xl"> |
| 57 | {demo.question} |
| 58 | </h2> |
| 59 | <div className="mt-auto pt-8 text-xs text-muted-foreground"> |
| 60 | <p className="truncate">{demo.models.map(displayNameForModel).join(' · ')}</p> |
| 61 | <p className="mt-1"> |
| 62 | {demo.roundsCompleted} review rounds · {formatUsd(demo.totalCostUsd)} |
| 63 | </p> |
| 64 | </div> |
| 65 | </Link> |
| 66 | </li> |
| 67 | ))} |
| 68 | </ul> |
| 69 | )} |
| 70 | |
| 71 | <div className="mt-10 flex justify-center"> |
| 72 | <Button size="lg" asChild className="rounded-xl"> |
| 73 | <Link href="/debate"> |
| 74 | Ask your own question |
| 75 | <ArrowRight className="h-4 w-4" /> |
| 76 | </Link> |
| 77 | </Button> |
| 78 | </div> |
| 79 | </div> |
| 80 | ); |
| 81 | } |
| 82 | |