Check-in gate + fixes, RPC test suite, docs

- Convivo: not-checked-in gate for non-staff (see-a-staff screen with QR
  code + logout); lifts automatically once staff checks them in
- Convivo: fix check-in 'pick a session first' race (synchronous default
  session fallback)
- Add RPC test suite (npm run test:rpc): points idempotency, role guards,
  service-session guard, speaker auto-promote, leaderboard staff exclusion
- Fix db:types script (create packages/shared/src); gitignore generated types
- Docs: README/roadmap drift fixes, tests.md, backend README link

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-09-08 21:05:34 +02:00
1 parent fcbc19b8fc
commit b08a439949
11 files changed
+559 -38

No files matched your search

+45 -2
View File
@@ -9,7 +9,7 @@ import { Connections } from './screens/Connections';
import { Leaderboard } from './screens/Leaderboard';
import { Profile } from './screens/Profile';
import { Feedback } from './screens/Feedback';
import { Spinner } from './components/ui';
import { QrImage, Spinner } from './components/ui';
import { getMyConnections } from './lib/api';
import { usePolling } from './lib/usePolling';
@@ -23,7 +23,7 @@ const TABS: { id: Tab; ico: string; label: string }[] = [
];
function Shell() {
const { session, contact, loading } = useAuth();
const { session, contact, registration, loading, refresh, signOut } = useAuth();
const [tab, setTab] = useState<Tab>('home');
const [feedbackSession, setFeedbackSession] = useState<string | null>(null);
const [pendingIncoming, setPendingIncoming] = useState(0);
@@ -46,6 +46,13 @@ function Shell() {
// Keep the Connect red-dot fresh: poll every 5s while visible.
usePolling(() => void loadPending(), 5000, !!email);
// Gate: a non-staff member must be checked in by staff before using the app.
// (Staff are never gated — they're the ones doing the checking in.)
const isGated = !!contact && !contact.is_admin && !registration?.checked_in;
// While gated, poll so the gate lifts as soon as staff checks them in.
usePolling(() => { if (isGated) void refresh(); }, 4000, isGated);
// Recalc immediately when a connection is accepted/declined/sent.
useEffect(() => {
const onChanged = () => void loadPending();
@@ -71,6 +78,42 @@ function Shell() {
);
}
// Not checked in yet: a non-staff member must be checked in by staff before
// they can use the app. The gate lifts automatically (4s poll) once staff
// checks them in.
if (isGated) {
return (
<div className="app">
<div className="center" style={{ flex: 1, flexDirection: 'column', gap: 14, padding: 24, textAlign: 'center' }}>
<div style={{ fontSize: 56 }}>🏷️</div>
<div className="h1" style={{ textAlign: 'center' }}>Please see a staff member</div>
<div className="muted" style={{ textAlign: 'center', maxWidth: 320 }}>
You haven’t been checked in yet. Find a staff member and have them
scan your lanyard to get checked in — then you can start using the app.
</div>
{registration?.qr_token && (
<div className="card qr-wrap" style={{ marginTop: 4 }}>
<div className="h2" style={{ textAlign: 'center' }}>Your QR code</div>
<QrImage value={registration.qr_token} size={180} />
<div className="muted small" style={{ textAlign: 'center' }}>
Show this to <b>staff</b> to get checked in.
</div>
</div>
)}
<div className="muted small" style={{ opacity: 0.6 }}>
Checking in… this screen updates automatically.
</div>
<button className="btn ghost" onClick={() => void refresh()}>
I’ve been checked in — refresh
</button>
<button className="btn ghost" onClick={() => void signOut()}>
Log out
</button>
</div>
</div>
);
}
// Feedback is a full-screen takeover (no tab bar).
if (feedbackSession) {
return (