diff --git a/.gitignore b/.gitignore
index 7a7c633..6688eaa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -46,3 +46,4 @@ test-results/
# Python bytecode
__pycache__/
*.pyc
+.scratch/
diff --git a/apps/admin/src/components/BadgeCopiesSetting.tsx b/apps/admin/src/components/BadgeCopiesSetting.tsx
new file mode 100644
index 0000000..2b08962
--- /dev/null
+++ b/apps/admin/src/components/BadgeCopiesSetting.tsx
@@ -0,0 +1,108 @@
+import { useEffect, useState } from 'react';
+import { setBadgeCopies } from '../lib/api';
+
+/** Number of labels a welcome check-in can print, per the DB check constraint. */
+export const BADGE_COPIES_MIN = 1;
+export const BADGE_COPIES_MAX = 4;
+
+export function clampBadgeCopies(n: number): number {
+ return Number.isFinite(n) ? Math.max(BADGE_COPIES_MIN, Math.min(BADGE_COPIES_MAX, Math.round(n))) : BADGE_COPIES_MIN;
+}
+
+/**
+ * Presentational 1..4 picker. Two consumers on purpose:
+ * - the Events form holds this in its own state, so Cancel still cancels;
+ * - `BadgeCopiesSetting` wraps it for the Settings view, which saves at once.
+ */
+export function BadgeCopiesPicker({ value, onChange, disabled = false, labelId }: {
+ value: number;
+ onChange: (v: number) => void;
+ disabled?: boolean;
+ labelId?: string;
+}) {
+ return (
+
+ {[1, 2, 3, 4].map((n) => (
+
+ ))}
+
+ );
+}
+
+const HELP = 'How many labels print when an attendee is welcomed in at the front desk';
+
+/**
+ * Badge copies on welcome check-in (1..4, default 1) for one event.
+ * `events.badge_copies` drives `welcome_checkin`, which enqueues that many
+ * labels; a manual reprint from Registrations always prints one.
+ *
+ * Saves immediately through `setBadgeCopies` — a scoped single-column update,
+ * so it can never overwrite another event field the rest of the UI holds stale.
+ */
+export function BadgeCopiesSetting({ eventId, initialCopies, eventName }: {
+ eventId: string;
+ initialCopies: number;
+ eventName?: string;
+}) {
+ const [copies, setCopies] = useState(clampBadgeCopies(initialCopies));
+ const [saved, setSaved] = useState(clampBadgeCopies(initialCopies));
+ const [committed, setCommitted] = useState(false);
+ const [busy, setBusy] = useState(false);
+ const [error, setError] = useState(null);
+
+ // Follow the event when the caller switches to a different one.
+ useEffect(() => {
+ const next = clampBadgeCopies(initialCopies);
+ setCopies(next);
+ setSaved(next);
+ setCommitted(false);
+ setError(null);
+ }, [eventId, initialCopies]);
+
+ const dirty = copies !== saved;
+
+ async function save() {
+ if (busy || !dirty) return;
+ setBusy(true);
+ setError(null);
+ try {
+ await setBadgeCopies(eventId, copies);
+ setSaved(copies);
+ setCommitted(true);
+ } catch (e) {
+ setError(e instanceof Error ? e.message : 'Could not save');
+ } finally {
+ setBusy(false);
+ }
+ }
+
+ return (
+
+
+
+
+
+ {HELP}{eventName ? <> for {eventName}> : null}. Manual reprints from the
+ Registrations view always print one.
+
+
+
+
+
+
+
+ {error &&
{error}
}
+
+ );
+}
diff --git a/apps/admin/src/lib/api.ts b/apps/admin/src/lib/api.ts
index 9da621b..9075034 100644
--- a/apps/admin/src/lib/api.ts
+++ b/apps/admin/src/lib/api.ts
@@ -233,6 +233,7 @@ export async function upsertEvent(
pretix_api_key?: string | null;
use_realtime_clock?: boolean;
talk_networking_bonus?: number;
+ badge_copies?: number;
},
): Promise {
if (id) {
@@ -244,6 +245,18 @@ export async function upsertEvent(
}
}
+/**
+ * Set how many badge labels a welcome (front-desk) check-in prints for one
+ * event. Scoped update on purpose: it touches only this column, so it can never
+ * overwrite another field the Events form happens to hold stale values for.
+ * Clamped to 1..4 in the database (events.badge_copies check constraint).
+ */
+export async function setBadgeCopies(eventId: string, copies: number): Promise {
+ const value = Math.max(1, Math.min(4, Math.round(copies) || 1));
+ const { error } = await supabase.from('events').update({ badge_copies: value }).eq('id', eventId);
+ if (error) throw new ApiError(error.message);
+}
+
// ---- Sessionize sync (sidecar) ---------------------------------------------
// The sidecar is a separate Docker service (not Supabase), so these use raw
// fetch against the same-origin /sidecar proxy (see nginx.conf.template).
diff --git a/apps/admin/src/lib/types.ts b/apps/admin/src/lib/types.ts
index b928eb6..2586af6 100644
--- a/apps/admin/src/lib/types.ts
+++ b/apps/admin/src/lib/types.ts
@@ -65,6 +65,8 @@ export interface Event {
last_synced_at: string | null;
/** Bonus points each party earns for a connection when they shared a checked-in talk (0 = off). */
talk_networking_bonus: number;
+ /** How many badge labels a welcome (front-desk) check-in prints, 1..4. */
+ badge_copies?: number;
avg_feedback: number | null;
num_sessions: number;
num_speakers: number;
diff --git a/apps/admin/src/styles.css b/apps/admin/src/styles.css
index 2b032a4..2e9cfe0 100644
--- a/apps/admin/src/styles.css
+++ b/apps/admin/src/styles.css
@@ -1,4 +1,7 @@
.llm-settings { display: grid; gap: 18px; max-width: 640px; padding: 20px 0; border-top: 1px solid var(--line); }
+/* Same rhythm as .llm-settings, for standalone (non-form) settings blocks.
+ No top border: it sits above the bordered .llm-settings block. */
+.settings-section { display: grid; gap: 18px; max-width: 640px; padding: 20px 0; }
.feedback-summary { width: 100%; min-width: 0; padding: 16px 0; border-bottom: 1px solid var(--line); }
.feedback-summary-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.feedback-summary-head > div { min-width: 0; flex: 1 1 220px; overflow-wrap: anywhere; }
@@ -301,6 +304,8 @@ table.data tr:hover td { background: rgba(244,245,249,.6); }
font-weight: 700; font-size: 13.5px; cursor: pointer; font-family: inherit; white-space: nowrap;
}
.seg button.active { background: var(--accent-soft); color: var(--accent); }
+/* Compact numeric segment (badge copies): fixed-width buttons, comfortable targets. */
+.seg.seg-num button { flex: 0 0 auto; min-width: 44px; padding: 10px 0; text-align: center; }
/* ---------- QR ---------- */
.qr-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; }
@@ -343,7 +348,12 @@ table.data tr:hover td { background: rgba(244,245,249,.6); }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
/* ---------- Toggle switch ---------- */
-.toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
+/* The vertical padding (cancelled by equal negative margins) grows the clickable
+ area of a 40x23 switch to ~40x41 without changing the row's visual height. */
+.toggle {
+ display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none;
+ padding: 9px 0; margin: -9px 0;
+}
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle .track {
width: 40px; height: 23px; border-radius: 999px; background: #d5d8e2; position: relative;
@@ -355,8 +365,24 @@ table.data tr:hover td { background: rgba(244,245,249,.6); }
}
.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked + .track .knob { transform: translateX(17px); }
+.toggle input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
+.toggle input:disabled + .track { opacity: .45; cursor: default; }
.toggle-lbl { font-size: 13px; font-weight: 600; color: var(--text); }
+/* ---------- Per-row write state (Registrations table) ---------- */
+/* Only the row with a request in flight is marked. Deliberately light so the
+ row stays readable; the point is "this one is saving", not "table frozen". */
+table.data tr.row-busy td { background: rgba(244,245,249,.85); }
+.row-saving {
+ font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap;
+ animation: row-saving-pulse 1s ease-in-out infinite;
+}
+@keyframes row-saving-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
+@media (prefers-reduced-motion: reduce) {
+ .row-saving { animation: none; opacity: .8; }
+ .toggle .track, .toggle .knob { transition: none; }
+}
+
/* ---------- Event card (dashboard) ---------- */
.event-card {
background: linear-gradient(135deg, rgba(213,0,0,.1), rgba(32,178,170,.08));
diff --git a/apps/admin/src/views/Events.tsx b/apps/admin/src/views/Events.tsx
index 144b61c..5938dc8 100644
--- a/apps/admin/src/views/Events.tsx
+++ b/apps/admin/src/views/Events.tsx
@@ -11,6 +11,7 @@ import {
import type { Event, PretixOptions, PretixSyncResult, SyncResult } from '../lib/types';
import { useToast } from '../context/ToastContext';
import { Empty, Modal, Spinner, Toggle } from '../components/ui';
+import { BadgeCopiesPicker, clampBadgeCopies } from '../components/BadgeCopiesSetting';
import { normalizeSessionizeSource } from '../lib/sessionizeSource';
export function Events() {
@@ -297,6 +298,7 @@ function EventModal({
const [pretixError, setPretixError] = useState(null);
const [realtimeClock, setRealtimeClock] = useState(event?.use_realtime_clock ?? false);
const [talkBonus, setTalkBonus] = useState(event?.talk_networking_bonus ?? 2);
+ const [badgeCopies, setBadgeCopies] = useState(event?.badge_copies ?? 1);
const [busy, setBusy] = useState(false);
const lastFetchedKey = useRef(null);
@@ -353,6 +355,7 @@ function EventModal({
pretix_api_key: pretixApiKey.trim() || null,
use_realtime_clock: realtimeClock,
talk_networking_bonus: Math.max(0, Math.min(10, Math.round(talkBonus) || 0)),
+ badge_copies: clampBadgeCopies(badgeCopies),
});
onSaved(event ? 'Event updated' : 'Event created');
} catch (e) {
@@ -537,6 +540,24 @@ function EventModal({
/>
+
+
+
+
+
+ How many labels print when an attendee is welcomed in at the front desk.
+ Manual reprints from the Registrations view always print one.
+ The same control lives in Settings for the active event.
+
+
+
+
+
);
}
diff --git a/apps/admin/src/views/Registrations.tsx b/apps/admin/src/views/Registrations.tsx
index b877705..6c289de 100644
--- a/apps/admin/src/views/Registrations.tsx
+++ b/apps/admin/src/views/Registrations.tsx
@@ -41,12 +41,15 @@ export function Registrations() {
const [adding, setAdding] = useState(false);
const [qrFor, setQrFor] = useState(null);
const [sponsorFor, setSponsorFor] = useState(null);
- const [busy, setBusy] = useState(false);
const [deletingAll, setDeletingAll] = useState(false);
const [mergeFor, setMergeFor] = useState(null);
const [badgeFor, setBadgeFor] = useState(null);
const [badgeLayouts, setBadgeLayouts] = useState([]);
const [printingIds, setPrintingIds] = useState>(new Set());
+ // Rows with a write in flight (check-in toggle or pass-type change). Per-row
+ // instead of one global flag: a slow request must never freeze the whole
+ // table, and it must be obvious WHICH row is working.
+ const [busyIds, setBusyIds] = useState>(new Set());
const { overview: printOverview } = usePrintStatus();
// Aggregated printer state, used only to phrase the enqueue toast honestly.
const printerState = aggregateState(activeStations(printOverview));
@@ -174,43 +177,66 @@ export function Registrations() {
const ticketOptions = ynOptions(searched.filter((r) => passType(r) && passCheckedIn(r)), hasTicket);
const checkedInOptions = ynOptions(searched.filter((r) => passType(r) && passTicket(r)), (r) => r.checked_in);
- async function changeType(r: Registration, type: RegistrationType) {
- setBusy(true);
+ // Run a per-row write: mark that row busy, and clear it when settled. Only
+ // the touched row is disabled — the rest of the table stays usable.
+ async function withRowBusy(id: string, run: () => Promise) {
+ if (busyIds.has(id)) return;
+ setBusyIds((ids) => new Set(ids).add(id));
try {
- await setRegistrationType(r.contact_email, type);
- await reloadRegistrations(r.event_id);
- push('success', `${byEmail.get(r.contact_email)?.full_name ?? r.contact_email} → ${type}`);
- } catch (e) {
- const msg = e instanceof Error ? e.message : 'Update failed';
- // A sponsor registration needs a sponsor lookup — open the in-place
- // sponsor popup instead of just failing.
- if (type === 'sponsor' && /sponsor lookup/i.test(msg)) {
- setSponsorFor(r);
- } else {
- push('error', msg);
- }
+ await run();
} finally {
- setBusy(false);
+ setBusyIds((ids) => {
+ const next = new Set(ids);
+ next.delete(id);
+ return next;
+ });
}
}
- async function toggleCheckedIn(r: Registration, v: boolean) {
- setBusy(true);
- setRegistrations((rows) => rows.map((row) => row.id === r.id ? { ...row, checked_in: v } : row));
- try {
- const removed = await setCheckedIn(r.id, v);
- if (removed > 0) {
- push('success', `${byEmail.get(r.contact_email)?.full_name ?? r.contact_email}: un-checked in, −${removed} check-in pts removed`);
+ async function changeType(r: Registration, type: RegistrationType) {
+ await withRowBusy(r.id, async () => {
+ try {
+ await setRegistrationType(r.contact_email, type);
+ // Update the row in place — a full reload would reorder the table and
+ // make the row you just touched jump somewhere else.
+ setRegistrations((rows) => rows.map((row) => (row.id === r.id ? { ...row, type } : row)));
+ push('success', `${byEmail.get(r.contact_email)?.full_name ?? r.contact_email} → ${type}`);
+ } catch (e) {
+ const msg = e instanceof Error ? e.message : 'Update failed';
+ // A sponsor registration needs a sponsor lookup — open the in-place
+ // sponsor popup instead of just failing.
+ if (type === 'sponsor' && /sponsor lookup/i.test(msg)) {
+ setSponsorFor(r);
+ } else {
+ push('error', msg);
+ }
}
- // The RPC may have changed this attendee's points — refresh so the
- // points column and leaderboard stay truthful.
- await reloadRegistrations(r.event_id);
- } catch (e) {
- setRegistrations((rows) => rows.map((row) => row.id === r.id ? { ...row, checked_in: r.checked_in } : row));
- push('error', e instanceof Error ? e.message : 'Update failed');
- } finally {
- setBusy(false);
- }
+ });
+ }
+
+ async function toggleCheckedIn(r: Registration, v: boolean) {
+ await withRowBusy(r.id, async () => {
+ // Optimistically flip just this row's checkbox; the row keeps its place.
+ setRegistrations((rows) => rows.map((row) => (row.id === r.id ? { ...row, checked_in: v } : row)));
+ try {
+ const removed = await setCheckedIn(r.id, v);
+ // Patch this row's points from the RPC's own number. We deliberately do
+ // NOT reload the list: it is sorted by points, so a reload moves the row
+ // you just toggled somewhere else on every click.
+ setRegistrations((rows) => rows.map((row) => (row.id === r.id
+ ? { ...row, checked_in: v, points: Math.max(0, row.points - removed) }
+ : row)));
+ const name = byEmail.get(r.contact_email)?.full_name ?? r.contact_email;
+ if (removed > 0) push('success', `${name}: un-checked in, −${removed} check-in pts removed`);
+ else push('success', `${name}: ${v ? 'checked in' : 'un-checked in'}`);
+ } catch (e) {
+ // Revert to the committed state — never leave the checkbox lying.
+ setRegistrations((rows) => rows.map((row) => (row.id === r.id
+ ? { ...row, checked_in: r.checked_in, points: r.points }
+ : row)));
+ push('error', e instanceof Error ? e.message : 'Update failed');
+ }
+ });
}
// Queue this attendee's badge. Works while the printer is offline/error —
@@ -272,7 +298,7 @@ export function Registrations() {
className="input"
style={{ maxWidth: 280 }}
value={selectedId}
- disabled={busy || mergeFor !== null}
+ disabled={mergeFor !== null}
onChange={(e) => setSelectedId(e.target.value)}
>
{events.map((e) => (
@@ -312,8 +338,9 @@ export function Registrations() {
{filtered.map((r) => {
const c = byEmail.get(r.contact_email);
+ const rowBusy = busyIds.has(r.id);
return (
-
+ toggleCheckedIn(r, v)} />
+ {/* Per-row in-flight affordance: the switch is optimistic,
+ so show that the save is still travelling. */}
+ {rowBusy && Saving…}
+
{r.points}
@@ -456,9 +488,13 @@ export function Registrations() {
contact={byEmail.get(sponsorFor.contact_email)}
eventId={event.id}
onClose={() => setSponsorFor(null)}
- onSaved={async (msg) => {
+ onSaved={(msg) => {
+ // The modal sets the registration type to sponsor; mirror it on the
+ // row. (Reloading events here never refreshed the rows, which left
+ // the type badge showing the old value.)
+ const savedId = sponsorFor.id;
+ setRegistrations((rows) => rows.map((row) => (row.id === savedId ? { ...row, type: 'sponsor' } : row)));
setSponsorFor(null);
- await load();
push('success', msg);
}}
/>
diff --git a/apps/admin/src/views/Settings.tsx b/apps/admin/src/views/Settings.tsx
index 38b5a10..351489a 100644
--- a/apps/admin/src/views/Settings.tsx
+++ b/apps/admin/src/views/Settings.tsx
@@ -1,7 +1,9 @@
import { useEffect, useState, type FormEvent } from 'react';
import { Save } from 'lucide-react';
-import { getLlmSettings, saveLlmSettings } from '../lib/api';
+import { getActiveEvent, getLlmSettings, saveLlmSettings } from '../lib/api';
+import type { Event } from '../lib/types';
import { Spinner } from '../components/ui';
+import { BadgeCopiesSetting } from '../components/BadgeCopiesSetting';
export function Settings() {
const [endpoint, setEndpoint] = useState('');
@@ -13,6 +15,8 @@ export function Settings() {
const [busy, setBusy] = useState(false);
const [error, setError] = useState(null);
const [saved, setSaved] = useState(false);
+ // Badge printing is per event, so it follows the active event.
+ const [activeEvent, setActiveEvent] = useState(null);
useEffect(() => {
let active = true;
@@ -23,6 +27,11 @@ export function Settings() {
setHasKey(settings.has_api_key);
setLoaded(true);
}).catch(cause => { if (active) setError(cause instanceof Error ? cause.message : 'Failed to load settings'); });
+ // Best-effort: a failure here just hides the badge section, it must not
+ // break the Feedback AI settings below.
+ getActiveEvent()
+ .then(event => { if (active) setActiveEvent(event); })
+ .catch(() => { if (active) setActiveEvent(null); });
return () => { active = false; };
}, []);
@@ -47,6 +56,12 @@ export function Settings() {