import { eq } from "drizzle-orm"; import Link from "next/link"; import { notFound } from "next/navigation"; import { getTranslations } from "next-intl/server"; import { ContentCard } from "@/components/public/ui"; import { db, RadioContests } from "@/lib/db"; import { formatDate } from "@/lib/format-date"; export default async function RadioContestDetailPage({ params, }: { params: Promise<{ id: string }>; }) { const { id } = await params; await getTranslations("pages.radioContests"); let contestId: bigint; try { contestId = BigInt(id); } catch { notFound(); } const [contest] = await db .select() .from(RadioContests) .where(eq(RadioContests.id, contestId)) .limit(1) .catch(() => []); if (!contest) notFound(); const active = contest.isActive ? "Active" : "Ended"; return (

← Back to contests

{contest.description ? ( ) : null} {contest.prize ? ( ) : null}
Description {contest.description}
Prize {contest.prize}
Period {contest.startDate ? formatDate(contest.startDate, "datetime-seconds", "") : "—"} {" — "} {contest.endDate ? formatDate(contest.endDate, "datetime-seconds", "") : "ongoing"}
Created {formatDate(contest.createdAt, "datetime-seconds", "") || ( — )}
Updated {formatDate(contest.updatedAt, "datetime-seconds", "") || ( — )}
); }