Redesign Phases 3-6: multi-event model, APPE Admin, Convivo App behaviors, APPE branding
- Phase 3: new migration 20260824000000_redesign.sql (contacts/events/registrations/sponsors, slot types, session speakers + feedback/material), seed rewrite - Phase 4: APPE Admin rebrand + Contacts/Registrations/Sponsors/Schedule/Activity/Events views - Phase 5: Convivo App (24h login, 5s polling, QR type badge, red dot, speaker material) - Phase 6: APPE favicon + PWA icons for both apps - Docs: schema/rpcs/rls/seed/screens/api-client/admin-app/architecture/next-steps/README/roadmap updated
This commit is contained in:
1 parent
5adb5785aa
commit
22f5f1d317
64 files changed
+4593
-1371
No files matched your search
@@ -2,16 +2,17 @@ import { useEffect, useState } from 'react';
|
||||
import { useAuth } from '../context/AuthContext';
|
||||
import { useEvent } from '../lib/useEvent';
|
||||
import { checkinAttendee, createConnectionRequest, lanyardLookup } from '../lib/api';
|
||||
import type { CheckinResult, PublicProfile } from '../lib/types';
|
||||
import type { CheckinResult, PublicContact } from '../lib/types';
|
||||
import { Avatar, Scanner, Sheet, Spinner } from '../components/ui';
|
||||
import { useToast } from '../context/ToastContext';
|
||||
|
||||
export function Scan() {
|
||||
const { profile } = useAuth();
|
||||
const { contact } = useAuth();
|
||||
const { slots, loading } = useEvent();
|
||||
const [mode, setMode] = useState<'attendee' | 'staff'>(profile?.role === 'staff' || profile?.role === 'admin' ? 'staff' : 'attendee');
|
||||
const isStaff = !!contact?.is_admin;
|
||||
const [mode, setMode] = useState<'attendee' | 'staff'>(isStaff ? 'staff' : 'attendee');
|
||||
const [sessionId, setSessionId] = useState<string>('');
|
||||
const [connectTarget, setConnectTarget] = useState<{ profile: PublicProfile; qr: string } | null>(null);
|
||||
const [connectTarget, setConnectTarget] = useState<{ contact: PublicContact; qr: string } | null>(null);
|
||||
const [checkin, setCheckin] = useState<CheckinResult | null>(null);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const { toast } = useToast();
|
||||
@@ -23,7 +24,7 @@ export function Scan() {
|
||||
}
|
||||
}, [slots, sessionId]);
|
||||
|
||||
if (loading || !profile) {
|
||||
if (loading || !contact) {
|
||||
return (
|
||||
<section className="screen">
|
||||
<div className="center" style={{ flex: 1 }}>
|
||||
@@ -33,13 +34,13 @@ export function Scan() {
|
||||
);
|
||||
}
|
||||
|
||||
const isStaff = mode === 'staff' && (profile.role === 'staff' || profile.role === 'admin');
|
||||
const meId = profile.id;
|
||||
const meEmail = contact.email;
|
||||
const activeStaff = mode === 'staff' && isStaff;
|
||||
|
||||
async function handleScan(token: string) {
|
||||
setBusy(true);
|
||||
try {
|
||||
if (isStaff) {
|
||||
if (activeStaff) {
|
||||
if (!sessionId) {
|
||||
toast('Pick a session first', 'err');
|
||||
return;
|
||||
@@ -52,11 +53,11 @@ export function Scan() {
|
||||
toast('No attendee found for that code', 'err');
|
||||
return;
|
||||
}
|
||||
if (found.id === meId) {
|
||||
if (found.email === meEmail) {
|
||||
toast('That’s your own lanyard 🙂', 'err');
|
||||
return;
|
||||
}
|
||||
setConnectTarget({ profile: found, qr: token });
|
||||
setConnectTarget({ contact: found, qr: token });
|
||||
}
|
||||
} catch (e) {
|
||||
toast(e instanceof Error ? e.message : 'Something went wrong', 'err');
|
||||
@@ -87,16 +88,18 @@ export function Scan() {
|
||||
<section className="screen">
|
||||
<div className="row between">
|
||||
<div>
|
||||
<div className="h1">{isStaff ? 'Check-in' : 'Scan'}</div>
|
||||
<div className="muted small">{isStaff ? 'Scan attendees to check them in' : 'Scan a peer’s lanyard to connect'}</div>
|
||||
</div>
|
||||
<div className="seg" style={{ width: 170 }}>
|
||||
<button className={mode === 'attendee' ? 'active' : ''} onClick={() => setMode('attendee')}>Attendee</button>
|
||||
<button className={mode === 'staff' ? 'active' : ''} onClick={() => setMode('staff')}>Staff</button>
|
||||
<div className="h1">{activeStaff ? 'Check-in' : 'Scan'}</div>
|
||||
<div className="muted small">{activeStaff ? 'Scan attendees to check them in' : 'Scan a peer’s lanyard to connect'}</div>
|
||||
</div>
|
||||
{isStaff && (
|
||||
<div className="seg" style={{ width: 170 }}>
|
||||
<button className={mode === 'attendee' ? 'active' : ''} onClick={() => setMode('attendee')}>Attendee</button>
|
||||
<button className={mode === 'staff' ? 'active' : ''} onClick={() => setMode('staff')}>Staff</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{isStaff && (
|
||||
{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)}>
|
||||
@@ -111,9 +114,9 @@ export function Scan() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<Scanner onResult={handleScan} label={isStaff ? 'Point at an attendee’s lanyard' : 'Point at a peer’s lanyard'} />
|
||||
<Scanner onResult={handleScan} label={activeStaff ? 'Point at an attendee’s lanyard' : 'Point at a peer’s lanyard'} />
|
||||
{busy && <div className="center"><Spinner /></div>}
|
||||
{isStaff && selSession && (
|
||||
{activeStaff && selSession && (
|
||||
<div className="muted small" style={{ textAlign: 'center', opacity: 0.6 }}>
|
||||
{selSession.room} · {selSession.speakers}
|
||||
</div>
|
||||
@@ -123,9 +126,18 @@ export function Scan() {
|
||||
<Sheet open={!!connectTarget} onClose={() => setConnectTarget(null)}>
|
||||
{connectTarget && (
|
||||
<div style={{ textAlign: 'center' }}>
|
||||
<Avatar name={connectTarget.profile.full_name} id={connectTarget.profile.id} size={72} fs={26} />
|
||||
<h3 style={{ marginTop: 12 }}>{connectTarget.profile.full_name}</h3>
|
||||
<div className="sub">{connectTarget.profile.company ?? ''}</div>
|
||||
<Avatar name={connectTarget.contact.full_name} id={connectTarget.contact.email} size={72} fs={26} />
|
||||
<h3 style={{ marginTop: 12 }}>{connectTarget.contact.full_name}</h3>
|
||||
{connectTarget.contact.registration_type && (
|
||||
<span className={`pill reg-${connectTarget.contact.registration_type}`} style={{ marginTop: 8 }}>
|
||||
{connectTarget.contact.registration_type.replace('_', ' ')}
|
||||
</span>
|
||||
)}
|
||||
{connectTarget.contact.linkedin_url && (
|
||||
<div className="sub" style={{ marginTop: 6 }}>
|
||||
<a href={connectTarget.contact.linkedin_url} target="_blank" rel="noreferrer">LinkedIn</a>
|
||||
</div>
|
||||
)}
|
||||
<div style={{ marginTop: 16 }}>
|
||||
<button className="btn primary" disabled={busy} onClick={confirmConnect}>
|
||||
{busy ? 'Sending…' : 'Connect 🤝'}
|
||||
|
||||
Reference in new issue
Block a user