import { LegalText } from '@/components/LegalText' import type { Metadata } from 'next' import Link from 'next/link' import { notFound } from 'next/navigation' import { Footer } from '@/components/Footer' import { Header } from '@/components/Header' import { getDict, isLocale, locales } from '@/i18n' import { loadContent, loadLegal } from '@/lib/content' import { buildLegalModel, isLegalPublished, type LegalKind } from '@/lib/legal-model' type Props = { params: Promise<{ locale: string }> } export const legalMetadata = (kind: LegalKind) => async function generateMetadata({ params }: Props): Promise { const { locale } = await params if (!isLocale(locale)) return {} const t = getDict(locale) const title = `${t.legal[kind].title} — ${t.siteName}` return { title, description: t.legal[kind].description, alternates: { languages: Object.fromEntries(locales.map((l) => [l, `/${l}/${kind}`])) }, openGraph: { title, description: t.legal[kind].description, type: 'website', locale }, } } export async function LegalPage({ params, kind }: Props & { kind: LegalKind }) { const { locale } = await params if (!isLocale(locale)) notFound() const t = getDict(locale) const legal = await loadLegal(locale) if (!isLegalPublished(legal?.[kind])) notFound() const { news } = await loadContent(locale) const m = buildLegalModel(legal, kind, t) const fmt = new Intl.DateTimeFormat(locale, { day: 'numeric', month: 'long', year: 'numeric' }) return ( <>
0} path={`/${kind}`} />
← {t.legal.back}

{m.title}

{m.updated && (

{t.legal.updated}

)}