import type { Metadata } from 'next' import { Navigation } from '@/components/navigation' import { Footer } from '@/components/footer' import { RichText } from '@/components/rich-text' import { METHODS, frappeCall } from '@/lib/lukenya-api' import { formatEventDate } from '@/lib/event-types' export const revalidate = 60 export const metadata: Metadata = { title: 'Terms and Privacy | 10 Million Trees Marathon', description: 'Participation terms, indemnity, privacy notice and consent documents for the Lukenya University Marathon.', } interface LegalDoc { name: string document_type: string slug: string version: string title: string summary: string | null body: string effective_from: string | null required: boolean applies_to: string } async function documents(): Promise { try { return (await frappeCall(METHODS.legalDocuments, { revalidate: 60 })) || [] } catch { return [] } } export default async function LegalPage() { const docs = await documents() return (

Terms, Privacy and Consent

The documents every runner agrees to when they enter. Each shows its version and when it took effect.

{docs.length === 0 ? (

The documents couldn't be loaded just now. Please try again shortly.

) : ( <> {docs.map((d) => (

{d.title}

Version {d.version} {d.effective_from ? ` · effective ${formatEventDate(d.effective_from.slice(0, 10))}` : ''} {d.required ? '' : ' · optional'} {d.applies_to === 'Under 18 only' ? ' · for runners under 18' : ''}

))} )}
) }