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:
@@ -21,20 +21,25 @@ import { ContactButton } from "@/components/events/ContactButton";
|
||||
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 = formatDateTimeRange(event.startDate, event.endDate);
|
||||
const dateRange = scheduleSummary(event) || formatDateTimeRange(event.startDate, event.endDate);
|
||||
|
||||
const now = new Date();
|
||||
const deadline = event.registrationDeadline ? new Date(event.registrationDeadline) : null;
|
||||
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)
|
||||
&& !(deadline && now >= deadline)
|
||||
&& now < new Date(event.endDate);
|
||||
&& now < closesAt;
|
||||
const showEarlyBird = !!event.earlyBirdEndsAt && registrationOpen && !event.isSoldOut;
|
||||
|
||||
return (
|
||||
@@ -92,12 +97,8 @@ export const EventCard = ({ event }: { event: Event }) => {
|
||||
/>
|
||||
);
|
||||
}
|
||||
const now = new Date();
|
||||
const end = new Date(event.endDate);
|
||||
const deadline = event.registrationDeadline ? new Date(event.registrationDeadline) : null;
|
||||
const goLive = event.goLiveAt ? new Date(event.goLiveAt) : null;
|
||||
const notYetOpen = goLive ? now < goLive : false;
|
||||
const closed = (deadline ? now >= deadline : false) || now >= end;
|
||||
const closed = now >= closesAt;
|
||||
if (notYetOpen) {
|
||||
return (
|
||||
<button disabled className="flex-1 text-center text-sm text-gray-500 bg-gray-200 rounded-lg py-2 cursor-not-allowed" title="Registration not yet open">
|
||||
|
||||
Reference in New Issue
Block a user