- docs/README.md: navigation hub - docs/architecture.md: system overview, tech stack, data flows, ports - docs/backend/: supabase-core, schema, rpcs, rls, seed, docker - docs/frontend/: app-structure, screens, api-client - docs/next-steps.md: Phase 2/3/4 plan + open decisions - Fix README demo-account emails to match the actual seed
63 lines
2.7 KiB
Markdown
63 lines
2.7 KiB
Markdown
# Frontend — Attendee PWA
|
|
|
|
The frontend is a **mobile-first single-page React app** (PWA) in
|
|
[`apps/convivo/`](../../apps/convivo/). It is the same app for attendees, staff,
|
|
and admins — the user's `role` changes what they see (e.g. the Scan tab becomes a
|
|
Check-in tab for staff).
|
|
|
|
| File | What it covers |
|
|
|---|---|
|
|
| [app-structure.md](./app-structure.md) | Entry, contexts, the event hook, the tab shell, the demo clock |
|
|
| [screens.md](./screens.md) | Every screen: Login, Home, Agenda, Scan/Check-in, Connections, Feedback, Leaderboard, Profile |
|
|
| [api-client.md](./api-client.md) | The typed API wrapper + how the app talks to Supabase (auth, REST, realtime) |
|
|
|
|
## 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** — `AuthContext` holds the Supabase session + the current `Profile`.
|
|
See [app-structure.md](./app-structure.md#authcontext).
|
|
- **Event data** — `useEvent()` loads the agenda once via the `get_agenda()` RPC
|
|
and exposes it grouped by slot plus the event clock. See
|
|
[app-structure.md](./app-structure.md#the-event-hook-useevent).
|
|
- **Per-screen data** — each screen fetches what it needs through the typed
|
|
[api client](./api-client.md) (e.g. Home fetches preferences + check-ins).
|
|
- **Live updates** — the Leaderboard subscribes to Realtime on the `leaderboard`
|
|
table. See [screens.md#leaderboard](./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](../backend/rls.md).
|