Registration optionset + speaker auto-promote + welcome check-in

- registrations.type is now a Postgres ENUM (registration_type)
- session_speakers trigger auto-promotes attendee -> speaker (never overrides staff/sponsor)
- new welcome_checkin RPC: staff marks an attendee present at the event
- admin Registrations: QR token is final (no reset); failed sponsor change opens in-place sponsor lookup
- Convivo Home: Now/Next cards always render; red pending-material pill + popup for speakers
- Convivo Agenda: speakers can delete their material to re-upload
- Convivo Scan: staff Session/Welcome check-in toggle (uiverse switch)
- seed: staff (Bruno/Rita) get a password so staff QR login works after reset

Co-authored-by: Stephan Charles <[email protected]>
Co-authored-by: Amelia Hernandez <[email protected]>
Co-authored-by: Markus Franz <[email protected]>
Co-authored-by: Sabrina Hota <[email protected]>
Co-authored-by: Nilüfer Doğan <[email protected]>
This commit is contained in:
committed 2026-08-23 21:33:44 +02:00
1 parent adcbb507e9
commit ffb270c140
16 files changed
+730 -142

No files matched your search

+59 -17
View File
@@ -1,9 +1,9 @@
import { useEffect, useState } from 'react';
import { useAuth } from '../context/AuthContext';
import { useEvent } from '../lib/useEvent';
import { checkinAttendee, createConnectionRequest, lanyardLookup } from '../lib/api';
import { checkinAttendee, createConnectionRequest, lanyardLookup, welcomeCheckin } from '../lib/api';
import { capWords } from '../lib/time';
import type { CheckinResult, PublicContact } from '../lib/types';
import type { CheckinResult, PublicContact, WelcomeCheckinResult } from '../lib/types';
import { Avatar, Scanner, Sheet, Spinner } from '../components/ui';
import { useToast } from '../context/ToastContext';
@@ -13,8 +13,10 @@ export function Scan() {
const isStaff = !!contact?.is_admin;
const [mode, setMode] = useState<'attendee' | 'staff'>(isStaff ? 'staff' : 'attendee');
const [sessionId, setSessionId] = useState<string>('');
const [welcomeMode, setWelcomeMode] = useState(false);
const [connectTarget, setConnectTarget] = useState<{ contact: PublicContact; qr: string } | null>(null);
const [checkin, setCheckin] = useState<CheckinResult | null>(null);
const [welcome, setWelcome] = useState<WelcomeCheckinResult | null>(null);
const [busy, setBusy] = useState(false);
const { toast } = useToast();
@@ -42,12 +44,17 @@ export function Scan() {
setBusy(true);
try {
if (activeStaff) {
if (!sessionId) {
toast('Pick a session first', 'err');
return;
if (welcomeMode) {
const res = await welcomeCheckin(token);
setWelcome(res);
} else {
if (!sessionId) {
toast('Pick a session first', 'err');
return;
}
const res = await checkinAttendee(sessionId, token);
setCheckin(res);
}
const res = await checkinAttendee(sessionId, token);
setCheckin(res);
} else {
const found = await lanyardLookup(token);
if (!found) {
@@ -103,22 +110,40 @@ export function Scan() {
{activeStaff && (
<div>
<div className="muted small" style={{ marginBottom: 7 }}>Checking in to session</div>
<select className="input" value={sessionId} onChange={(e) => setSessionId(e.target.value)}>
{slots.map(({ slot, sessions }) => (
<optgroup key={slot.id} label={`${slot.name} · ${slot.start_time.slice(0, 5)}`}>
{sessions.map((s) => (
<option key={s.id} value={s.id}>{s.title}</option>
<div className="row between" style={{ marginBottom: 10 }}>
<span className="muted small" style={{ fontWeight: 700 }}>Check-in type</span>
<label className="uiverse-toggle" title={welcomeMode ? 'Welcome check-in' : 'Session check-in'}>
<input
type="checkbox"
checked={welcomeMode}
onChange={(e) => setWelcomeMode(e.target.checked)}
/>
</label>
</div>
{welcomeMode ? (
<div className="muted small" style={{ padding: '10px 12px', background: 'var(--surface)', border: '1px solid var(--line)', borderRadius: 12 }}>
🏷 <b>Welcome check-in</b> — marks the attendee present at the event.
</div>
) : (
<>
<div className="muted small" style={{ marginBottom: 7 }}>Checking in to session</div>
<select className="input" value={sessionId} onChange={(e) => setSessionId(e.target.value)}>
{slots.map(({ slot, sessions }) => (
<optgroup key={slot.id} label={`${slot.name} · ${slot.start_time.slice(0, 5)}`}>
{sessions.map((s) => (
<option key={s.id} value={s.id}>{s.title}</option>
))}
</optgroup>
))}
</optgroup>
))}
</select>
</select>
</>
)}
</div>
)}
<Scanner onResult={handleScan} label={activeStaff ? 'Point at an attendee’s lanyard' : 'Point at a peer’s lanyard'} />
{busy && <div className="center"><Spinner /></div>}
{activeStaff && selSession && (
{activeStaff && !welcomeMode && selSession && (
<div className="muted small" style={{ textAlign: 'center', opacity: 0.6 }}>
{selSession.room} · {selSession.speakers}
</div>
@@ -172,6 +197,23 @@ export function Scan() {
</div>
)}
</Sheet>
{/* Welcome check-in result sheet */}
<Sheet open={!!welcome} onClose={() => setWelcome(null)}>
{welcome && (
<div style={{ textAlign: 'center' }}>
<div style={{ fontSize: 52 }}>{welcome.already ? '⚠️' : '👋'}</div>
<h3 style={{ marginTop: 10 }}>{welcome.attendee_name}</h3>
<div className="sub">{welcome.already ? 'Already checked in to the event' : 'Welcome to the event!'}</div>
<div style={{ marginTop: 14 }}>
<span className="pill green">✓ Checked in</span>
</div>
<button className="btn primary" style={{ marginTop: 18 }} onClick={() => setWelcome(null)}>
Scan next
</button>
</div>
)}
</Sheet>
</section>
);
}