import Link from 'next/link' import { Trophy, ShieldCheck, Accessibility, Users, Award } from 'lucide-react' import { Navigation } from '@/components/navigation' import { Footer } from '@/components/footer' import { getPublicEvent, getPublicPrizes } from '@/lib/lukenya-api' import { findPrize, formatMoney, ordinal, type PrizeCategory, type PrizeRow } from '@/lib/event-types' export const revalidate = 60 type PrizeLine = { place: string; amount: string; highlight?: boolean } const PLACE = (n: number) => ordinal(n) || String(n) // Men and women side by side, one row per finishing position. function rowsFor(category: PrizeCategory, currency: string): { men: PrizeLine[]; women: PrizeLine[] } { const men = category.divisions.find((d) => d.division === 'Men')?.places || [] const women = category.divisions.find((d) => d.division === 'Women')?.places || [] const positions = Array.from(new Set([...men, ...women].map((p) => p.position))).sort((x, y) => x - y) const fmt = (rows: PrizeRow[], pos: number) => { const row = rows.find((r) => r.position === pos) return row ? (formatMoney(row.amount, currency)?.replace(`${currency} `, '') || '—') : '—' } return { men: positions.map((pos) => ({ place: PLACE(pos), amount: fmt(men, pos), highlight: pos === 1 })), women: positions.map((pos) => ({ place: PLACE(pos), amount: fmt(women, pos), highlight: pos === 1 })), } } const SPECIAL = [ { division: 'Wheelchair', icon: Accessibility, title: 'Wheelchair Category', description: 'Top finishers in the wheelchair division' }, { division: 'Corporate Relay', icon: Users, title: 'Corporate Relay', description: 'Fastest corporate relay teams' }, { division: 'Age Group', icon: Award, title: 'Age Category Awards', description: 'Top finishers in each age group' }, ] function PrizeTable({ title, men, women }: { title: string men: { place: string; amount: string; highlight?: boolean }[] women: { place: string; amount: string; highlight?: boolean }[] }) { return (
| Place | Men | Women |
|---|---|---|
| {prize.place} | {prize.amount} | {women[index]?.amount} |
| Place | Men | Women |
|---|---|---|
| {prize.place} | {prize.amount} | {women[index]?.amount} |
{raceTables.length ? `Structured prize money across ${raceTables.length} ${raceTables.length === 1 ? 'race' : 'races'}, paid on race day.` : 'Structured prize money, paid on race day.'}
Prize amounts for each race are published here before entries open.
)}{formatMoney(category.amount, currency) || 'To be announced'}
{category.description}
Prize money paid on race day. Winners must present valid ID. All prizes subject to race rules.
Register now and compete for prize money at Kenya's environmental marathon.
REGISTER NOW