Phase 0 + 1: Dockerized Supabase core + attendee PWA
Phase 0 — Supabase core (Docker via CLI): - Schema: profiles, slots, sessions, preferences, connections, checkins, feedback, leaderboard (Realtime mirror), points_log - RLS on every table; transactional security-definer points RPCs - Seed: 6 slots, 18 sessions, 13 demo users (QR token as auth password) Phase 1 — Attendee web PWA (React + Vite + TS): - Login via QR token + email (GoTrue, no email sent) - Home, Agenda, Scan/Connect, staff Check-in, Feedback, live Leaderboard, Profile - Same-origin proxy to Supabase (Vite dev / nginx in Docker) - Docker: multi-stage build -> nginx sidecar on the Supabase network
This commit is contained in:
commit
37684ba116
45 files changed
+6922
No files matched your search
@@ -0,0 +1,47 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { getAgenda, groupAgenda } from './api';
|
||||
import { DEFAULT_NOW } from './time';
|
||||
import type { Session, Slot } from './types';
|
||||
|
||||
export interface EventData {
|
||||
slots: { slot: Slot; sessions: Session[] }[];
|
||||
sessionById: Map<string, Session>;
|
||||
slotById: Map<number, Slot>;
|
||||
now: Date;
|
||||
loading: boolean;
|
||||
error: string | null;
|
||||
}
|
||||
|
||||
/** Loads the agenda once and exposes it grouped by slot, plus the event clock. */
|
||||
export function useEvent(): EventData {
|
||||
const [slots, setSlots] = useState<{ slot: Slot; sessions: Session[] }[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
let active = true;
|
||||
(async () => {
|
||||
try {
|
||||
const rows = await getAgenda();
|
||||
if (!active) return;
|
||||
setSlots(groupAgenda(rows));
|
||||
} catch (e) {
|
||||
if (active) setError(e instanceof Error ? e.message : 'Failed to load agenda');
|
||||
} finally {
|
||||
if (active) setLoading(false);
|
||||
}
|
||||
})();
|
||||
return () => {
|
||||
active = false;
|
||||
};
|
||||
}, []);
|
||||
|
||||
const sessionById = new Map<string, Session>();
|
||||
const slotById = new Map<number, Slot>();
|
||||
for (const { slot, sessions } of slots) {
|
||||
slotById.set(slot.id, slot);
|
||||
for (const s of sessions) sessionById.set(s.id, s);
|
||||
}
|
||||
|
||||
return { slots, sessionById, slotById, now: DEFAULT_NOW, loading, error };
|
||||
}
|
||||
Reference in new issue
Block a user