import { CalendarDays, MapPin } from "lucide-react"; import type { EventSession } from "@/types"; import { activeSessions, formatSessionWhen, sessionLabel } from "@/lib/sessions"; // The schedule of a multi-day event on its public page: past sessions greyed out, // cancelled ones struck through, and the next one highlighted. export function SessionSchedule({ sessions, defaultLocation }: { sessions: EventSession[]; defaultLocation?: string | null }) { const now = Date.now(); const sorted = [...sessions].sort((a, b) => new Date(a.startsAt).getTime() - new Date(b.startsAt).getTime()); const next = activeSessions(sessions).find(s => new Date(s.endsAt).getTime() > now); const count = activeSessions(sessions).length; return (

Schedule

ยท {count} session{count === 1 ? "" : "s"}, one ticket for all
    {sorted.map((s) => { const cancelled = !!(s.cancelled || s.cancelledAt); const past = !cancelled && new Date(s.endsAt).getTime() <= now; const isNext = next?.id === s.id; const place = s.location && s.location !== defaultLocation ? s.location : null; return (
  1. {cancelled ? (s.label || "Session") : sessionLabel(s, sessions)} {formatSessionWhen(s)} {cancelled && Cancelled} {isNext && Next} {place && !cancelled && {place}}
  2. ); })}
); }