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 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:
1 parent
2f53d47578
commit
7605c9bbf4
64 files changed
+4593
-1371
No files matched your search
+52
-33
@@ -1,9 +1,10 @@
|
||||
# Frontend — Admin console
|
||||
# Frontend — APPE Admin
|
||||
|
||||
The admin console is a **desktop-first single-page React app** in
|
||||
[`apps/admin/`](../../apps/admin/). It is a separate app from the attendee PWA
|
||||
(same stack, same Supabase core, same same-origin proxy pattern) and is **guarded
|
||||
to the `admin` role** — anyone else who signs in is immediately signed out.
|
||||
[`apps/admin/`](../../apps/admin/), branded **APPE Admin**. It is a separate app
|
||||
from the attendee PWA (same stack, same Supabase core, same same-origin proxy
|
||||
pattern) and is **guarded to the `is_admin` flag** — anyone else who signs in is
|
||||
immediately signed out.
|
||||
|
||||
It runs on **port 3001** (Vite dev) or as the `convivo-admin` Docker container
|
||||
(nginx). The attendee app stays on 3000.
|
||||
@@ -12,18 +13,21 @@ It runs on **port 3001** (Vite dev) or as the `convivo-admin` Docker container
|
||||
|
||||
| View | Purpose |
|
||||
|---|---|
|
||||
| **Dashboard** | Live event stats (attendees, check-ins, connections, avg rating, sessions) + top points + recent activity. |
|
||||
| **Attendees** | Searchable table of all people. Edit name/company/role, view + **reset the QR token**, and **adjust points**. |
|
||||
| **Schedule** | Manage **slots** and **sessions** — create, edit, delete. |
|
||||
| **Activity** | Tables of check-ins, connections, and feedback. |
|
||||
| **Dashboard** | Active event card (name, dates, location, aggregates: avg feedback, #sessions, #speakers, #registrations, #checked-in) + top points + recent activity. |
|
||||
| **Contacts** | Table of all contacts (email, name, LinkedIn, visibility toggles, `is_admin`, QR token). Edit, **reset the QR token**, toggle `is_admin`, set visibility. |
|
||||
| **Registrations** | Per active event: list (contact, type, checked_in). Change type (enforces the sponsor rule), mark checked-in. |
|
||||
| **Sponsors** | List (paid only visible to attendees; admin sees all). Add/edit (type, name, email, phone, paid, amount, contact lookup). |
|
||||
| **Schedule** | Slots (with type) + sessions (with speakers 1:N, material upload, `average_feedback`, `ai_generated_feedback` + an **Evaluate** stub button). |
|
||||
| **Activity** | Tables of check-ins, connections, and feedback (per active event). |
|
||||
| **Events** | Create event, set active (only one), edit dates/location. |
|
||||
|
||||
## Auth guard
|
||||
|
||||
Login is the same QR + email flow as the attendee app
|
||||
(`signInWithPassword({ email, password: qrToken })`), but `AuthContext` checks the
|
||||
profile's `role` after signing in:
|
||||
contact's `is_admin` flag after signing in:
|
||||
|
||||
- If `role === 'admin'` → the session is accepted and the console is shown.
|
||||
- If `is_admin === true` → the session is accepted and the console is shown.
|
||||
- Otherwise → the app calls `signOut()` and shows **"This account is not an
|
||||
admin."** The same check runs on session restore (page reload) and on every
|
||||
`onAuthStateChange`, so a non-admin can never see the console.
|
||||
@@ -38,21 +42,24 @@ apps/admin/src/
|
||||
├─ App.tsx # Providers + Shell (sidebar nav + view switch)
|
||||
├─ styles.css # Desktop-first styling (same design tokens as the PWA)
|
||||
├─ context/
|
||||
│ ├─ AuthContext.tsx # session + profile + admin-role guard
|
||||
│ ├─ AuthContext.tsx # session + contact + is_admin guard
|
||||
│ └─ ToastContext.tsx # transient toasts
|
||||
├─ lib/
|
||||
│ ├─ supabase.ts # createClient (same-origin)
|
||||
│ ├─ api.ts # typed wrapper: reads + updateProfile / adjustPoints / resetQrToken
|
||||
│ ├─ api.ts # typed wrapper: reads + writes (contacts, registrations, sponsors, schedule, points)
|
||||
│ └─ types.ts # TS types mirroring the DB
|
||||
├─ components/
|
||||
│ └─ ui.tsx # Avatar, Spinner, Empty, Modal, QrImage, RoleBadge
|
||||
│ └─ ui.tsx # Avatar, Spinner, Empty, Modal, QrImage, TypeBadge, Toggle
|
||||
├─ screens/
|
||||
│ └─ Login.tsx # QR + email login (admin-only)
|
||||
└─ views/
|
||||
├─ Dashboard.tsx # stats + top points + recent activity
|
||||
├─ Attendees.tsx # table + edit / QR-reset / points modals
|
||||
├─ Schedule.tsx # slots + sessions CRUD
|
||||
└─ Activity.tsx # check-ins / connections / feedback tables
|
||||
├─ Dashboard.tsx # active event + aggregates + top points + activity
|
||||
├─ Contacts.tsx # table + edit / QR-reset / is_admin / visibility
|
||||
├─ Registrations.tsx# per-event list + type / checked-in
|
||||
├─ Sponsors.tsx # sponsor CRUD
|
||||
├─ Schedule.tsx # slots + sessions + speakers + material + AI-evaluate
|
||||
├─ Activity.tsx # check-ins / connections / feedback tables
|
||||
└─ Events.tsx # event management
|
||||
```
|
||||
|
||||
## Data access
|
||||
@@ -60,31 +67,43 @@ apps/admin/src/
|
||||
The admin app uses the **anon key + the admin's session JWT** — no service-role
|
||||
key. Everything it can do is allowed by RLS:
|
||||
|
||||
- **Reads** — admin-only `select` policies on `profiles`, `connections`,
|
||||
`feedback`, `preferences`, `checkins`, `points_log`, plus the public
|
||||
`slots` / `sessions` / `leaderboard`. See [../backend/rls.md](../backend/rls.md).
|
||||
- **Writes** — direct `insert` / `update` / `delete` on `profiles`, `slots`, and
|
||||
`sessions` (admin-only policies).
|
||||
- **RPCs** — `reset_qr_token` (regenerate a lanyard token) and `adjust_points`
|
||||
(manual, audited as `admin`). See [../backend/rpcs.md](../backend/rpcs.md).
|
||||
- **Reads** — admin-only `select` policies on `contacts`, `registrations`,
|
||||
`sponsors`, `connections`, `feedback`, `checkins`, `points_log`, plus the public
|
||||
`events` / `slots` / `sessions` / `session_speakers` / `leaderboard`. See
|
||||
[../backend/rls.md](../backend/rls.md).
|
||||
- **Writes** — direct `insert` / `update` / `delete` on `contacts`, `events`,
|
||||
`registrations`, `sponsors`, `slots`, `sessions`, and `session_speakers`
|
||||
(admin-only policies).
|
||||
- **RPCs** — `reset_qr_token` (regenerate a lanyard token), `adjust_points`
|
||||
(manual, audited as `admin`), `upsert_contact`, `create_registration`,
|
||||
`set_registration_type`, `evaluate_session_feedback` (AI stub), and
|
||||
`set_session_material` (attach uploaded material). See
|
||||
[../backend/rpcs.md](../backend/rpcs.md).
|
||||
|
||||
### Resetting a QR token
|
||||
|
||||
`reset_qr_token(profile_id)` generates a new `CVV-XXX-NNNN` token, writes it to
|
||||
`profiles.qr_token`, **re-hashes it as the Auth password** (so the old token stops
|
||||
working), and deletes the attendee's existing sessions (forcing a re-login). The
|
||||
UI shows the new token as a scannable QR code.
|
||||
`reset_qr_token(contact_email)` generates a new `CVV-XXX-NNNN` token, writes it to
|
||||
`contacts.qr_token`, **re-hashes it as the Auth password** (so the old token stops
|
||||
working), and deletes the contact's existing sessions (forcing a re-login). The UI
|
||||
shows the new token as a scannable QR code.
|
||||
|
||||
### Adjusting points
|
||||
|
||||
`adjust_points(profile_id, delta, reason)` is the same transactional RPC the
|
||||
`adjust_points(contact_email, delta, reason)` is the same transactional RPC the
|
||||
event uses, but the `category` is `admin` so manual adjustments are auditable in
|
||||
`points_log`. It keeps `profiles.points` and the `leaderboard` mirror in sync.
|
||||
`points_log`. It keeps `registrations.points` and the `leaderboard` mirror in sync.
|
||||
|
||||
### Session material
|
||||
|
||||
The Schedule view uploads a session's material to the `materials` bucket and sets
|
||||
`sessions.material_path` (admins can write `sessions` directly). The **Evaluate**
|
||||
button calls `evaluate_session_feedback` (the AI stub) to set
|
||||
`ai_generated_feedback`.
|
||||
|
||||
## Styling
|
||||
|
||||
The admin app reuses the attendee app's **design tokens** (colors, Poppins font,
|
||||
card/pill/button styles) but is laid out **desktop-first**: a dark sidebar with
|
||||
the nav + admin identity, and a wide content area with stat cards and data
|
||||
tables. Below ~760px the sidebar collapses to a top bar so it still works on a
|
||||
phone.
|
||||
the **APPE / Admin** brand + nav + admin identity, and a wide content area with
|
||||
stat cards and data tables. Below ~760px the sidebar collapses to a top bar so it
|
||||
still works on a phone.
|
||||
Reference in new issue
Block a user