From 6e7665a54521f4c9be4f045a9f1595b65d683156 Mon Sep 17 00:00:00 2001 From: Tanuja Pansare Date: Wed, 8 Jul 2026 10:25:38 +0530 Subject: [PATCH] Update WebCheck-in --- .../components/dashboard/EventHomeModules.tsx | 79 ++++++++++++++++++- .../components/panels/AddParticipantPanel.tsx | 49 +++++++++++- src/app/components/panels/CreateFormPanel.tsx | 44 +++++++---- src/services/api/types.ts | 1 + 4 files changed, 156 insertions(+), 17 deletions(-) diff --git a/src/app/components/dashboard/EventHomeModules.tsx b/src/app/components/dashboard/EventHomeModules.tsx index d5f3e21b..21293219 100644 --- a/src/app/components/dashboard/EventHomeModules.tsx +++ b/src/app/components/dashboard/EventHomeModules.tsx @@ -132,14 +132,16 @@ function moduleButtonStyle(primary = false): React.CSSProperties { function formDisplayType(apiType: string): string { if (apiType === "feedback") return "Feedback"; if (apiType === "registration") return "Registration"; + if (apiType === "web-check-in") return "Web check-in"; if (apiType === "other") return "Other"; if (apiType === "survey" || apiType === "custom") return "Other"; return apiType.charAt(0).toUpperCase() + apiType.slice(1); } -function formPanelMode(apiType: string): "feedback" | "registration" | "other" { +function formPanelMode(apiType: string): "feedback" | "registration" | "other" | "web-check-in" { if (apiType === "feedback") return "feedback"; if (apiType === "registration") return "registration"; + if (apiType === "web-check-in") return "web-check-in"; return "other"; } @@ -161,7 +163,7 @@ export function EventHomeModules() { const [eventForms, setEventForms] = useState([]); const [formEditTarget, setFormEditTarget] = useState(null); const [formResponsesTarget, setFormResponsesTarget] = useState(null); - const [newFormMode, setNewFormMode] = useState<"registration" | "feedback" | "other" | null>(null); + const [newFormMode, setNewFormMode] = useState<"registration" | "feedback" | "other" | "web-check-in" | null>(null); const [pollQuizCounts, setPollQuizCounts] = useState({ polls: 0, quizzes: 0 }); const [pollQuizLoading, setPollQuizLoading] = useState(false); const [showAddPoll, setShowAddPoll] = useState(false); @@ -181,6 +183,9 @@ export function EventHomeModules() { const [rewardRulesOpen, setRewardRulesOpen] = useState(false); const [agendaCounts, setAgendaCounts] = useState({ tracks: 0, sessions: 0 }); const [agendaLoading, setAgendaLoading] = useState(false); + const [eventSettings, setEventSettings] = useState>({}); + const [webCheckInEnabled, setWebCheckInEnabled] = useState(false); + const [webCheckInLoading, setWebCheckInLoading] = useState(false); useEffect(() => { if (!selectedEventId) { @@ -191,6 +196,8 @@ export function EventHomeModules() { void eventsApi.get(selectedEventId).then((res) => { if (cancelled) return; setEventName(res.data?.name ?? null); + setEventSettings((res.data?.settings as Record | undefined) ?? {}); + setWebCheckInEnabled(Boolean((res.data?.settings as Record | undefined)?.webCheckInEnabled)); }); return () => { cancelled = true; @@ -419,6 +426,28 @@ export function EventHomeModules() { : agendaLoading ? "Loading…" : `${agendaCounts.tracks} track${agendaCounts.tracks === 1 ? "" : "s"} · ${agendaCounts.sessions} session${agendaCounts.sessions === 1 ? "" : "s"}`; + const webCheckInMeta = !selectedEventId + ? "Select an event to configure web check-in" + : webCheckInLoading + ? "Saving…" + : webCheckInEnabled + ? "Enabled" + : "Disabled"; + + const handleWebCheckInToggle = async (enabled: boolean) => { + if (!selectedEventId) return; + setWebCheckInLoading(true); + try { + const nextSettings = { ...(eventSettings || {}), webCheckInEnabled: enabled }; + const res = await eventsApi.update(selectedEventId, { settings: nextSettings }); + if (!res.error) { + setEventSettings(nextSettings); + setWebCheckInEnabled(enabled); + } + } finally { + setWebCheckInLoading(false); + } + }; const handleSavePollQuiz = async ( kind: "poll" | "quiz", @@ -715,6 +744,40 @@ export function EventHomeModules() { } /> + } + title="Web check-in" + meta={webCheckInMeta} + description="Show or hide accommodation choice for participants" + actions={ + <> + + + + } + /> } title="Create New Form" @@ -765,6 +828,18 @@ export function EventHomeModules() { > Feedback + + ); + })} + + + ) : null}