teecup/frontend/app/tournaments/[id]/print/startlist/page.tsx
Erol Haagenrud 546900c2d6
Some checks failed
Backend-tester / test (push) Successful in 1m8s
Frontend-tester / test (push) Failing after 20s
Før endringer i turneringsoppsettet
2026-08-21 13:54:01 +02:00

36 lines
1.2 KiB
TypeScript

import { PrintStartlist } from "@/components/print-startlist"
export default async function PrintStartlistPage({
params,
searchParams,
}: {
params: Promise<{ id: string }>
searchParams: Promise<{ org?: string; roundId?: string; sessionId?: string; paper?: string; orientation?: string }>
}) {
const { id } = await params
const { org, roundId, sessionId, paper, orientation } = await searchParams
if (!org) {
return (
<main className="flex min-h-[100dvh] flex-col items-center justify-center gap-2 bg-background px-5 text-center">
<p className="text-sm font-medium text-destructive">
Mangler organisasjon i lenken. tilbake til dashbordet og prøv igjen.
</p>
</main>
)
}
const validSizes = ["A4", "Letter", "A3", "A2"] as const
const initialSize = (validSizes as readonly string[]).includes(paper ?? "") ? (paper as (typeof validSizes)[number]) : "A4"
return (
<PrintStartlist
organizationId={org}
tournamentId={id}
roundId={roundId}
sessionId={sessionId}
initialSize={initialSize}
initialOrientation={orientation === "landscape" ? "landscape" : "portrait"}
/>
)
}