2026-06-15 20:18:36 +02:00
|
|
|
import type { Metadata } from 'next'
|
|
|
|
|
import { db } from '@/lib/db'
|
|
|
|
|
import { tournaments } from '@/lib/db/schema'
|
|
|
|
|
import { eq } from 'drizzle-orm'
|
|
|
|
|
import { TournamentClient } from './client'
|
2026-06-14 15:36:44 +02:00
|
|
|
|
2026-06-15 20:18:36 +02:00
|
|
|
type Props = { params: Promise<{ year: string }> }
|
2026-06-14 15:36:44 +02:00
|
|
|
|
2026-06-15 20:18:36 +02:00
|
|
|
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
|
|
|
|
const { year: yearStr } = await params
|
2026-06-14 15:36:44 +02:00
|
|
|
const year = parseInt(yearStr)
|
2026-06-15 20:18:36 +02:00
|
|
|
const [t] = await db.select().from(tournaments).where(eq(tournaments.year, year)).limit(1)
|
|
|
|
|
const title = `${year} FIFA World Cup`
|
|
|
|
|
const description = t
|
|
|
|
|
? `${year} FIFA World Cup hosted by ${t.host}.${t.winner ? ` Winner: ${t.winner}.` : ''} Matches, scores, group standings and statistics.`
|
|
|
|
|
: `${year} FIFA World Cup — matches, scores and statistics.`
|
|
|
|
|
return {
|
|
|
|
|
title,
|
|
|
|
|
description,
|
|
|
|
|
openGraph: { title, description, url: `/tournaments/${year}` },
|
2026-06-14 15:36:44 +02:00
|
|
|
}
|
2026-06-15 20:18:36 +02:00
|
|
|
}
|
2026-06-14 15:36:44 +02:00
|
|
|
|
2026-06-15 20:18:36 +02:00
|
|
|
export default function TournamentPage({ params }: Props) {
|
|
|
|
|
return <TournamentClient params={params} />
|
2026-06-14 15:36:44 +02:00
|
|
|
}
|