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:
1 parent
adcbb507e9
commit
ffb270c140
16 files changed
+730
-142
No files matched your search
@@ -4,11 +4,11 @@ import {
|
||||
getAllContacts,
|
||||
getActiveEvent,
|
||||
getRegistrations,
|
||||
resetQrToken,
|
||||
setCheckedIn,
|
||||
setRegistrationType,
|
||||
upsertSponsor,
|
||||
} from '../lib/api';
|
||||
import type { Contact, Event, Registration, RegistrationType } from '../lib/types';
|
||||
import type { Contact, Event, Registration, RegistrationType, SponsorType } from '../lib/types';
|
||||
import { useToast } from '../context/ToastContext';
|
||||
import { Avatar, Empty, Modal, QrImage, Spinner, Toggle, TypeBadge } from '../components/ui';
|
||||
|
||||
@@ -24,7 +24,7 @@ export function Registrations() {
|
||||
const [query, setQuery] = useState('');
|
||||
const [adding, setAdding] = useState(false);
|
||||
const [qrFor, setQrFor] = useState<Registration | null>(null);
|
||||
const [newToken, setNewToken] = useState<string | null>(null);
|
||||
const [sponsorFor, setSponsorFor] = useState<Registration | null>(null);
|
||||
const [busy, setBusy] = useState(false);
|
||||
|
||||
async function load() {
|
||||
@@ -69,7 +69,14 @@ export function Registrations() {
|
||||
await load();
|
||||
push('success', `${byEmail.get(r.contact_email)?.full_name ?? r.contact_email} → ${type}`);
|
||||
} catch (e) {
|
||||
push('error', e instanceof Error ? e.message : 'Update failed');
|
||||
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);
|
||||
}
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -87,21 +94,6 @@ export function Registrations() {
|
||||
}
|
||||
}
|
||||
|
||||
async function doResetQr(r: Registration) {
|
||||
setBusy(true);
|
||||
try {
|
||||
const res = await resetQrToken(r.contact_email);
|
||||
setNewToken(res.qr_token);
|
||||
setQrFor(r);
|
||||
await load();
|
||||
push('success', `New QR token issued for ${byEmail.get(r.contact_email)?.full_name ?? r.contact_email}`);
|
||||
} catch (e) {
|
||||
push('error', e instanceof Error ? e.message : 'Reset failed');
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (error) return <Empty icon="⚠️" text={error} />;
|
||||
if (!loaded)
|
||||
return (
|
||||
@@ -195,7 +187,7 @@ export function Registrations() {
|
||||
<td>
|
||||
<div className="row" style={{ gap: 8 }}>
|
||||
<span className="mono small">{r.qr_token ?? '—'}</span>
|
||||
<button className="btn small" onClick={() => { setNewToken(null); setQrFor(r); }}>
|
||||
<button className="btn small" onClick={() => setQrFor(r)}>
|
||||
QR
|
||||
</button>
|
||||
</div>
|
||||
@@ -233,35 +225,34 @@ export function Registrations() {
|
||||
title={`QR — ${byEmail.get(qrFor.contact_email)?.full_name ?? qrFor.contact_email}`}
|
||||
onClose={() => setQrFor(null)}
|
||||
footer={
|
||||
<>
|
||||
<button className="btn danger" disabled={busy} onClick={() => doResetQr(qrFor)}>
|
||||
{busy ? 'Resetting…' : 'Reset token'}
|
||||
</button>
|
||||
<button className="btn primary" onClick={() => setQrFor(null)}>
|
||||
Done
|
||||
</button>
|
||||
</>
|
||||
<button className="btn primary" onClick={() => setQrFor(null)}>
|
||||
Done
|
||||
</button>
|
||||
}
|
||||
>
|
||||
<div className="qr-wrap">
|
||||
{newToken ? (
|
||||
<>
|
||||
<QrImage value={newToken} size={190} />
|
||||
<div className="token-big">{newToken}</div>
|
||||
<p className="muted small">
|
||||
New token issued. The old token no longer works — the person must re-scan.
|
||||
</p>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<QrImage value={qrFor.qr_token ?? ''} size={190} />
|
||||
<div className="token-big">{qrFor.qr_token ?? '—'}</div>
|
||||
<p className="muted small">Current token. Reset to issue a new one.</p>
|
||||
</>
|
||||
)}
|
||||
<QrImage value={qrFor.qr_token ?? ''} size={190} />
|
||||
<div className="token-big">{qrFor.qr_token ?? '—'}</div>
|
||||
<p className="muted small">
|
||||
This token is final — it was generated by Pretix and can’t be reset.
|
||||
</p>
|
||||
</div>
|
||||
</Modal>
|
||||
)}
|
||||
|
||||
{sponsorFor && (
|
||||
<SponsorLookupModal
|
||||
registration={sponsorFor}
|
||||
contact={byEmail.get(sponsorFor.contact_email)}
|
||||
eventId={event.id}
|
||||
onClose={() => setSponsorFor(null)}
|
||||
onSaved={async (msg) => {
|
||||
setSponsorFor(null);
|
||||
await load();
|
||||
push('success', msg);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -340,3 +331,118 @@ function AddRegistrationModal({
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* In-place sponsor lookup: shown when an admin tries to set a registration to
|
||||
* 'sponsor' but no sponsor exists for that contact yet. Lets them create the
|
||||
* sponsor (with a contact search) and then retry the type change.
|
||||
*/
|
||||
function SponsorLookupModal({
|
||||
registration,
|
||||
contact,
|
||||
eventId,
|
||||
onClose,
|
||||
onSaved,
|
||||
}: {
|
||||
registration: Registration;
|
||||
contact: Contact | undefined;
|
||||
eventId: string;
|
||||
onClose: () => void;
|
||||
onSaved: (msg: string) => void;
|
||||
}) {
|
||||
const [type, setType] = useState<SponsorType>('gold');
|
||||
const [name, setName] = useState('');
|
||||
const [email, setEmail] = useState('');
|
||||
const [phone, setPhone] = useState('');
|
||||
const [paid, setPaid] = useState(false);
|
||||
const [amount, setAmount] = useState('');
|
||||
const [busy, setBusy] = useState(false);
|
||||
|
||||
const contactEmail = registration.contact_email;
|
||||
|
||||
async function save() {
|
||||
if (!name.trim()) return;
|
||||
setBusy(true);
|
||||
try {
|
||||
await upsertSponsor(null, {
|
||||
event_id: eventId,
|
||||
type,
|
||||
name: name.trim(),
|
||||
email: email.trim() || null,
|
||||
phone: phone.trim() || null,
|
||||
paid,
|
||||
amount_eur: amount ? parseFloat(amount) : null,
|
||||
contact_email: contactEmail,
|
||||
});
|
||||
await setRegistrationType(contactEmail, 'sponsor');
|
||||
onSaved(`Sponsor "${name.trim()}" created — ${contact?.full_name ?? contactEmail} is now a sponsor`);
|
||||
} catch (e) {
|
||||
onSaved(e instanceof Error ? e.message : 'Save failed');
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Modal
|
||||
open
|
||||
title={`Sponsor lookup — ${contact?.full_name ?? contactEmail}`}
|
||||
onClose={onClose}
|
||||
footer={
|
||||
<>
|
||||
<button className="btn" onClick={onClose}>
|
||||
Cancel
|
||||
</button>
|
||||
<button className="btn primary" disabled={busy || !name.trim()} onClick={save}>
|
||||
{busy ? 'Saving…' : 'Create sponsor & set type'}
|
||||
</button>
|
||||
</>
|
||||
}
|
||||
>
|
||||
<p className="muted small" style={{ marginBottom: 14 }}>
|
||||
A sponsor registration needs a sponsor lookup. Create the sponsor below — it will be linked to{' '}
|
||||
<b>{contact?.full_name ?? contactEmail}</b> and their registration type set to <b>Sponsor</b>.
|
||||
</p>
|
||||
<div className="grid-2">
|
||||
<div className="field">
|
||||
<label>Sponsor type</label>
|
||||
<select className="input" value={type} onChange={(e) => setType(e.target.value as SponsorType)}>
|
||||
{(['headline', 'platinum', 'gold', 'silver', 'community', 'swag', 'catering', 'diversity'] as SponsorType[]).map(
|
||||
(t) => (
|
||||
<option key={t} value={t}>
|
||||
{t}
|
||||
</option>
|
||||
),
|
||||
)}
|
||||
</select>
|
||||
</div>
|
||||
<div className="field">
|
||||
<label>Sponsor name</label>
|
||||
<input className="input" value={name} onChange={(e) => setName(e.target.value)} placeholder="e.g. Nubank" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="grid-2">
|
||||
<div className="field">
|
||||
<label>Email</label>
|
||||
<input className="input" type="email" value={email} onChange={(e) => setEmail(e.target.value)} placeholder="—" />
|
||||
</div>
|
||||
<div className="field">
|
||||
<label>Phone</label>
|
||||
<input className="input" value={phone} onChange={(e) => setPhone(e.target.value)} placeholder="—" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="grid-2">
|
||||
<div className="field">
|
||||
<label>Amount (€)</label>
|
||||
<input className="input" type="number" value={amount} onChange={(e) => setAmount(e.target.value)} placeholder="0" />
|
||||
</div>
|
||||
<div className="field">
|
||||
<label>Paid</label>
|
||||
<div style={{ paddingTop: 6 }}>
|
||||
<Toggle checked={paid} onChange={setPaid} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import type {
|
||||
Registration,
|
||||
Session,
|
||||
Slot,
|
||||
WelcomeCheckinResult,
|
||||
} from './types';
|
||||
|
||||
export class ApiError extends Error {}
|
||||
@@ -157,6 +158,12 @@ export async function checkinAttendee(sessionId: string, attendeeQr: string): Pr
|
||||
return rows[0];
|
||||
}
|
||||
|
||||
/** Staff welcome check-in: mark an attendee present at the event (no session). */
|
||||
export async function welcomeCheckin(attendeeQr: string): Promise<WelcomeCheckinResult> {
|
||||
const rows = await rpc<WelcomeCheckinResult[]>('welcome_checkin', { p_attendee_qr: attendeeQr });
|
||||
return rows[0];
|
||||
}
|
||||
|
||||
export async function getMyFeedback(email: string): Promise<Feedback[]> {
|
||||
const { data, error } = await supabase.from('feedback').select('*').eq('contact_email', email);
|
||||
if (error) throw new ApiError(error.message);
|
||||
@@ -212,3 +219,20 @@ export async function uploadSessionMaterial(sessionId: string, file: File): Prom
|
||||
if (dbErr) throw new ApiError(dbErr.message);
|
||||
return path;
|
||||
}
|
||||
|
||||
/** Remove a session's material (storage object + clear material_path). Speakers
|
||||
* can delete their own material to re-upload; the path is cleared via the
|
||||
* `set_session_material` RPC (sessions is admin-write only). */
|
||||
export async function removeSessionMaterial(sessionId: string): Promise<void> {
|
||||
const { data } = await supabase.from('sessions').select('material_path').eq('id', sessionId).maybeSingle();
|
||||
const path = (data as Session | null)?.material_path;
|
||||
if (path) {
|
||||
const { error: rmErr } = await supabase.storage.from('materials').remove([path]);
|
||||
if (rmErr) throw new ApiError(rmErr.message);
|
||||
}
|
||||
const { error: dbErr } = await supabase.rpc('set_session_material', {
|
||||
p_session_id: sessionId,
|
||||
p_material_path: null,
|
||||
});
|
||||
if (dbErr) throw new ApiError(dbErr.message);
|
||||
}
|
||||
@@ -159,6 +159,13 @@ export interface CheckinResult {
|
||||
already: boolean;
|
||||
}
|
||||
|
||||
/** Result of a staff welcome check-in (marks an attendee present at the event). */
|
||||
export interface WelcomeCheckinResult {
|
||||
attendee_email: string;
|
||||
attendee_name: string;
|
||||
already: boolean;
|
||||
}
|
||||
|
||||
export interface FeedbackResult {
|
||||
feedback_id: string;
|
||||
points: number;
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
getMyCheckins,
|
||||
getMyPreferences,
|
||||
getMySpeakerSessions,
|
||||
removeSessionMaterial,
|
||||
sessionMaterialUrl,
|
||||
setPreference,
|
||||
uploadSessionMaterial,
|
||||
@@ -114,6 +115,19 @@ export function Agenda({ openFeedback }: { openFeedback: (sessionId: string) =>
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDeleteMaterial() {
|
||||
if (!selected) return;
|
||||
if (!confirm('Remove this material? You can upload a new one.')) return;
|
||||
try {
|
||||
await removeSessionMaterial(selected.id);
|
||||
toast('Material removed', 'ok');
|
||||
setSelected(null);
|
||||
reload();
|
||||
} catch (err) {
|
||||
toast(err instanceof Error ? err.message : 'Could not remove material', 'err');
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="screen">
|
||||
<div className="row between">
|
||||
@@ -222,6 +236,12 @@ export function Agenda({ openFeedback }: { openFeedback: (sessionId: string) =>
|
||||
📎 Download material
|
||||
</a>
|
||||
)}
|
||||
{/* Speakers can remove their own material to re-upload. */}
|
||||
{selISpeaker && selected.material_path && (
|
||||
<button className="btn danger" onClick={handleDeleteMaterial}>
|
||||
🗑 Remove material
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useAuth } from '../context/AuthContext';
|
||||
import { useEvent } from '../lib/useEvent';
|
||||
import { getMyCheckins, getMyPreferences } from '../lib/api';
|
||||
import { getMyCheckins, getMyPreferences, getMySpeakerSessions } from '../lib/api';
|
||||
import { fmtRange, greeting, slotStatus } from '../lib/time';
|
||||
import type { Preference } from '../lib/types';
|
||||
import { Empty, Spinner } from '../components/ui';
|
||||
import type { Preference, Session } from '../lib/types';
|
||||
import { Empty, Sheet, Spinner } from '../components/ui';
|
||||
|
||||
export function Home({ go }: { go: (tab: string) => void }) {
|
||||
const { contact, registration } = useAuth();
|
||||
const { event, slots, sessionById, now, loading } = useEvent();
|
||||
const [prefs, setPrefs] = useState<Preference[]>([]);
|
||||
const [checkins, setCheckins] = useState<string[]>([]);
|
||||
const [mySpeakerSessions, setMySpeakerSessions] = useState<string[]>([]);
|
||||
const [materialSheetOpen, setMaterialSheetOpen] = useState(false);
|
||||
|
||||
const email = contact?.email ?? '';
|
||||
|
||||
@@ -18,10 +20,15 @@ export function Home({ go }: { go: (tab: string) => void }) {
|
||||
let active = true;
|
||||
(async () => {
|
||||
try {
|
||||
const [p, c] = await Promise.all([getMyPreferences(), getMyCheckins(email)]);
|
||||
const [p, c, sp] = await Promise.all([
|
||||
getMyPreferences(),
|
||||
getMyCheckins(email),
|
||||
getMySpeakerSessions(email),
|
||||
]);
|
||||
if (!active) return;
|
||||
setPrefs(p);
|
||||
setCheckins(c);
|
||||
setMySpeakerSessions(sp);
|
||||
} catch {
|
||||
/* non-fatal */
|
||||
}
|
||||
@@ -60,6 +67,11 @@ export function Home({ go }: { go: (tab: string) => void }) {
|
||||
const nowSession = current ? sessionById.get(pickFor(current.slot.id) ?? '') : undefined;
|
||||
const nextSession = next ? sessionById.get(pickFor(next.slot.id) ?? '') : undefined;
|
||||
|
||||
// Sessions the signed-in contact speaks in that still have no material uploaded.
|
||||
const pendingMaterial = mySpeakerSessions
|
||||
.map((id) => sessionById.get(id))
|
||||
.filter((s): s is Session => !!s && !s.material_path);
|
||||
|
||||
const firstName = contact.full_name.split(' ')[0];
|
||||
|
||||
return (
|
||||
@@ -69,37 +81,60 @@ export function Home({ go }: { go: (tab: string) => void }) {
|
||||
<div className="h1">{greeting(now)}, {firstName} 👋</div>
|
||||
<div className="muted small">{event.name}</div>
|
||||
</div>
|
||||
<div className="points-pill" onClick={() => go('leaderboard')}>⚡ {points}</div>
|
||||
<div className="row" style={{ gap: 8 }}>
|
||||
{pendingMaterial.length > 0 && (
|
||||
<div className="material-pill" onClick={() => setMaterialSheetOpen(true)}>
|
||||
📎 {pendingMaterial.length}
|
||||
</div>
|
||||
)}
|
||||
<div className="points-pill" onClick={() => go('leaderboard')}>⚡ {points}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{nowSession && current && (
|
||||
{current && (
|
||||
<div className="card now-card">
|
||||
<div className="row between">
|
||||
<span className="pill violet">● Now</span>
|
||||
<span className="muted small">{fmtRange(current.slot)}</span>
|
||||
</div>
|
||||
<div className="h2" style={{ marginTop: 10 }}>{nowSession.title}</div>
|
||||
<div className="muted small" style={{ marginTop: 3 }}>
|
||||
{nowSession.room} · {nowSession.speakers}
|
||||
</div>
|
||||
{checkins.includes(nowSession.id) ? (
|
||||
<span className="pill green" style={{ marginTop: 10 }}>✓ Checked in</span>
|
||||
{nowSession ? (
|
||||
<>
|
||||
<div className="h2" style={{ marginTop: 10 }}>{nowSession.title}</div>
|
||||
<div className="muted small" style={{ marginTop: 3 }}>
|
||||
{nowSession.room} · {nowSession.speakers}
|
||||
</div>
|
||||
{checkins.includes(nowSession.id) ? (
|
||||
<span className="pill green" style={{ marginTop: 10 }}>✓ Checked in</span>
|
||||
) : (
|
||||
<span className="pill amber" style={{ marginTop: 10 }}>Show your QR to staff to check in</span>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<span className="pill amber" style={{ marginTop: 10 }}>Show your QR to staff to check in</span>
|
||||
<div className="muted small" style={{ marginTop: 10 }}>
|
||||
No pick yet — tap a session in the Agenda to choose.
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{nextSession && next && (
|
||||
{next && (
|
||||
<div className="card">
|
||||
<div className="row between">
|
||||
<span className="pill cyan">Next</span>
|
||||
<span className="muted small">{fmtRange(next.slot)}</span>
|
||||
</div>
|
||||
<div className="h2" style={{ marginTop: 10 }}>{nextSession.title}</div>
|
||||
<div className="muted small" style={{ marginTop: 3 }}>
|
||||
{nextSession.room} · {nextSession.speakers}
|
||||
</div>
|
||||
{nextSession ? (
|
||||
<>
|
||||
<div className="h2" style={{ marginTop: 10 }}>{nextSession.title}</div>
|
||||
<div className="muted small" style={{ marginTop: 3 }}>
|
||||
{nextSession.room} · {nextSession.speakers}
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<div className="muted small" style={{ marginTop: 10 }}>
|
||||
No pick yet — tap a session in the Agenda to choose.
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -145,6 +180,38 @@ export function Home({ go }: { go: (tab: string) => void }) {
|
||||
</div>
|
||||
</div>
|
||||
<div style={{ height: 8 }} />
|
||||
|
||||
{/* Pending material popup (speakers only, when a session is missing its attachment) */}
|
||||
<Sheet open={materialSheetOpen} onClose={() => setMaterialSheetOpen(false)}>
|
||||
<h3 style={{ marginBottom: 4 }}>📎 Pending material</h3>
|
||||
<div className="muted small" style={{ marginBottom: 14 }}>
|
||||
The following sessions are pending to upload their attachments.
|
||||
</div>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
||||
{pendingMaterial.map((s) => {
|
||||
const slot = slots.find((x) => x.slot.id === s.slot_id)?.slot;
|
||||
return (
|
||||
<button
|
||||
key={s.id}
|
||||
className="pick-chip"
|
||||
onClick={() => {
|
||||
setMaterialSheetOpen(false);
|
||||
go('agenda');
|
||||
}}
|
||||
>
|
||||
<span className="t">{slot ? fmtRange(slot) : ''}</span>
|
||||
<span className="grow" style={{ fontWeight: 600, textAlign: 'left' }}>
|
||||
{s.title}
|
||||
</span>
|
||||
<span className="muted small">{s.room}</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<button className="btn primary" style={{ marginTop: 16 }} onClick={() => setMaterialSheetOpen(false)}>
|
||||
Got it
|
||||
</button>
|
||||
</Sheet>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
@@ -165,6 +165,11 @@ textarea.input { resize: none; min-height: 96px; }
|
||||
background: rgba(245,158,11,.14); border: 1px solid rgba(245,158,11,.4);
|
||||
color: #b45309; font-weight: 800; font-size: 14px; cursor: pointer; flex-shrink: 0; white-space: nowrap;
|
||||
}
|
||||
.material-pill {
|
||||
display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; border-radius: 999px;
|
||||
background: rgba(213,0,0,.1); border: 1px solid rgba(213,0,0,.4);
|
||||
color: #d50000; font-weight: 800; font-size: 14px; cursor: pointer; flex-shrink: 0; white-space: nowrap;
|
||||
}
|
||||
.now-card { background: linear-gradient(135deg, rgba(213,0,0,.1), rgba(32,178,170,.08)); border: 1px solid rgba(213,0,0,.35); }
|
||||
.qa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
|
||||
.qa {
|
||||
@@ -215,6 +220,44 @@ textarea.input { resize: none; min-height: 96px; }
|
||||
.sheet h3 { font-size: 19px; font-weight: 800; letter-spacing: -.3px; }
|
||||
.sheet .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
|
||||
|
||||
/* ---------- Scan: uiverse check-in type toggle (Shoh2008 / brown-bulldog-12) ---------- */
|
||||
.uiverse-toggle { display: inline-flex; }
|
||||
.uiverse-toggle input[type="checkbox"] {
|
||||
--size: 58px;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
width: var(--size);
|
||||
height: calc(var(--size) / 2);
|
||||
background-color: var(--surface);
|
||||
border: 3px solid var(--line);
|
||||
border-radius: 30px 100px 100px 100px;
|
||||
box-shadow: 0 6px 14px rgba(66,60,60,.14);
|
||||
outline: none;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
transition: all .4s;
|
||||
}
|
||||
.uiverse-toggle input[type="checkbox"]::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: calc(var(--size) / 2 - 8px);
|
||||
height: calc(var(--size) / 2 - 8px);
|
||||
left: 3px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%) scale(1);
|
||||
border-radius: 50%;
|
||||
background-color: var(--muted);
|
||||
transition: all .4s;
|
||||
}
|
||||
.uiverse-toggle input[type="checkbox"]:checked {
|
||||
background-color: var(--accent);
|
||||
border-color: var(--accent);
|
||||
}
|
||||
.uiverse-toggle input[type="checkbox"]:checked::before {
|
||||
left: calc(100% - calc(var(--size) / 2 - 8px) - 3px);
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
/* ---------- Connections ---------- */
|
||||
.seg { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 4px; }
|
||||
.seg button {
|
||||
|
||||
@@ -111,6 +111,15 @@ Staff checks an attendee into a session.
|
||||
> `return query` inside an `if` block would *not* terminate the function and would
|
||||
> double-award.
|
||||
|
||||
### `welcome_checkin(p_attendee_qr)` → `(attendee_email, attendee_name, already)`
|
||||
Staff **welcome** check-in: marks an attendee present at the **event** (distinct
|
||||
from `checkin_attendee`, which checks someone into a specific session).
|
||||
- **Role check:** `is_staff_or_admin()` or it raises `staff or admin only`.
|
||||
- Resolves the attendee by `qr_token` for the active event.
|
||||
- Sets `registrations.checked_in = true` (no points — that's the session
|
||||
check-in's job).
|
||||
- `already` is `true` if the attendee was already checked in to the event.
|
||||
|
||||
### `submit_feedback(p_session_id, p_rating, p_comment)` → `(feedback_id, points, earned)`
|
||||
Post-session feedback.
|
||||
- **Requires the caller to be checked in** to that session (else raises).
|
||||
@@ -166,6 +175,7 @@ immediately.
|
||||
|
||||
### `set_registration_type(p_contact_email, p_type)` → `registrations`
|
||||
**Admin-only.** Changes a contact's registration type for the active event.
|
||||
`p_type` is `text` and is cast to the `registration_type` enum on write.
|
||||
|
||||
### `evaluate_session_feedback(p_session_id)` → `sessions`
|
||||
**Admin-only.** The **AI-feedback stub**: sets `ai_generated_feedback` to a
|
||||
|
||||
@@ -94,7 +94,7 @@ Points are scoped **per event** here (one row per contact per event).
|
||||
| `id` | `uuid` PK | |
|
||||
| `event_id` | `uuid` FK → `events` | `on delete cascade` |
|
||||
| `contact_email` | `text` FK → `contacts` | `on delete cascade` |
|
||||
| `type` | `text` | `attendee` \| `speaker` \| `staff` \| `sponsor` (default `attendee`) |
|
||||
| `type` | `registration_type` (enum) | `attendee` \| `speaker` \| `staff` \| `sponsor` (default `attendee`) |
|
||||
| `checked_in` | `boolean` | default `false` |
|
||||
| `points` | `integer` | `>= 0`, default 0 |
|
||||
| `qr_token` | `text` | nullable — the lanyard token; **doubles as the Auth password** (generated per event) |
|
||||
@@ -105,6 +105,14 @@ Points are scoped **per event** here (one row per contact per event).
|
||||
per event. Partial unique indexes: `registrations_external_id_uniq (external_id) WHERE external_id IS NOT NULL`
|
||||
and `registrations_qr_token_uniq (qr_token) WHERE qr_token IS NOT NULL` (fast lanyard lookups).
|
||||
|
||||
**`type` is a Postgres ENUM** (`public.registration_type`), not free text — the
|
||||
four ticket types are enforced at the database level.
|
||||
|
||||
**Speaker auto-promote:** the `session_speakers_speaker_promote` trigger (after
|
||||
insert on `session_speakers`) promotes a contact's active-event registration from
|
||||
`attendee` → `speaker` when they're added as a speaker. It is one-way (removing a
|
||||
speaker never demotes) and never overrides an explicit `staff`/`sponsor` ticket.
|
||||
|
||||
## `sponsors` — a sponsor for an event
|
||||
|
||||
Unpaid sponsors are hidden from non-admins (RLS).
|
||||
|
||||
+36
-21
@@ -42,31 +42,43 @@ Source of truth: [`supabase/seed.sql`](../../supabase/seed.sql). The seed runs o
|
||||
|
||||
## Demo accounts
|
||||
|
||||
**Attendees & staff** log in with **QR code** (typed or scanned) + **email** —
|
||||
the QR token is the Auth password. The **APPE Admin** (and any staff member you
|
||||
give one) can also log in with **email + password** (event-independent, so it
|
||||
works for any event). The password lives in `contacts.password`; a trigger
|
||||
(`trg_contact_password_sync`) **auto-syncs** it as the bcrypt hash in
|
||||
`auth.users.encrypted_password`, so just set `contacts.password` in Supabase and
|
||||
it works with `signInWithPassword` immediately.
|
||||
**Attendees** log in with **QR code** (typed or scanned) + **email** — the QR
|
||||
token is the Auth password. **Staff** log in with **QR code + their staff
|
||||
password** (the Convivo app shows a password field when a staff QR is detected;
|
||||
the email comes from the resolved contact). The **APPE Admin** (and any staff
|
||||
member you give one) can also log in with **email + password** in the admin app
|
||||
(event-independent, so it works for any event). The password lives in
|
||||
`contacts.password`; a trigger (`trg_contact_password_sync`) **auto-syncs** it as
|
||||
the bcrypt hash in `auth.users.encrypted_password`, so just set
|
||||
`contacts.password` in Supabase and it works with `signInWithPassword`
|
||||
immediately.
|
||||
|
||||
| Person | Type | Login | Email | Start pts |
|
||||
|---|---|---|---|---|
|
||||
| **Ana Silva** | attendee | QR `CVV-ANA-4821` | ana.silva@nubank.com | 40 |
|
||||
| **Bruno Costa** | staff (admin) | QR `CVV-BRU-1177` | bruno.costa@acme.com | 140 |
|
||||
| **Rita Lopes** | staff (admin) | QR `CVV-RIT-9034` | rita.lopes@globant.com | 95 |
|
||||
| **Ana Silva** | speaker | QR `CVV-ANA-4821` | ana.silva@nubank.com | 40 |
|
||||
| **Bruno Costa** | staff (admin) | QR `CVV-BRU-1177` + **password** `appe-admin-2026` | bruno.costa@acme.com | 140 |
|
||||
| **Rita Lopes** | staff (admin) | QR `CVV-RIT-9034` + **password** `appe-admin-2026` | rita.lopes@globant.com | 95 |
|
||||
| **APPE Admin** | staff (admin) | **password** `appe-admin-2026` | admin@appe.at | 0 |
|
||||
| Tomás Ribeiro | attendee | `CVV-TOM-5566` | tomas.ribeiro@dataprev.com | 88 |
|
||||
| Sofia Almeida | attendee | `CVV-SOF-2299` | sofia.almeida@loop.com | 76 |
|
||||
| Marco Chen | attendee | `CVV-MRC-7712` | marco.chen@deepmind.com | 70 |
|
||||
| Julia Santos | attendee | `CVV-JUL-3345` | julia.santos@ifood.com | 64 |
|
||||
| Pedro Nunes | attendee | `CVV-PED-8801` | pedro.nunes@microsoft.com | 58 |
|
||||
| Carla Mendes | attendee | `CVV-CAR-6623` | carla.mendes@quintoessencial.com | 52 |
|
||||
| Diego Ferreira | attendee | `CVV-DIE-4458` | diego.ferreira@stone.com | 35 |
|
||||
| Marina Costa | attendee | `CVV-MNA-2210` | marina.costa@olx.com | 28 |
|
||||
| Lucas Oliveira | attendee | `CVV-LUC-9987` | lucas.oliveira@usp.br | 15 |
|
||||
| Tomás Ribeiro | speaker | `CVV-TOM-5566` | tomas.ribeiro@dataprev.com | 88 |
|
||||
| Sofia Almeida | speaker | `CVV-SOF-2299` | sofia.almeida@loop.com | 76 |
|
||||
| Marco Chen | speaker | `CVV-MRC-7712` | marco.chen@deepmind.com | 70 |
|
||||
| Julia Santos | speaker | `CVV-JUL-3345` | julia.santos@ifood.com | 64 |
|
||||
| Pedro Nunes | speaker | `CVV-PED-8801` | pedro.nunes@microsoft.com | 58 |
|
||||
| Carla Mendes | speaker | `CVV-CAR-6623` | carla.mendes@quintoessencial.com | 52 |
|
||||
| Diego Ferreira | speaker | `CVV-DIE-4458` | diego.ferreira@stone.com | 35 |
|
||||
| Marina Costa | speaker | `CVV-MNA-2210` | marina.costa@olx.com | 28 |
|
||||
| Lucas Oliveira | speaker | `CVV-LUC-9987` | lucas.oliveira@usp.br | 15 |
|
||||
| Dr. Elena Vasquez | (external speaker) | — | elena.vasquez@keynote.com | — |
|
||||
|
||||
> **Speaker auto-promote:** every seeded attendee who speaks in a session is
|
||||
> typed `speaker` (the `session_speakers_speaker_promote` trigger promotes
|
||||
> `attendee` → `speaker` on insert, so the seed states the final type). Only
|
||||
> Bruno, Rita, and the APPE Admin are `staff` (the trigger never overrides an
|
||||
> explicit staff/sponsor ticket).
|
||||
>
|
||||
> **Staff passwords:** Bruno and Rita have `contacts.password = 'appe-admin-2026'`
|
||||
> so the Convivo **staff QR login** (QR + staff password) works out of the box.
|
||||
|
||||
> **Dr. Elena Vasquez** is an external keynote speaker: she has a `contacts` row
|
||||
> (and speaks in `session_speakers`) but **no registration, no QR token, and no
|
||||
> auth user**, so she can't log in — she only appears as a speaker on the agenda.
|
||||
@@ -101,8 +113,11 @@ Ana (`[email protected]`) is seeded with a coherent 40-point history:
|
||||
|
||||
1. Log in as **Ana** (attendee) → Home, Agenda, Leaderboard all populated.
|
||||
2. Scan **Marco** (`CVV-MRC-7712`) → send a connection request.
|
||||
3. Log in as **Bruno** (staff) → the Scan tab becomes **Check-in** → pick a
|
||||
session → scan **Carla** (`CVV-CAR-6623`) → she gets +10.
|
||||
3. Log in as **Bruno** (staff) → QR `CVV-BRU-1177` + staff password
|
||||
`appe-admin-2026` → the Scan tab becomes **Check-in** → pick a session → scan
|
||||
**Carla** (`CVV-CAR-6623`) → she gets +10. Flip the **check-in type toggle**
|
||||
to **Welcome check-in** and scan **Tomás** (`CVV-TOM-5566`) → he's marked
|
||||
present at the event (no points).
|
||||
4. Watch the **Leaderboard** update live (Realtime).
|
||||
5. Log in as **APPE Admin** (`[email protected]` / password `appe-admin-2026`) in the
|
||||
admin app → Dashboard, Contacts, Registrations, Sponsors, Schedule, Activity,
|
||||
|
||||
+19
-12
@@ -15,7 +15,7 @@ It runs on **port 3001** (Vite dev) or as the `convivo-admin` Docker container
|
||||
|---|---|
|
||||
| **Dashboard** | Active event card (name, dates, location, aggregates: avg feedback, #sessions, #speakers, #registrations, #checked-in) + top points + recent activity. |
|
||||
| **Contacts** | Table of all contacts (email, name, LinkedIn, visibility toggles, `is_admin`). Edit, toggle `is_admin`, set visibility, adjust points. (No QR token here — it lives on the registration.) |
|
||||
| **Registrations** | Per active event: list (contact, type, **QR token**, checked_in, points). Change type (enforces the sponsor rule), mark checked-in, **view + reset the QR token** (per registration). |
|
||||
| **Registrations** | Per active event: list (contact, type, **QR token**, checked_in, points). Change type (enforces the sponsor rule — a failed sponsor change opens an **in-place sponsor lookup** popup), mark checked-in, **view the QR token** (final — no reset). |
|
||||
| **Sponsors** | List (paid only visible to attendees; admin sees all). Add/edit (type, name, email, phone, paid, amount, **contact search-and-pick**). |
|
||||
| **Schedule** | Slots (with type) + sessions (with speakers 1:N via a **multi-select search dropdown**, material upload with a **submitted / not submitted** state, `average_feedback`, `ai_generated_feedback` + an **Evaluate** stub button). |
|
||||
| **Activity** | Tables of check-ins, connections, and feedback (per active event). |
|
||||
@@ -59,7 +59,7 @@ apps/admin/src/
|
||||
└─ views/
|
||||
├─ Dashboard.tsx # active event + aggregates + top points + activity
|
||||
├─ Contacts.tsx # table + edit / is_admin / visibility / points
|
||||
├─ Registrations.tsx# per-event list + type / QR token (+reset) / checked-in
|
||||
├─ Registrations.tsx# per-event list + type / QR token (view) / checked-in + sponsor lookup
|
||||
├─ Sponsors.tsx # sponsor CRUD
|
||||
├─ Schedule.tsx # slots + sessions + speakers + material + AI-evaluate
|
||||
├─ Activity.tsx # check-ins / connections / feedback tables
|
||||
@@ -79,22 +79,29 @@ key. Everything it can do is allowed by RLS:
|
||||
- **Writes** — direct `insert` / `update` / `delete` on `contacts`, `events`,
|
||||
`registrations`, `sponsors`, `slots`, `sessions`, and `session_speakers`
|
||||
(admin-only policies).
|
||||
- **RPCs** — `reset_registration_qr_token` (regenerate a registration's lanyard
|
||||
token), `adjust_points` (manual, audited as `admin`), `upsert_contact`,
|
||||
- **RPCs** — `adjust_points` (manual, audited as `admin`), `upsert_contact`,
|
||||
`create_registration`, `set_registration_type`, `evaluate_session_feedback`
|
||||
(AI stub), and `set_session_material` (attach uploaded material). See
|
||||
(AI stub), and `set_session_material` (attach uploaded material). The
|
||||
`reset_registration_qr_token` RPC still exists (used by the sync path) but the
|
||||
admin UI no longer exposes a token reset. See
|
||||
[../backend/rpcs.md](../backend/rpcs.md).
|
||||
|
||||
### Resetting a QR token
|
||||
### Viewing a QR token
|
||||
|
||||
The QR token lives on the **registration** (per event), not the contact. The
|
||||
**Registrations** view shows each registration's token and a **QR** button that
|
||||
opens a modal with the scannable code + a **Reset token** action. Reset calls
|
||||
`reset_registration_qr_token(contact_email)`, which generates a new
|
||||
`CVV-XXX-NNNN` token, writes it to `registrations.qr_token`, **re-hashes it as the
|
||||
Auth password** (so the old token stops working), and deletes the contact's
|
||||
existing sessions (forcing a re-login). The UI shows the new token as a scannable
|
||||
QR code.
|
||||
opens a modal with the scannable code. The token is **final** — it is generated by
|
||||
Pretix and can't be reset from the UI (the `reset_registration_qr_token` RPC still
|
||||
exists for the sync path, but the admin UI no longer exposes a reset action).
|
||||
|
||||
### Sponsor lookup (in-place)
|
||||
|
||||
Setting a registration's type to **Sponsor** requires a sponsor lookup. If none
|
||||
exists for that contact, the change fails with `a sponsor registration requires a
|
||||
sponsor lookup` and the UI opens an **in-place sponsor popup** (instead of just
|
||||
erroring). The popup lets the admin create the sponsor (type, name, email, phone,
|
||||
amount, paid) linked to that contact, then sets the registration type to
|
||||
`sponsor` in one step.
|
||||
|
||||
### Adjusting points
|
||||
|
||||
|
||||
@@ -50,10 +50,12 @@ These map 1:1 to the Postgres RPCs documented in
|
||||
| `createConnectionRequest(targetQr)` | `create_connection_request` | Send a connection request |
|
||||
| `acceptConnection(id)` | `accept_connection` | Accept (+5 to both) |
|
||||
| `rejectConnection(id)` | `reject_connection` | Decline |
|
||||
| `checkinAttendee(sessionId, attendeeQr)` | `checkin_attendee` | Staff check-in (+10) |
|
||||
| `checkinAttendee(sessionId, attendeeQr)` | `checkin_attendee` | Staff session check-in (+10) |
|
||||
| `welcomeCheckin(attendeeQr)` | `welcome_checkin` | Staff welcome check-in (marks present at event, no points) |
|
||||
| `submitFeedback(sessionId, rating, comment)` | `submit_feedback` | Rate a session (+5/+10) |
|
||||
| `getLeaderboard()` | `get_leaderboard` | Active-event leaderboard |
|
||||
| `uploadSessionMaterial(sessionId, file)` | `set_session_material` | Upload to `materials` bucket + set `material_path` |
|
||||
| `removeSessionMaterial(sessionId)` | `set_session_material` | Delete storage object + clear `material_path` (speakers) |
|
||||
| `updateMyProfile({linkedin_url, show_email, show_linkedin})` | `update_my_profile` | Self-service: set LinkedIn + visibility toggles on the caller's own contact |
|
||||
|
||||
### Direct table reads (RLS-scoped)
|
||||
|
||||
+28
-13
@@ -45,12 +45,15 @@ A 3-step flow: **splash → scan → confirm**.
|
||||
## Home
|
||||
|
||||
The landing screen. Shows:
|
||||
- **Greeting + points pill** — "Good morning, Ana 👋" and `⚡ {points}` (tapping
|
||||
the pill opens the Leaderboard). The event name (`event.name`) is shown under
|
||||
the greeting.
|
||||
- **Now card** — the session the user picked for the current slot, with a
|
||||
"✓ Checked in" or "Show your QR to staff to check in" pill.
|
||||
- **Next card** — the pick for the next slot.
|
||||
- **Greeting + pills** — "Good morning, Ana 👋" and, to the right, a **red
|
||||
material pill** `📎 {n}` (only for speakers who have one or more of their
|
||||
sessions without material — tapping it opens a popup listing the pending
|
||||
sessions) and the **points pill** `⚡ {points}` (tapping opens the Leaderboard).
|
||||
The event name (`event.name`) is shown under the greeting.
|
||||
- **Now card** — **always shown** for the current slot. If the user has a pick,
|
||||
the session title + a "✓ Checked in" / "Show your QR to staff to check in"
|
||||
pill; otherwise a "No pick yet" placeholder (identical layout for every role).
|
||||
- **Next card** — **always shown** for the next slot (pick or "No pick yet").
|
||||
- **My picks today** — shows only **2 rows** (the current slot's pick + the next
|
||||
slot's pick). "tap to change" is a **hyperlink** to the Agenda.
|
||||
- **Quick actions** — Scan & connect, Agenda, Connections, Leaderboard.
|
||||
@@ -58,11 +61,14 @@ The landing screen. Shows:
|
||||
Check back soon!").
|
||||
|
||||
> **Identical for every role.** The Home screen (and the tab bar) is the same for
|
||||
> attendees and staff — no role badge, no "Check-in" relabel. Staff keep their
|
||||
> check-in capability inside the **Scan** screen (Attendee/Staff mode toggle).
|
||||
> attendees and staff — no role badge, no "Check-in" relabel. The Now/Next cards
|
||||
> always render (with a "No pick yet" placeholder when there's no pick), so the
|
||||
> layout is identical whether or not the user has picks. Staff keep their check-in
|
||||
> capability inside the **Scan** screen (Attendee/Staff mode toggle).
|
||||
|
||||
Data: `useEvent()` (event + agenda + clock) + `getMyPreferences()` +
|
||||
`getMyCheckins(email)`. Slot status comes from `slotStatus(slot, now)`
|
||||
`getMyCheckins(email)` + `getMySpeakerSessions(email)` (for the pending-material
|
||||
pill). Slot status comes from `slotStatus(slot, now)`
|
||||
([app-structure.md#the-event-clock](./app-structure.md#the-event-clock)).
|
||||
|
||||
## Agenda
|
||||
@@ -84,6 +90,9 @@ user speaks shows a **"🎤 you"** tag; a session with material shows a **📎**
|
||||
notice is gone and a **📎 Download material** button appears (visible to **all**
|
||||
attendees), pinned to the **bottom** of the sheet's button stack (below
|
||||
"Pick this session").
|
||||
- **Remove material** — a speaker of the session can also **🗑 Remove material**
|
||||
(to re-upload). This deletes the storage object and clears `material_path` via
|
||||
`set_session_material` (null) — `removeSessionMaterial`.
|
||||
- Picking is "one per slot" — picking a new session in a slot replaces the old
|
||||
pick (enforced by the `set_preference` RPC).
|
||||
|
||||
@@ -101,10 +110,16 @@ is role-aware — staff (`contact.is_admin`) default to **Staff** mode, attendee
|
||||
"Connect with {name}?" sheet (with the peer's registration-type badge + LinkedIn
|
||||
link if visible) → `createConnectionRequest(qr)`. Guards: can't connect with
|
||||
yourself. Result toast reflects the connection status (sent / already connected).
|
||||
- **Staff mode (check-in):** pick a session (dropdown grouped by slot), then scan
|
||||
an attendee's lanyard → `checkinAttendee(sessionId, qr)`. Shows a result sheet:
|
||||
"✓ {name} — Checked in — +10 pts · now {total}" or "⚠️ Already checked in — no
|
||||
extra points" (the `already` flag from the RPC).
|
||||
- **Staff mode (check-in):** a **check-in type toggle** (uiverse switch) switches
|
||||
between two sub-modes:
|
||||
- **Session check-in** (default) — pick a session (dropdown grouped by slot),
|
||||
then scan an attendee's lanyard → `checkinAttendee(sessionId, qr)`. Shows a
|
||||
result sheet: "✓ {name} — Checked in — +10 pts · now {total}" or "⚠️ Already
|
||||
checked in — no extra points" (the `already` flag from the RPC).
|
||||
- **Welcome check-in** — no session dropdown; scanning an attendee's lanyard →
|
||||
`welcomeCheckin(qr)` marks them present at the **event**
|
||||
(`registrations.checked_in = true`, no points). Result sheet: "👋 {name} —
|
||||
Welcome to the event! — ✓ Checked in" (or "Already checked in to the event").
|
||||
|
||||
Data: `useEvent()` (for the session list) + the RPCs above.
|
||||
|
||||
|
||||
+58
-4
@@ -4,15 +4,21 @@ What's done, what's next, and the open decisions. The full roadmap lives in the
|
||||
root [`roadmap.md`](../roadmap.md); this file is the working detail for the
|
||||
current phase.
|
||||
|
||||
> **Current state:** Phases 0–8 are complete and verified, plus three polish
|
||||
> **Current state:** Phases 0–8 are complete and verified, plus five polish
|
||||
> rounds: **Fixes & Refinements** (QR token moved to the registration, role-pill
|
||||
> capitalization, connection detail sheet + red-dot recalc, admin schedule
|
||||
> speaker multi-select + upload/speaker bug fixes, sponsor contact search),
|
||||
> **Admin password + profile self-service** (admin logs in with email + password;
|
||||
> attendees set LinkedIn + visibility on their Profile), and **Staff exclusions
|
||||
> + password sync** (setting `contacts.password` auto-syncs the Auth password;
|
||||
> attendees set LinkedIn + visibility on their Profile), **Staff exclusions +
|
||||
> password sync** (setting `contacts.password` auto-syncs the Auth password;
|
||||
> staff excluded from the leaderboard; Home/Agenda/Profile identical for all
|
||||
> roles).
|
||||
> roles), **Convivo staff QR login** (a staff QR asks for the staff password, not
|
||||
> an email), and **Registration optionset + speaker promote + welcome check-in**
|
||||
> (`registrations.type` is now a Postgres enum; adding a speaker auto-promotes
|
||||
> their registration to `speaker`; staff can do a Welcome check-in that marks an
|
||||
> attendee present at the event; the admin QR token is final (no reset) and a
|
||||
> failed sponsor change opens an in-place sponsor lookup; speakers see a red
|
||||
> pending-material pill on Home and can delete their material to re-upload).
|
||||
> Remaining work is cross-cutting (real event clock, deployment, testing) and
|
||||
> the open questions in [backend/interfaces.md](./backend/interfaces.md).
|
||||
|
||||
@@ -304,6 +310,54 @@ browser-verified.
|
||||
- Agenda session sheet: **"Download material"** moved to the **bottom** of the
|
||||
button stack (below "Pick this session") with proper spacing.
|
||||
|
||||
## Registration optionset + speaker promote + welcome check-in — ✅ complete
|
||||
|
||||
Migration `20260829000000_registration_type_optionset_speaker_promote_welcome_checkin.sql`
|
||||
+ app changes, all browser-verified.
|
||||
|
||||
**`registrations.type` is now a Postgres ENUM** (`public.registration_type`).
|
||||
- The `text` column (with its old CHECK constraint + text default) is converted
|
||||
to the enum; the old CHECK and default are dropped first (they can't be
|
||||
auto-cast), then the enum default is set.
|
||||
- The admin RPCs (`create_registration`, `set_registration_type`) take `p_type
|
||||
text` and now cast it to the enum on write.
|
||||
|
||||
**Speaker auto-promote trigger.**
|
||||
- `session_speakers_speaker_promote` (after insert on `session_speakers`)
|
||||
promotes a contact's active-event registration from `attendee` → `speaker`.
|
||||
One-way (removing a speaker never demotes) and never overrides an explicit
|
||||
`staff`/`sponsor` ticket. The seed states the final types explicitly.
|
||||
|
||||
**Welcome check-in (staff).**
|
||||
- New `welcome_checkin(p_attendee_qr)` RPC (staff-only): resolves the attendee by
|
||||
QR for the active event and sets `registrations.checked_in = true` (no points).
|
||||
- The Convivo **Scan** screen's Staff mode has a **check-in type toggle**
|
||||
(uiverse switch) switching between **Session check-in** (existing dropdown +
|
||||
`checkin_attendee`) and **Welcome check-in** (`welcome_checkin`).
|
||||
|
||||
**Admin Registrations: final QR token + in-place sponsor lookup.**
|
||||
- The **Reset token** button is gone — the token is final (generated by Pretix).
|
||||
The QR modal now says "This token is final…".
|
||||
- Setting a type to **Sponsor** when no sponsor lookup exists opens an
|
||||
**in-place sponsor popup** (create the sponsor linked to the contact, then set
|
||||
the type) instead of just erroring.
|
||||
|
||||
**Convivo Home: always-on Now/Next + pending-material pill.**
|
||||
- The **Now** and **Next** cards always render (with a "No pick yet" placeholder
|
||||
when there's no pick), so the layout is identical for every role.
|
||||
- Speakers with one or more sessions missing material see a **red `📎 {n}` pill**
|
||||
(left of the points pill); tapping it opens a popup listing the pending
|
||||
sessions. The pill disappears once every session has material.
|
||||
|
||||
**Convivo Agenda: speakers can delete their material.**
|
||||
- A speaker of a session with material sees a **🗑 Remove material** button
|
||||
(deletes the storage object + clears `material_path` via `set_session_material`
|
||||
null) so they can re-upload.
|
||||
|
||||
**Seed: staff passwords.**
|
||||
- Bruno and Rita now have `contacts.password = 'appe-admin-2026'` so the Convivo
|
||||
**staff QR login** (QR + staff password) works out of the box after a reset.
|
||||
|
||||
## Cross-cutting / later
|
||||
|
||||
- **Real event clock** — replace the simulated `DEFAULT_NOW`
|
||||
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
-- =============================================================================
|
||||
-- Convivo — Registration type optionset + speaker auto-promote + welcome check-in
|
||||
--
|
||||
-- 1. `registrations.type` becomes a Postgres ENUM (`registration_type`) — a true
|
||||
-- optionset of the four ticket types, enforced at the database level.
|
||||
-- 2. A trigger auto-promotes a contact's registration from 'attendee' to
|
||||
-- 'speaker' when they're added to `session_speakers` (never overrides
|
||||
-- staff/sponsor — those are explicit ticket types).
|
||||
-- 3. New `welcome_checkin` RPC: staff scan an attendee's lanyard to mark them
|
||||
-- checked in to the EVENT (registrations.checked_in = true). Distinct from
|
||||
-- `checkin_attendee`, which checks someone into a specific session.
|
||||
-- =============================================================================
|
||||
|
||||
-- -----------------------------------------------------------------------------
|
||||
-- 1. REGISTRATION TYPE OPTIONSET (Postgres ENUM)
|
||||
-- -----------------------------------------------------------------------------
|
||||
do $$
|
||||
begin
|
||||
if not exists (select 1 from pg_type where typname = 'registration_type') then
|
||||
create type public.registration_type as enum ('attendee', 'speaker', 'staff', 'sponsor');
|
||||
end if;
|
||||
end $$;
|
||||
|
||||
-- Convert the column to the enum. Existing values ('attendee'/'speaker'/'staff'/
|
||||
-- 'sponsor') all map cleanly. The `type` column name is quoted to avoid any
|
||||
-- keyword ambiguity in the ALTER; the USING clause does the explicit text→enum
|
||||
-- cast (Postgres won't cast text to an enum implicitly). The old text CHECK
|
||||
-- constraint and text default can't be auto-cast, so drop both first, convert,
|
||||
-- then set the enum default.
|
||||
alter table public.registrations drop constraint if exists registrations_type_check;
|
||||
alter table public.registrations alter column "type" drop default;
|
||||
alter table public.registrations
|
||||
alter column "type" type public.registration_type using "type"::public.registration_type;
|
||||
alter table public.registrations
|
||||
alter column "type" set default 'attendee'::public.registration_type;
|
||||
|
||||
-- The admin RPCs take `p_type text` and write it to the (now enum) column.
|
||||
-- Re-create them with an explicit cast so the text param maps to the enum.
|
||||
create or replace function public.create_registration(p_contact_email text, p_type text)
|
||||
returns public.registrations
|
||||
language plpgsql security definer set search_path = public as $$
|
||||
declare
|
||||
v_email text := public.current_email();
|
||||
v_event_id uuid;
|
||||
v_reg public.registrations;
|
||||
begin
|
||||
if v_email is null then raise exception 'not authenticated'; end if;
|
||||
if not public.is_admin() then raise exception 'admin only'; end if;
|
||||
if not exists (select 1 from public.contacts where email = p_contact_email) then
|
||||
raise exception 'contact not found';
|
||||
end if;
|
||||
if p_type is null or p_type not in ('attendee', 'speaker', 'staff', 'sponsor') then
|
||||
raise exception 'invalid registration type';
|
||||
end if;
|
||||
select id into v_event_id from public.events where is_active limit 1;
|
||||
if v_event_id is null then raise exception 'no active event'; end if;
|
||||
if p_type = 'sponsor' and not exists (
|
||||
select 1 from public.sponsors where event_id = v_event_id and contact_email = p_contact_email
|
||||
) then
|
||||
raise exception 'a sponsor registration requires a sponsor lookup';
|
||||
end if;
|
||||
insert into public.registrations (event_id, contact_email, type)
|
||||
values (v_event_id, p_contact_email, p_type::public.registration_type)
|
||||
on conflict (event_id, contact_email) do update set type = excluded.type
|
||||
returning * into v_reg;
|
||||
return v_reg;
|
||||
end;
|
||||
$$;
|
||||
|
||||
create or replace function public.set_registration_type(p_contact_email text, p_type text)
|
||||
returns public.registrations
|
||||
language plpgsql security definer set search_path = public as $$
|
||||
declare
|
||||
v_email text := public.current_email();
|
||||
v_event_id uuid;
|
||||
v_reg public.registrations;
|
||||
begin
|
||||
if v_email is null then raise exception 'not authenticated'; end if;
|
||||
if not public.is_admin() then raise exception 'admin only'; end if;
|
||||
if p_type is null or p_type not in ('attendee', 'speaker', 'staff', 'sponsor') then
|
||||
raise exception 'invalid registration type';
|
||||
end if;
|
||||
select id into v_event_id from public.events where is_active limit 1;
|
||||
if v_event_id is null then raise exception 'no active event'; end if;
|
||||
if p_type = 'sponsor' and not exists (
|
||||
select 1 from public.sponsors where event_id = v_event_id and contact_email = p_contact_email
|
||||
) then
|
||||
raise exception 'a sponsor registration requires a sponsor lookup';
|
||||
end if;
|
||||
update public.registrations set type = p_type::public.registration_type
|
||||
where event_id = v_event_id and contact_email = p_contact_email
|
||||
returning * into v_reg;
|
||||
if not found then raise exception 'registration not found'; end if;
|
||||
return v_reg;
|
||||
end;
|
||||
$$;
|
||||
|
||||
-- -----------------------------------------------------------------------------
|
||||
-- 2. SPEAKER AUTO-PROMOTE TRIGGER
|
||||
-- -----------------------------------------------------------------------------
|
||||
-- When a contact is added as a speaker of a session, promote their active-event
|
||||
-- registration from 'attendee' to 'speaker'. This is one-way: removing a speaker
|
||||
-- never demotes them, and it never overrides an explicit staff/sponsor ticket.
|
||||
create or replace function public._trg_speaker_promote() returns trigger
|
||||
language plpgsql security definer set search_path = public as $$
|
||||
declare
|
||||
v_event_id uuid;
|
||||
begin
|
||||
if tg_op = 'INSERT' then
|
||||
select s.event_id into v_event_id
|
||||
from public.sessions s where s.id = new.session_id;
|
||||
if v_event_id is not null then
|
||||
update public.registrations
|
||||
set "type" = 'speaker'
|
||||
where event_id = v_event_id
|
||||
and contact_email = new.contact_email
|
||||
and "type" = 'attendee';
|
||||
end if;
|
||||
end if;
|
||||
return new;
|
||||
end;
|
||||
$$;
|
||||
|
||||
drop trigger if exists session_speakers_speaker_promote on public.session_speakers;
|
||||
create trigger session_speakers_speaker_promote
|
||||
after insert on public.session_speakers
|
||||
for each row execute function public._trg_speaker_promote();
|
||||
|
||||
-- -----------------------------------------------------------------------------
|
||||
-- 3. WELCOME CHECK-IN (staff marks an attendee present at the event)
|
||||
-- -----------------------------------------------------------------------------
|
||||
-- Resolves the scanned lanyard QR to the attendee's active-event registration and
|
||||
-- marks them checked in to the event. No points are awarded (that's the session
|
||||
-- check-in's job); this just records that the person is on site.
|
||||
create or replace function public.welcome_checkin(p_attendee_qr text)
|
||||
returns table (attendee_email text, attendee_name text, already boolean)
|
||||
language plpgsql security definer set search_path = public as $$
|
||||
declare
|
||||
v_staff text := public.current_email();
|
||||
v_attendee text;
|
||||
v_name text;
|
||||
v_event_id uuid;
|
||||
v_checked boolean;
|
||||
begin
|
||||
if v_staff is null then raise exception 'not authenticated'; end if;
|
||||
if not public.is_staff_or_admin() then raise exception 'staff or admin only'; end if;
|
||||
select id into v_event_id from public.events where is_active limit 1;
|
||||
if v_event_id is null then raise exception 'no active event'; end if;
|
||||
select r.contact_email, c.full_name into v_attendee, v_name
|
||||
from public.registrations r
|
||||
join public.contacts c on c.email = r.contact_email
|
||||
where r.qr_token = p_attendee_qr
|
||||
and r.event_id = v_event_id;
|
||||
if v_attendee is null then raise exception 'no attendee found for that QR code'; end if;
|
||||
select checked_in into v_checked
|
||||
from public.registrations
|
||||
where event_id = v_event_id and contact_email = v_attendee;
|
||||
update public.registrations set checked_in = true
|
||||
where event_id = v_event_id and contact_email = v_attendee;
|
||||
return query select v_attendee, v_name, coalesce(v_checked, false);
|
||||
end;
|
||||
$$;
|
||||
|
||||
grant execute on function public.welcome_checkin(text) to authenticated;
|
||||
+16
-12
@@ -58,8 +58,8 @@ on conflict (id) do nothing;
|
||||
-- Staff (Bruno/Rita) keep their QR token as the auth password for the attendee app.
|
||||
insert into public.contacts (email, full_name, linkedin_url, show_email, show_linkedin, is_admin, password) values
|
||||
('[email protected]', 'Ana Silva', 'https://linkedin.com/in/anasilva', true, true, false, null),
|
||||
('[email protected]', 'Bruno Costa', 'https://linkedin.com/in/brunocosta', false, true, true, null),
|
||||
('[email protected]', 'Rita Lopes', null, false, false, true, null),
|
||||
('[email protected]', 'Bruno Costa', 'https://linkedin.com/in/brunocosta', false, true, true, 'appe-admin-2026'),
|
||||
('[email protected]', 'Rita Lopes', null, false, false, true, 'appe-admin-2026'),
|
||||
('[email protected]','Tomás Ribeiro', null, false, false, false, null),
|
||||
('[email protected]', 'Sofia Almeida', null, false, false, false, null),
|
||||
('[email protected]', 'Marco Chen', null, false, false, false, null),
|
||||
@@ -85,19 +85,23 @@ on conflict (id) do nothing;
|
||||
-- (per event, generated by Pretix) and doubles as the auth password.
|
||||
-- Ana is checked in (has check-ins below).
|
||||
-- -----------------------------------------------------------------------------
|
||||
-- Note: everyone who speaks in a session is typed 'speaker' (the
|
||||
-- session_speakers_speaker_promote trigger auto-promotes 'attendee' → 'speaker'
|
||||
-- on insert, so the seed states the final type explicitly). Only Bruno, Rita and
|
||||
-- the admin are 'staff' (the trigger never overrides an explicit staff/sponsor).
|
||||
insert into public.registrations (event_id, contact_email, type, checked_in, points, qr_token) values
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', true, 40, 'CVV-ANA-4821'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'speaker', true, 40, 'CVV-ANA-4821'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'staff', false, 140, 'CVV-BRU-1177'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'staff', false, 95, 'CVV-RIT-9034'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]','attendee', false, 88, 'CVV-TOM-5566'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 76, 'CVV-SOF-2299'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 70, 'CVV-MRC-7712'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 64, 'CVV-JUL-3345'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 58, 'CVV-PED-8801'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 52, 'CVV-CAR-6623'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 35, 'CVV-DIE-4458'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 28, 'CVV-MNA-2210'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'attendee', false, 15, 'CVV-LUC-9987'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]','speaker', false, 88, 'CVV-TOM-5566'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'speaker', false, 76, 'CVV-SOF-2299'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'speaker', false, 70, 'CVV-MRC-7712'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'speaker', false, 64, 'CVV-JUL-3345'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'speaker', false, 58, 'CVV-PED-8801'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'speaker', false, 52, 'CVV-CAR-6623'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'speaker', false, 35, 'CVV-DIE-4458'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'speaker', false, 28, 'CVV-MNA-2210'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'speaker', false, 15, 'CVV-LUC-9987'),
|
||||
('eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', '[email protected]', 'staff', false, 0, 'CVV-ADM-0001')
|
||||
on conflict (event_id, contact_email) do nothing;
|
||||
|
||||
|
||||
Reference in new issue
Block a user