import { EventCard } from "@/components/events/EventCard"; import { Navbar } from "@/components/layout/Navbar"; import { Footer } from "@/components/layout/Footer"; import { JoinUsButton } from "@/components/home/JoinUsButton"; import { appName } from "@/lib/siteConfig"; import { API_BASE } from "@/lib/api"; import { Calendar, ArrowRight, CalendarCheck, Users, Heart, ShieldCheck } from "lucide-react"; type Event = { id: string; title: string; description?: string; startDate: string; endDate: string; registrationDeadline?: string | null; goLiveAt?: string; price: number; picture?: string; }; import { apiFetch } from "@/lib/api"; const FEATURES = [ { icon: CalendarCheck, title: "Meaningful Events", description: "Events designed to inspire, encourage and strengthen your faith." }, { icon: Calendar, title: "Easy Registration", description: "Simple and secure registration so you can focus on what matters." }, { icon: Users, title: "Community", description: "Connect with others and grow in a supportive and loving community." }, { icon: Heart, title: "Make an Impact", description: "Be part of what God is doing and make a difference together." }, ]; async function getOrgName(): Promise { try { const res = await fetch(`${API_BASE}/api/settings`, { next: { revalidate: 60 } }); if (!res.ok) return appName; const settings = await res.json(); return settings?.org_name || appName; } catch { return appName; } } export default async function HomePage() { const [events, displayName] = await Promise.all([ apiFetch("/api/events", { nextOptions: { next: { revalidate: 60 } } }), getOrgName(), ]); const now = Date.now(); const upcoming = (events || []).filter(e => { const t = new Date(e.startDate).getTime(); return !isNaN(t) && t > now; }); const sorted = [...upcoming].sort((a, b) => new Date(a.startDate).getTime() - new Date(b.startDate).getTime()); return (

Upcoming Events

View all events
{sorted.length === 0 ? (

No upcoming events right now — check back soon.

) : (
{sorted.slice(0, 3).map(event => ( ))}
)}
{FEATURES.map(f => { const Icon = f.icon; return (

{f.title}

{f.description}

); })}

Secure & reliable

Your details and payments are handled securely from registration through to the day of the event.

); }