Archived
Add multi-day events (frontend), attendance register and certificates
Event wizard: one date or multiple sessions with a repeat-pattern builder, and a new Attendance step (late joining and pricing, check-in window, session reminders, certificates with preview). Public pages show the schedule and late prices; the scanner picks today's session; new attendance register page, My Certificates, and a public verify page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
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-400" : "text-gray-700"}`}>
|
||||
<span className={`font-medium ${cancelled ? "line-through text-gray-400" : ""}`}>{cancelled ? (s.label || "Session") : sessionLabel(s, sessions)}</span>
|
||||
<span className={cancelled ? "line-through text-gray-400" : ""}>{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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user