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
@@ -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>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user