A desktop-first React app for organizers, guarded to the admin role. Backend (supabase/migrations/20260823000000_admin_app.sql): - Admin-only SELECT policies on preferences, connections, feedback - reset_qr_token RPC: regenerates a lanyard token, re-hashes it as the Auth password (old token stops working), and clears the attendee's sessions to force re-login App (apps/admin, port 3001): - Login: same QR+email flow, but non-admin sessions are rejected - Dashboard: live stats + top points + recent activity - Attendees: search, edit name/company/role, reset QR, adjust points - Schedule: manage slots + sessions (create/edit/delete) - Activity: check-ins / connections / feedback tables - Same-origin proxy (Vite dev / nginx in Docker), same design tokens Docker + scripts: - convivo-admin service in docker-compose.yml (:3001) - admin:dev / admin:build root scripts - fixed db:reset script (supabase reset -> supabase db reset) Docs: new frontend/admin-app.md; updated architecture, rls, rpcs, docker, next-steps, and READMEs. Verified: build clean, all views + flows browser-tested, Docker build + proxy + login + admin guard confirmed. DB reset to clean seed.
3.1 KiB
3.1 KiB
Frontend
There are two React apps, both talking to the same Supabase core through same-origin paths:
- Attendee PWA — a mobile-first single-page app in
apps/convivo/. The same app for attendees, staff, and admins — the user'srolechanges what they see (e.g. the Scan tab becomes a Check-in tab for staff). - Admin console — a desktop-first app in
apps/admin/, guarded to theadminrole. See admin-app.md.
| File | What it covers |
|---|---|
| app-structure.md | Attendee app: entry, contexts, the event hook, the tab shell, the demo clock |
| screens.md | Attendee app: Login, Home, Agenda, Scan/Check-in, Connections, Feedback, Leaderboard, Profile |
| api-client.md | The typed API wrapper + how the app talks to Supabase (auth, REST, realtime) |
| admin-app.md | Admin console: views, the admin auth guard, QR reset, points, schedule |
Tech
| Concern | Choice |
|---|---|
| Framework | React 18 + TypeScript |
| Build | Vite 5 |
| Supabase client | @supabase/supabase-js |
| QR scan | html5-qrcode (camera) with manual-entry fallback |
| QR render | qrcode.react |
| Styling | Hand-rolled CSS ported from the mockup (src/styles.css) |
| PWA | public/manifest.webmanifest + icons |
Source layout
apps/convivo/src/
├─ main.tsx # ReactDOM entry
├─ App.tsx # Providers + Shell (tab nav + Feedback takeover)
├─ styles.css # All styling (ported from mockup/index.html)
├─ context/
│ ├─ AuthContext.tsx # session + profile + signOut
│ └─ ToastContext.tsx # transient toasts
├─ lib/
│ ├─ supabase.ts # createClient (same-origin)
│ ├─ api.ts # typed wrapper over rpc/from
│ ├─ types.ts # TS types mirroring the DB
│ ├─ time.ts # event clock + slot status + formatting
│ └─ useEvent.ts # loads the agenda once, exposes it grouped
├─ components/
│ └─ ui.tsx # Avatar, Spinner, Empty, Sheet, QrImage, Scanner
└─ screens/
├─ Login.tsx Home.tsx Agenda.tsx Scan.tsx
├─ Connections.tsx Feedback.tsx Leaderboard.tsx Profile.tsx
Data flow (high level)
- Auth —
AuthContextholds the Supabase session + the currentProfile. See app-structure.md. - Event data —
useEvent()loads the agenda once via theget_agenda()RPC and exposes it grouped by slot plus the event clock. See app-structure.md. - Per-screen data — each screen fetches what it needs through the typed api client (e.g. Home fetches preferences + check-ins).
- Live updates — the Leaderboard subscribes to Realtime on the
leaderboardtable. See screens.md#leaderboard.
The app only ever uses the anon key + the user's session JWT; all security is enforced by RLS in the database. See ../backend/rls.md.