import Link from 'next/link' import { Clock, MapPin, Users, ChevronDown, Route, Droplets, Award, ShieldCheck } from 'lucide-react' import { Navigation } from '@/components/navigation' import { Footer } from '@/components/footer' import { getPublicEvent } from '@/lib/lukenya-api' import { displayPrice, formatClock, formatCutoff, formatMoney, type PublicCategory, } from '@/lib/event-types' export const revalidate = 60 function startTimesAnswer(categories: PublicCategory[]): string { const timed = categories.filter((c) => c.start_time) if (!timed.length) return 'Start times are published with the race categories closer to race day.' return timed.map((c) => `${c.category_name} (${c.distance_label}): ${formatClock(c.start_time)}`).join('. ') + '.' } function ageAnswer(categories: PublicCategory[]): string { const parts = categories.map((c) => { if (c.min_age) return `${c.category_name}: ${c.min_age}+` if (c.eligibility) return `${c.category_name}: ${c.eligibility}` return null }).filter(Boolean) if (!parts.length) return 'Age limits are listed with each race category. Runners under 18 need a parent or guardian to consent.' return parts.join('. ') + '. Runners under 18 need a parent or guardian to consent.' } const routeHighlights = [ { icon: Route, title: 'Course Type', description: 'Mixed terrain: tarmac and scenic trails' }, { icon: Droplets, title: 'Water Stations', description: 'Every 2.5km with hydration and first aid' }, { icon: Award, title: 'Timing', description: 'Sporthive certified chip timing' }, ] const staticFaqs = [ { question: 'Is parking available?', answer: 'Yes, free parking is available at the venue. Follow the signage to the designated parking areas. Arrive early for the best spots.' }, { question: 'Where do I collect my race pack?', answer: 'Race packs can be collected at the Expo on the day before the race (10 AM - 6 PM) or on race morning from 4:30 AM at the registration tent.' }, { question: 'Is bag drop available?', answer: 'Yes, secure bag drop is available near the start line. Please label your bag with your bib number. Bags can be collected after you finish.' }, { question: 'What is included in my entry fee?', answer: 'Race bib with chip timing, finisher medal, event t-shirt, access to water stations and post-race refreshments. Inclusions for each race are listed on the registration page.' }, { question: 'Can I transfer my entry to someone else?', answer: 'Entry transfers are allowed up to 7 days before the race for a small admin fee. Contact info@lukenyamarathon.co.ke to arrange a transfer.' }, { question: 'What happens if it rains?', answer: 'The race proceeds rain or shine. Kenya\'s climate is generally favorable, but come prepared with appropriate gear.' }, ] export default async function RaceInfoPage() { const event = await getPublicEvent() const categories = event.categories const edition = event.edition const featured = categories.find((c) => c.is_featured) || categories[0] const featuredStart = featured ? formatClock(featured.start_time) : null const routeItems = [ { icon: MapPin, title: 'Start/Finish', description: edition?.venue || 'Venue to be announced' }, ...routeHighlights, ] const faqs = [ { question: 'What time does the race start?', answer: startTimesAnswer(categories) }, staticFaqs[0], staticFaqs[1], staticFaqs[2], { question: 'Are there age requirements?', answer: ageAnswer(categories) }, ...staticFaqs.slice(3), ] return (
{/* Page Hero */}
Everything You Need to Know

Race Information

Categories, route details, timing, and everything you need for race day{edition?.venue ? ` at ${edition.venue}` : ''}.

{/* Quick Info Bar */}

{featuredStart ? `${featuredStart} Start` : 'Start time TBA'}

{featured?.category_name || 'First race'}

{edition?.venue || 'Venue TBA'}

{edition?.county || 'Kenya'}

{categories.length || 'All'} Categories

All abilities

Sporthive Timing

Certified results

{/* Race Categories */}
Race Categories

Choose Your Challenge

{categories.length === 0 && ( )} {categories.map((category) => ( ))}
Category Distance Cut-off Time Elevation Entry Fee (Kenyan resident)
Race categories for the next edition will be published here soon.
{category.category_name} {category.sold_out && Sold out} {category.distance_km ? `${category.distance_km}km` : category.distance_label} {formatCutoff(category.cutoff_hours) || '—'} {category.elevation_gain_m ? `+${category.elevation_gain_m}m` : '—'} {formatMoney(displayPrice(category, 'resident'), event.currency) || 'Announced soon'}
REGISTER NOW
{/* Route Information */}
The Course

Route Information

{/* Route Map Placeholder */}

Course Map Coming Soon

{/* Route Highlights */}
{routeItems.map((item, index) => (

{item.title}

{item.description}

))}
{/* FAQ Section */}
Common Questions

Frequently Asked Questions

{faqs.map((faq, index) => (
{faq.question}
{faq.answer}
))}
{/* CTA Section */}

Ready to Run?

Secure your place in Kenya's only environmental marathon.

REGISTER NOW
) }