teecup/frontend/app/tournaments/[id]/page.tsx

29 lines
1,013 B
TypeScript
Raw Normal View History

import { TournamentDetail } from "@/components/tournament-detail"
export default async function TournamentPage({
params,
searchParams,
}: {
params: Promise<{ id: string }>
searchParams: Promise<{ org?: string; name?: string }>
}) {
const { id } = await params
const { org, name } = await searchParams
const tournamentName = name?.trim() || "Turnering"
// org-parameteren følger alltid med fra dashbordets TournamentCard-lenke
// (se components/tournament-card.tsx) -- API-et krever organization_id på
// alle team-/roster-endepunkter (RLS, se ADR-001/003).
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>
)
}
return <TournamentDetail organizationId={org} tournamentId={id} tournamentName={tournamentName} />
}