import Link from 'next/link' import Image from 'next/image' import { ShieldCheck, Trophy, TreePine, Users, MapPin, Globe, Bike, ArrowRight } from 'lucide-react' import { Navigation } from '@/components/navigation' import { Footer } from '@/components/footer' import { HeroCarousel } from '@/components/hero-carousel' import { getPublicEvent, getPublicPrizes } from '@/lib/lukenya-api' import { countWord, displayPrice, editionLabel, findPrize, formatClock, formatEventDate, formatMoney, registrationIsOpen, registrationStatusText, venueLine, } from '@/lib/event-types' export const revalidate = 60 const galleryImages = [ 'https://marathon.lukenyauniversity.ac.ke/wp-content/uploads/2026/04/Artboard-1-copy-4-100_result.jpg', 'https://marathon.lukenyauniversity.ac.ke/wp-content/uploads/2026/04/Artboard-1-copy-5-100_result.jpg', 'https://marathon.lukenyauniversity.ac.ke/wp-content/uploads/2026/04/Artboard-1-copy-6-100_result.jpg', 'https://marathon.lukenyauniversity.ac.ke/wp-content/uploads/2026/04/Artboard-1-copy-7-100_result.jpg', 'https://marathon.lukenyauniversity.ac.ke/wp-content/uploads/2026/04/Artboard-1-copy-8-100_result.jpg', ] const sponsors = [ { name: 'Betika', url: 'https://marathon.lukenyauniversity.ac.ke/wp-content/uploads/2025/04/Betika.jpg' }, { name: 'Greenlife', url: 'https://marathon.lukenyauniversity.ac.ke/wp-content/uploads/2025/04/Greenlife.jpg' }, { name: 'Family Bank', url: 'https://marathon.lukenyauniversity.ac.ke/wp-content/uploads/2025/04/Family-bank.jpg' }, { name: 'Lukenya Schools', url: 'https://marathon.lukenyauniversity.ac.ke/wp-content/uploads/2025/04/Lukenya-schools-1.jpg' }, ] const testimonials = [ { quote: "The Lukenya Hills will humble you. The finish line will change you. I have run 11 marathons. This one meant something different.", name: "David M.", category: "42KM Full Marathon", edition: "4th Edition" }, { quote: "I came for the race. I stayed because of the trees. Knowing my entry funded real reforestation made this the most purposeful race I have ever entered.", name: "Amina K.", category: "21KM Half Marathon", edition: "3rd Edition" } ] export default async function HomePage() { const [event, prizes] = await Promise.all([getPublicEvent(), getPublicPrizes()]) const edition = event.edition const categories = event.categories const isOpen = registrationIsOpen(event) const label = editionLabel(edition) const date = formatEventDate(edition?.event_date) const venue = venueLine(edition) const featured = categories.find((c) => c.is_featured) || categories[0] const featuredStart = featured ? formatClock(featured.start_time) : null const heroStats = [ { value: '300+', label: 'Runners' }, { value: label || 'Next', label: isOpen ? 'Edition: entries open' : 'Edition' }, { value: categories.length ? String(categories.length) : '–', label: 'Categories' }, { value: '10M', label: 'Trees Mission' }, ] const trustSignals = [ { icon: ShieldCheck, label: 'Sporthive Certified Timing' }, { icon: Trophy, label: 'Competitive Prize Money' }, { icon: TreePine, label: '10M Trees Mission' }, { icon: Users, label: '300+ Annual Finishers' }, { icon: MapPin, label: venue || 'Venue to be announced' }, { icon: Globe, label: 'Open to International Runners' }, ] const featuredPrizeCategory = featured?.prize_eligible ? featured.name : undefined const prizeCards = [ { icon: Trophy, title: `Men, ${featured?.distance_label || 'Marathon'}, 1st place`, amount: findPrize(prizes, 'Men', 1, featuredPrizeCategory) }, { icon: Trophy, title: `Women, ${featured?.distance_label || 'Marathon'}, 1st place`, amount: findPrize(prizes, 'Women', 1, featuredPrizeCategory) }, { icon: Users, title: 'Top corporate relay team', amount: findPrize(prizes, 'Corporate Relay', 1) }, ] return (
{/* SECTION 1 — HERO (FIX 1: Left-aligned layout) */}
{/* Hero Content - LEFT ALIGNED */}
{/* Eyebrow Badge */} {['Kenya', edition?.county, label].filter(Boolean).join(' · ')} {/* H1 */}

Run, Ride
& Restore.

{/* Subheading */}

Africa's only university-backed marathon with a verified reforestation mission.
{[categories.length ? `${categories.length} categories` : null, venue, date].filter(Boolean).join(' · ')}

{/* CTA Buttons */}
Register Now Race Information
{/* FIX 2: Registration Status Badge (replaces countdown) */}
{registrationStatusText(event)}
{/* Stat Strip (FIX 3: Edition contradiction fixed) */}
{heroStats.map((stat, index) => (

{stat.value}

{stat.label}

))}
{/* SECTION 2 — TRUST BAR (FIX 6: Icons restored, location canonicalized) */}
{trustSignals.map((signal, index) => (
{signal.label}
))}
{/* FIX 8: NEW RACE DATE ANCHOR SECTION */}
{/* Column 1 — WHEN */}
Race Day

{date ? date.toUpperCase() : 'DATE TO BE ANNOUNCED'}

{label ? `${label} · ` : ''}Annual event

{/* Column 2 — WHERE */}
Location

{(edition?.venue || 'To be announced').toUpperCase()}

{[edition?.county ? `${edition.county}, Kenya` : 'Kenya', featured && featuredStart ? `${featured.distance_label} start: ${featuredStart}` : null].filter(Boolean).join(' · ')}

{/* Column 3 — START TIMES (from the race categories) */}
Start Times

{featuredStart || 'TBA'}

{categories.filter((c) => c.start_time).slice(0, 4).map((c) => `${c.distance_label} ${formatClock(c.start_time)}`).join(' · ') || 'Start times are published with the race categories.'}

{/* SECTION 3 — ENVIRONMENTAL MISSION (FIX 7: Clarified 10,000 vs 10M) */}
{/* Left Column */}
{/* Eyebrow */} Our Mission {/* Gold Rule */}
{/* H2 */}

More Than a Finish Line.

{/* Body (FIX 7: Updated copy) */}

The 10 Million Trees Marathon exists because of a promise made to Kenya's dryland ecosystems. Every runner, every kilometre, every edition is a contribution to one of East Africa's most ambitious conservation programmes. By 2027, the programme will have planted 10 million trees across the ASAL region — a goal now in its 5th year of active delivery.

{/* Stat Pills */}
10M Trees by 2027
4 Editions Completed
ASAL Region Impact
{/* CTA */} Our Conservation Story
{/* Right Column (FIX 7: Updated labels) */}

10,000+

Trees planted and GPS-tagged to date

Goal: 10 Million by 2027 · 4 editions completed · On track

GPS-tagged planting zones in Lukenya Conservation Area. Documented, verified, reportable.

Verified Programme
{/* SECTION 4 — RACE CATEGORIES (FIX 4: Removed TBD pricing, added fallback) */}
{/* Header */}
Race Categories

Find Your Distance.

{categories.length ? `${countWord(categories.length)} ${categories.length === 1 ? 'category' : 'categories'}. ` : ''}Every level of runner and rider. One extraordinary finish line.

{/* Category Grid */}
{categories.length === 0 && (

Race categories for the next edition will be published here soon.

)} {categories.map((category) => { const price = formatMoney(displayPrice(category, 'resident'), event.currency) const isCycling = category.discipline === 'Cycling' return (
{/* Prize Badge */} {category.prize_eligible && ( Prize Money )} {/* Cycling Icon */} {isCycling && !category.prize_eligible && ( )} {/* Distance */}

{category.distance_label}

{/* Name */}

{category.category_name}

{/* Description */}

{category.short_description || category.eligibility || category.inclusions.join(' · ')}

{/* Featured race: inline stat */} {category.is_featured && category.prize_eligible && (

🏆 Prize money available · Certified course · Chip timing

)} {/* Price */}
{category.sold_out ? ( Sold out ) : price ? ( <>

{price}

{category.prices.early_bird_active ? 'Early-bird rate for Kenyan residents' : 'Kenyan resident rate'}

) : ( Pricing announced soon )}
{/* CTA */} {isOpen && !category.sold_out ? 'Enter this race' : 'Join waitlist'}
) })}
{/* CTAs */}
View All Race Info Register Now
{/* SECTION 5 — PRIZE MONEY TEASER (FIX 5: Replaced TBD with competitive framing) */}
{/* Header */}
Prize Money

Compete for Real Rewards.

{/* Prize Cards: amounts come from the edition's prize rules */}
{prizeCards.map((card) => (

{card.title}

{formatMoney(card.amount, prizes?.currency || event.currency) || 'PRIZE MONEY AVAILABLE'}

{!card.amount && (

Amounts published before entries open

)}
))}
{/* Prize structure note (FIX 5) */}

Prize structure includes Men, Women, Wheelchair, and Corporate Relay categories. Full breakdown published on the Prize Money page.

{/* CTA */}
View Full Prize Structure
{/* SECTION 6 — PAST EDITIONS / SOCIAL PROOF (FIX 3: Updated headline) */}
{/* Header */}
Past Editions

300+ Runners. Across 4 Editions. One Growing Legacy.

{/* Photo Strip */}
{galleryImages.map((src, index) => (
{`Marathon
))}
{/* Testimonials (ADDITIONAL FIX 2) */}
{testimonials.map((testimonial, index) => (
“

{testimonial.quote}

— {testimonial.name}

{testimonial.category} · {testimonial.edition}

))}
{/* Stat */}

300+

runners have crossed this finish line

{/* CTA */}
View Results Archive
{/* SECTION 7 — SPONSORS */}
{/* Header */} Our Sponsors

Brands That Run With Purpose.

{/* Sponsor Logos */}
{sponsors.map((sponsor, index) => (
{sponsor.name}
))}

Including our Environmental Partner tier — the only ESG-verified sponsorship in Kenyan running.

{/* CTA */} Become a Partner
{/* SECTION 8 — REGISTRATION CTA BAND */}

{edition?.trees_commitment_per_entry ? 'Your Entry Plants a Tree.' : 'Run With Purpose.'}

{isOpen ? `Register for the ${label || 'next edition'}. Run for Kenya. Entries open now.` : `Entries for the ${label || 'next edition'} open soon. Join the waitlist to hear first.`}

Register Now

{featured?.prices.early_bird_active ? 'Early-bird pricing available. Secure your place before rates increase.' : 'Pay by M-PESA or card.'}

) }