This repository has been archived on 2026-11-23. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
hope-events/frontend/src/components/events/SessionSchedule.tsx
T
joshuaandClaude Opus 5.5 e9d1b1fb24 Accessibility pass, WCAG 2.2 AA (1.50.0)
Public pages, auth, registration, payment, My Events and the kiosk: skip
link, focus ring, labels tied to fields, named quantity buttons, announced
errors, ModalOverlay popups (focus trap, Escape, focus return), contrast
and underlined in-text links, reduced motion. Branding warns about a primary
colour too light for white text and offers a darker shade. axe-core and
keyboard checks in e2e/accessibility.spec.ts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 15:41:19 +02:00

40 lines
2.3 KiB
TypeScript

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 (
<div className="border rounded-xl p-5 bg-white shadow-sm">
<div className="flex items-center gap-2 mb-3">
<CalendarDays className="w-4 h-4 text-gray-500" />
<h2 className="text-base font-semibold text-gray-900">Schedule</h2>
<span className="text-xs text-gray-500">· {count} session{count === 1 ? "" : "s"}, one ticket for all</span>
</div>
<ol className="space-y-1.5">
{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 (
<li key={s.id} className={`flex flex-wrap items-baseline gap-x-3 gap-y-0.5 rounded-lg px-3 py-2 text-sm ${isNext ? "bg-brand-50 border border-brand-200" : "border border-transparent"} ${past ? "text-gray-500" : "text-gray-700"}`}>
<span className={`font-medium ${cancelled ? "line-through text-gray-500" : ""}`}>{cancelled ? (s.label || "Session") : sessionLabel(s, sessions)}</span>
<span className={cancelled ? "line-through text-gray-500" : ""}>{formatSessionWhen(s)}</span>
{cancelled && <span className="text-xs font-medium text-amber-700">Cancelled</span>}
{isNext && <span className="text-xs font-medium text-brand-700">Next</span>}
{place && !cancelled && <span className="flex items-center gap-1 text-xs text-gray-500"><MapPin className="w-3 h-3" />{place}</span>}
</li>
);
})}
</ol>
</div>
);
}