import { ApiImage } from "@/components/shared/ApiImage"; import { Calendar, MapPin } from "lucide-react"; import { ContactButton } from "@/components/events/ContactButton"; type Event = { id: string; title: string; description?: string; startDate: string; endDate: string; registrationDeadline?: string | null; goLiveAt?: string; price: number; picture?: string; isSoldOut?: boolean; waitlistEnabled?: boolean; requiresRegistration?: boolean; contactName?: string | null; contactPhone?: string | null; contactEmail?: string | null; location?: string | null; // Set by GET /api/events while an early-bird tier is still running. earlyBirdEndsAt?: string | null; scheduleType?: "single" | "sessions"; sessions?: EventSession[]; registrationClosesAt?: string; }; import { formatDateTimeRange } from "@/lib/date"; import { registrationClosesAt, scheduleSummary } from "@/lib/sessions"; import type { EventSession } from "@/types"; export const EventCard = ({ event }: { event: Event }) => { const dateRange = scheduleSummary(event) || formatDateTimeRange(event.startDate, event.endDate); const now = new Date(); const goLive = event.goLiveAt ? new Date(event.goLiveAt) : null; // Multi-day events close when the first session starts (or later with late joining). const closesAt = registrationClosesAt(event); const registrationOpen = event.requiresRegistration !== false && !(goLive && now < goLive) && now < closesAt; const showEarlyBird = !!event.earlyBirdEndsAt && registrationOpen && !event.isSoldOut; return (
{event.description}