"use client"; import { useEffect, useState } from "react"; import Link from "next/link"; import { MapPin, Clock, ArrowRight } from "lucide-react"; import { api } from "@/lib/api"; import { Navbar } from "@/components/public/Navbar"; import { Footer } from "@/components/public/Footer"; function formatMeetupDate(dateStr: string) { const d = new Date(dateStr); return { month: d.toLocaleString("en-US", { month: "short" }).toUpperCase(), day: String(d.getDate()), full: d.toLocaleString("en-US", { weekday: "long", month: "long", day: "numeric", year: "numeric", }), }; } function MeetupCard({ meetup, muted = false }: { meetup: any; muted?: boolean }) { const { month, day, full } = formatMeetupDate(meetup.date); return (
{month} {day}

{meetup.title}

{full}

{meetup.description && (

{meetup.description}

)}
{meetup.location && (

{meetup.location}

)} {meetup.time && (

{meetup.time}

)}
View Details ); } function CardSkeleton() { return (
); } export default function EventsPage() { const [meetups, setMeetups] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); useEffect(() => { api .getMeetups() .then((data: any) => { const list = Array.isArray(data) ? data : []; setMeetups(list); }) .catch((err) => setError(err.message)) .finally(() => setLoading(false)); }, []); const now = new Date(); const upcoming = meetups.filter((m) => new Date(m.date) >= now); const past = meetups.filter((m) => new Date(m.date) < now).reverse(); return ( <>

Belgian Bitcoin Embassy

All Events

Past and upcoming Bitcoin meetups in Belgium.

{error && (
Failed to load events: {error}
)}

Upcoming {!loading && upcoming.length > 0 && ( {upcoming.length} )}

{loading ? (
{[0, 1, 2].map((i) => )}
) : upcoming.length === 0 ? (

No upcoming events scheduled. Check back soon.

) : (
{upcoming.map((m) => )}
)}
{(loading || past.length > 0) && (

Past Events

{loading ? (
{[0, 1, 2].map((i) => )}
) : (
{past.map((m) => )}
)}
)}