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
This commit is contained in:
1 parent
5adb5785aa
commit
22f5f1d317
64 files changed
+4593
-1371
No files matched your search
+13
-11
@@ -5,10 +5,10 @@ same-origin paths:
|
||||
|
||||
- **Attendee PWA** — a mobile-first single-page app in
|
||||
[`apps/convivo/`](../../apps/convivo/). 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).
|
||||
- **Admin console** — a desktop-first app in
|
||||
[`apps/admin/`](../../apps/admin/), guarded to the `admin` role. See
|
||||
admins — the user's `is_admin` flag changes what they see (e.g. the Scan tab
|
||||
becomes a Check-in tab for staff).
|
||||
- **Admin console (APPE Admin)** — a desktop-first app in
|
||||
[`apps/admin/`](../../apps/admin/), guarded to the `is_admin` flag. See
|
||||
[admin-app.md](./admin-app.md).
|
||||
|
||||
| File | What it covers |
|
||||
@@ -38,14 +38,15 @@ apps/convivo/src/
|
||||
├─ App.tsx # Providers + Shell (tab nav + Feedback takeover)
|
||||
├─ styles.css # All styling (ported from mockup/index.html)
|
||||
├─ context/
|
||||
│ ├─ AuthContext.tsx # session + profile + signOut
|
||||
│ ├─ AuthContext.tsx # session + contact + registration + 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
|
||||
│ ├─ useEvent.ts # loads the active event + agenda, exposes it grouped
|
||||
│ └─ usePolling.ts # 5s visibility-aware polling hook
|
||||
├─ components/
|
||||
│ └─ ui.tsx # Avatar, Spinner, Empty, Sheet, QrImage, Scanner
|
||||
└─ screens/
|
||||
@@ -55,15 +56,16 @@ apps/convivo/src/
|
||||
|
||||
## 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
|
||||
- **Auth** — `AuthContext` holds the Supabase session + the current `Contact`
|
||||
and `Registration`. See [app-structure.md](./app-structure.md#authcontext).
|
||||
- **Event data** — `useEvent()` loads the active event + agenda 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).
|
||||
table; Connections polls every 5s while the tab is visible (`usePolling`). 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).
|
||||
+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.
|
||||
+33
-18
@@ -25,7 +25,8 @@ export const supabase = createClient(url, anonKey, {
|
||||
user's identity comes from the session JWT, and RLS enforces access. See
|
||||
[../backend/rls.md](../backend/rls.md).
|
||||
- **Session persistence** — the session is stored in `localStorage` and
|
||||
auto-refreshed, so a reload keeps you logged in.
|
||||
auto-refreshed, so a reload keeps you logged in. The JWT expiry is **24h**
|
||||
(`jwt_expiry = 86400`), so a login lasts a full day.
|
||||
|
||||
## The typed wrapper (`lib/api.ts`)
|
||||
|
||||
@@ -40,9 +41,10 @@ These map 1:1 to the Postgres RPCs documented in
|
||||
|
||||
| Client function | RPC | Purpose |
|
||||
|---|---|---|
|
||||
| `lanyardLookup(qrToken)` | `lanyard_lookup` | Resolve a scanned QR to a public profile |
|
||||
| `getPublicProfiles()` | `get_public_profiles` | All public profiles (leaderboard, name lookups) |
|
||||
| `lanyardLookup(qrToken)` | `lanyard_lookup` | Resolve a scanned QR to a public contact + registration type |
|
||||
| `getPublicContacts()` | `get_public_contacts` | Active-event contact directory (names + types) |
|
||||
| `getAgenda()` | `get_agenda` | Slots + sessions (flat rows) |
|
||||
| `getActiveEvent()` | `get_active_event` | The active event row |
|
||||
| `setPreference(sessionId)` | `set_preference` | Pick a session for its slot |
|
||||
| `clearPreference(slotId)` | `clear_preference` | Remove a pick |
|
||||
| `createConnectionRequest(targetQr)` | `create_connection_request` | Send a connection request |
|
||||
@@ -50,32 +52,41 @@ These map 1:1 to the Postgres RPCs documented in
|
||||
| `rejectConnection(id)` | `reject_connection` | Decline |
|
||||
| `checkinAttendee(sessionId, attendeeQr)` | `checkin_attendee` | Staff check-in (+10) |
|
||||
| `submitFeedback(sessionId, rating, comment)` | `submit_feedback` | Rate a session (+5/+10) |
|
||||
| `getLeaderboard()` | `get_leaderboard` | Active-event leaderboard |
|
||||
| `uploadSessionMaterial(sessionId, file)` | `set_session_material` | Upload to `materials` bucket + set `material_path` |
|
||||
|
||||
### Direct table reads (RLS-scoped)
|
||||
|
||||
These read the caller's own rows (RLS returns only what the user may see):
|
||||
These read the caller's own rows (RLS returns only what the user may see). For an
|
||||
admin contact, RLS returns **all** rows, so the "my" reads filter by email
|
||||
client-side to avoid leaking other people's data:
|
||||
|
||||
| Client function | Table | Returns |
|
||||
|---|---|---|
|
||||
| `getMyContact(email)` | `contacts` | the caller's contact |
|
||||
| `getMyRegistration(email)` | `registrations` | the caller's registration (active event) |
|
||||
| `getMyPreferences()` | `preferences` | the caller's picks |
|
||||
| `getMyConnections()` | `connections` | connections the caller is in |
|
||||
| `getMyCheckins()` | `checkins` | the caller's checked-in session ids |
|
||||
| `getMyFeedback()` | `feedback` | the caller's feedback |
|
||||
| `getLeaderboard()` | `leaderboard` | all rows (public to authenticated) |
|
||||
| `getMyPointsLog()` | `points_log` | the caller's points history |
|
||||
| `getMyCheckins(email)` | `checkins` | the caller's checked-in session ids |
|
||||
| `getMyFeedback(email)` | `feedback` | the caller's feedback |
|
||||
| `getMyPointsLog(email)` | `points_log` | the caller's points history |
|
||||
| `getMySpeakerSessions(email)` | `session_speakers` | session ids the caller speaks |
|
||||
|
||||
### Helpers
|
||||
|
||||
- **`groupAgenda(rows)`** — turns the flat `get_agenda()` rows into
|
||||
`{ slot, sessions[] }[]` ordered by slot id. Used by `useEvent()`.
|
||||
- **`sessionMaterialUrl(path)`** — builds the public URL for a session material
|
||||
in the `materials` bucket.
|
||||
|
||||
## Types (`lib/types.ts`)
|
||||
|
||||
TypeScript interfaces mirroring the DB tables and RPC return shapes
|
||||
(`Profile`, `PublicProfile`, `Slot`, `Session`, `AgendaRow`, `Preference`,
|
||||
`Connection`, `Checkin`, `Feedback`, `LeaderboardRow`, `PointsLogRow`,
|
||||
`CheckinResult`, `FeedbackResult`). `PublicProfile` is the safe projection
|
||||
(no email / qr_token) returned by the public read functions.
|
||||
(`Contact`, `Registration`, `Event`, `Slot`, `Session`, `AgendaRow`,
|
||||
`Preference`, `Connection`, `Checkin`, `Feedback`, `LeaderboardRow`,
|
||||
`PointsLogRow`, `PublicContact`, `CheckinResult`, `FeedbackResult`).
|
||||
`PublicContact` is the safe projection (email + name + visibility-respected
|
||||
linkedin + registration type) returned by the public read functions.
|
||||
|
||||
## Error handling
|
||||
|
||||
@@ -83,11 +94,15 @@ TypeScript interfaces mirroring the DB tables and RPC return shapes
|
||||
- Screens catch errors and surface them via toasts
|
||||
(`useToast().toast(message, 'err')`). RPCs raise human-readable messages
|
||||
(e.g. "staff or admin only", "you must be checked in to this session to give
|
||||
feedback") — see [../backend/rpcs.md#error-handling](../backend/rpcs.md#error-handling).
|
||||
feedback", "not a speaker of this session") — see
|
||||
[../backend/rpcs.md#error-handling](../backend/rpcs.md#error-handling).
|
||||
|
||||
## Realtime
|
||||
## Realtime + polling
|
||||
|
||||
The only realtime subscription is on the `leaderboard` table (see
|
||||
[screens.md#leaderboard](./screens.md#leaderboard)). The `leaderboard` table is
|
||||
the Realtime source and is kept in sync transactionally by the RPCs — see
|
||||
[../backend/schema.md#leaderboard--realtime-mirror](../backend/schema.md#leaderboard--realtime-mirror).
|
||||
- **Realtime** — the only realtime subscription is on the `leaderboard` table
|
||||
(see [screens.md#leaderboard](./screens.md#leaderboard)). The `leaderboard`
|
||||
table is the Realtime source and is kept in sync transactionally by the RPCs —
|
||||
see [../backend/schema.md#leaderboard--realtime-mirror](../backend/schema.md#leaderboard--realtime-mirror).
|
||||
- **Polling** — Connections and the Shell's pending-connection red dot use
|
||||
`usePolling` (5s, visibility-aware) — see
|
||||
[app-structure.md#the-polling-hook-libusepollingts](./app-structure.md#the-polling-hook-libusepollingts).
|
||||
@@ -23,18 +23,22 @@ see [api-client.md](./api-client.md).
|
||||
|
||||
## AuthContext (`context/AuthContext.tsx`)
|
||||
|
||||
Holds the Supabase **session**, the current **`Profile`**, and a `loading` flag.
|
||||
Holds the Supabase **session**, the current **`Contact`**, the current
|
||||
**`Registration`**, and a `loading` flag.
|
||||
|
||||
- On mount, reads the persisted session (`supabase.auth.getSession()`) and loads
|
||||
the profile for that user id.
|
||||
the contact + registration for that user's email.
|
||||
- Subscribes to `onAuthStateChange` so login/logout anywhere updates the context.
|
||||
- `loadProfile(userId)` fetches `profiles` where `id = userId` (RLS returns only
|
||||
the caller's own row — see [../backend/rls.md](../backend/rls.md)).
|
||||
- Exposes: `session`, `user`, `profile`, `loading`, `refreshProfile()`, `signOut()`.
|
||||
- `loadContact(email)` fetches `contacts` where `email = email` (RLS returns only
|
||||
the caller's own row — see [../backend/rls.md](../backend/rls.md));
|
||||
`loadRegistration(email)` fetches the caller's `registrations` row for the
|
||||
active event.
|
||||
- Exposes: `session`, `user`, `contact`, `registration`, `loading`,
|
||||
`refresh()`, `signOut()`.
|
||||
|
||||
> The profile is the app's source of truth for the current user's `role` and
|
||||
> `points`. After any points-changing action, screens call `refreshProfile()` to
|
||||
> re-fetch.
|
||||
> The contact is the app's source of truth for the current user's `is_admin`
|
||||
> (staff powers) and `qr_token`; the registration holds the user's `type` and
|
||||
> `points`. After any points-changing action, screens re-fetch.
|
||||
|
||||
## ToastContext (`context/ToastContext.tsx`)
|
||||
|
||||
@@ -43,21 +47,24 @@ Used for login success, connection results, check-in results, and RPC errors.
|
||||
|
||||
## The event hook (`lib/useEvent.ts`)
|
||||
|
||||
Loads the agenda **once** and exposes it in a convenient shape:
|
||||
Loads the active event + agenda and exposes it in a convenient shape:
|
||||
|
||||
```ts
|
||||
interface EventData {
|
||||
event: Event | null; // the active event (name, dates, location)
|
||||
slots: { slot: Slot; sessions: Session[] }[]; // grouped, ordered by slot id
|
||||
sessionById: Map<string, Session>;
|
||||
slotById: Map<number, Slot>;
|
||||
now: Date; // the (simulated) event clock
|
||||
loading: boolean;
|
||||
error: string | null;
|
||||
reload: () => void; // re-fetch (e.g. after a material upload)
|
||||
}
|
||||
```
|
||||
|
||||
- Calls `getAgenda()` (the `get_agenda()` RPC) and groups the flat rows with
|
||||
`groupAgenda()` (see [api-client.md](./api-client.md)).
|
||||
`groupAgenda()` (see [api-client.md](./api-client.md)); also loads the active
|
||||
event via `getActiveEvent()`.
|
||||
- Every screen that needs the schedule calls `useEvent()` — the agenda is fetched
|
||||
per screen mount (cheap, and keeps each screen self-contained).
|
||||
|
||||
@@ -84,6 +91,13 @@ At `10:20`, **Slot 1 (09:00–09:45) is `done`** and **Slot 2 (10:00–10:45) is
|
||||
> clock just decides which slot is "live" for display. To use the real clock,
|
||||
> replace `DEFAULT_NOW` with `new Date()`.
|
||||
|
||||
## The polling hook (`lib/usePolling.ts`)
|
||||
|
||||
`usePolling(fn, ms, enabled)` runs `fn` every `ms` milliseconds, but **only while
|
||||
the tab is visible** (`document.visibilityState === 'visible'`), and re-runs
|
||||
immediately when the tab becomes visible again. No background polling. Used by
|
||||
the Connections screen (5s) and the Shell's pending-connection red dot (5s).
|
||||
|
||||
## The Shell (`App.tsx`)
|
||||
|
||||
The `Shell` is the navigation container. Render logic, in order:
|
||||
@@ -100,11 +114,11 @@ The `Shell` is the navigation container. Render logic, in order:
|
||||
| `home` | 🏠 Home | `Home` | default tab |
|
||||
| `agenda` | 📅 Agenda | `Agenda` | |
|
||||
| `scan` | 📷 **Scan** / **Check-in** | `Scan` | label is role-aware (below) |
|
||||
| `connections` | 🤝 Connect | `Connections` | |
|
||||
| `connections` | 🤝 Connect | `Connections` | red dot when there are pending incoming requests |
|
||||
| `profile` | 👤 Profile | `Profile` | |
|
||||
|
||||
- **Role-aware Scan tab:** if `profile.role` is `staff` or `admin`, the tab label
|
||||
is **"Check-in"** and the `Scan` screen defaults to staff mode. Otherwise it's
|
||||
- **Role-aware Scan tab:** if `contact.is_admin` is true, the tab label is
|
||||
**"Check-in"** and the `Scan` screen defaults to staff mode. Otherwise it's
|
||||
**"Scan"**.
|
||||
- **Leaderboard** is *not* a tab — it's reached from the Home points pill and the
|
||||
Home quick-actions. It renders as a tab in the shell but is opened via
|
||||
|
||||
+49
-34
@@ -4,7 +4,7 @@ Every screen in [`apps/convivo/src/screens/`](../../apps/convivo/src/screens/).
|
||||
All screens are mobile-first and use the shared UI components
|
||||
([app-structure.md#shared-ui-components](./app-structure.md#shared-ui-components)).
|
||||
Data comes from the typed [api client](./api-client.md); the current user comes
|
||||
from `useAuth()`.
|
||||
from `useAuth()` (`contact` + `registration`).
|
||||
|
||||
| Screen | File | Reach |
|
||||
|---|---|---|
|
||||
@@ -21,9 +21,10 @@ from `useAuth()`.
|
||||
|
||||
A 3-step flow: **splash → scan → confirm**.
|
||||
|
||||
1. **Splash** — "Convivo / Break the ice. Earn the points." Tap anywhere to continue.
|
||||
1. **Splash** — "APPE / Break the ice. Earn the points." Tap anywhere to continue.
|
||||
2. **Scan** — scan (or type) your lanyard QR. Calls `lanyardLookup(qrToken)` to
|
||||
resolve the attendee (pre-login, public). Shows the resolved name/company.
|
||||
resolve the contact (pre-login, public). Shows the resolved name + registration
|
||||
type badge.
|
||||
3. **Confirm** — enter the **email used to buy the ticket**, then
|
||||
`signInWithPassword({ email, password: qrToken })`. On success the
|
||||
`AuthContext` updates and the Shell renders the app. On mismatch, an error is
|
||||
@@ -37,41 +38,54 @@ A 3-step flow: **splash → scan → confirm**.
|
||||
|
||||
The landing screen. Shows:
|
||||
- **Greeting + points pill** — "Good morning, Ana 👋" and `⚡ {points}` (tapping
|
||||
the pill opens the Leaderboard).
|
||||
the pill opens the Leaderboard). The event name (`event.name`) is shown under
|
||||
the greeting.
|
||||
- **Now card** — the session the user picked for the current slot, with a
|
||||
"✓ Checked in" or "Show your QR to staff to check in" pill.
|
||||
- **Next card** — the pick for the next slot.
|
||||
- **My picks today** — the user's pick per slot (tap to change → opens Agenda).
|
||||
- **Quick actions** — Scan & connect, Agenda, Connections, Leaderboard.
|
||||
- **Quick actions** — Scan & connect / Check-in, Agenda, Connections, Leaderboard.
|
||||
- **No active event** — a graceful empty state ("No active event right now.
|
||||
Check back soon!").
|
||||
|
||||
Data: `useEvent()` (agenda + clock) + `getMyPreferences()` + `getMyCheckins()`.
|
||||
Slot status comes from `slotStatus(slot, now)` ([app-structure.md#the-event-clock](./app-structure.md#the-event-clock)).
|
||||
Data: `useEvent()` (event + agenda + clock) + `getMyPreferences()` +
|
||||
`getMyCheckins(email)`. Slot status comes from `slotStatus(slot, now)`
|
||||
([app-structure.md#the-event-clock](./app-structure.md#the-event-clock)).
|
||||
|
||||
## Agenda
|
||||
|
||||
Lists all 6 slots, each with its 3 sessions and a status pill (**Done / ● Live /
|
||||
Up next**). The user's pick per slot is highlighted (filled check).
|
||||
Lists all slots, each with its sessions, a **slot-type badge** (keynote / session
|
||||
/ lunch break / coffee break / close up), and a status pill (**Done / ● Live /
|
||||
Up next**). The user's pick per slot is highlighted (filled check). A session the
|
||||
user speaks shows a **"🎤 you"** tag; a session with material shows a **📎**.
|
||||
|
||||
- **Tap a session** → opens a bottom **sheet** with details (description, speaker,
|
||||
room, capacity, checked-in state) and actions:
|
||||
- **Tap a session** → opens a bottom **sheet** with details (description,
|
||||
speakers, room, capacity, checked-in state) and actions:
|
||||
- **Give feedback ⭐** — only when the session is *done* **and** the user is
|
||||
checked in. Opens the Feedback takeover (`openFeedback(sessionId)`).
|
||||
- **Pick / Remove my pick** — `setPreference(sessionId)` / `clearPreference(slotId)`.
|
||||
- **Speaker material** — if the user is a speaker of the session and no material
|
||||
is uploaded yet, a **non-dismissible** "📎 Upload your session material" notice
|
||||
with a file input. Uploading stores the file in the `materials` bucket and
|
||||
calls `set_session_material` (via `uploadSessionMaterial`). Once uploaded, the
|
||||
notice is gone and a **📎 Download material** link appears (visible to **all**
|
||||
attendees).
|
||||
- Picking is "one per slot" — picking a new session in a slot replaces the old
|
||||
pick (enforced by the `set_preference` RPC).
|
||||
|
||||
Data: `useEvent()` + `getMyPreferences()` + `getMyCheckins()`.
|
||||
Data: `useEvent()` + `getMyPreferences()` + `getMyCheckins(email)` +
|
||||
`getMySpeakerSessions(email)`.
|
||||
|
||||
## Scan / Check-in
|
||||
|
||||
One screen, two modes (segmented control: **Attendee / Staff**). The default mode
|
||||
and the tab label are role-aware: staff/admin default to **Staff** mode and the
|
||||
tab reads **Check-in**.
|
||||
and the tab label are role-aware: staff (`contact.is_admin`) default to **Staff**
|
||||
mode and the tab reads **Check-in**.
|
||||
|
||||
- **Attendee mode (connect):** scan a peer's lanyard → `lanyardLookup` → a
|
||||
"Connect with {name}?" sheet → `createConnectionRequest(qr)`. Guards: can't
|
||||
connect with yourself. Result toast reflects the connection status (sent /
|
||||
already connected).
|
||||
"Connect with {name}?" sheet (with the peer's registration-type badge + LinkedIn
|
||||
link if visible) → `createConnectionRequest(qr)`. Guards: can't connect with
|
||||
yourself. Result toast reflects the connection status (sent / already connected).
|
||||
- **Staff mode (check-in):** pick a session (dropdown grouped by slot), then scan
|
||||
an attendee's lanyard → `checkinAttendee(sessionId, qr)`. Shows a result sheet:
|
||||
"✓ {name} — Checked in — +10 pts · now {total}" or "⚠️ Already checked in — no
|
||||
@@ -83,13 +97,16 @@ Data: `useEvent()` (for the session list) + the RPCs above.
|
||||
|
||||
Two tabs: **My connections** and **Requests** (with a count badge).
|
||||
|
||||
- **My connections** — accepted connections (the other person's name/company).
|
||||
- **Requests** — incoming (`to_id = me`, pending) with **Accept / Decline**
|
||||
buttons (`acceptConnection` / `rejectConnection`), and outgoing (`from_id = me`,
|
||||
pending) shown as "Sent".
|
||||
- Accepting awards +5 to both (see [../backend/rpcs.md#accept_connectionp_connection_id--connections](../backend/rpcs.md#accept_connectionp_connection_id--connections)).
|
||||
- **My connections** — accepted connections (the other person's name +
|
||||
registration type).
|
||||
- **Requests** — incoming (`to_email = me`, pending) with **Accept / Decline**
|
||||
buttons (`acceptConnection` / `rejectConnection`), and outgoing (`from_email =
|
||||
me`, pending) shown as "Sent".
|
||||
- Accepting awards +5 to both (see
|
||||
[../backend/rpcs.md#accept_connectionp_connection_id--connections](../backend/rpcs.md#accept_connectionp_connection_id--connections)).
|
||||
- **Live-ish:** polls every 5s while the tab is visible (`usePolling`).
|
||||
|
||||
Data: `getMyConnections()` + `getPublicProfiles()` (to resolve names/companies).
|
||||
Data: `getMyConnections()` + `getPublicContacts()` (to resolve names + types).
|
||||
|
||||
## Feedback
|
||||
|
||||
@@ -97,13 +114,10 @@ A **full-screen takeover** (no tab bar), opened from the Agenda session sheet.
|
||||
|
||||
- Shows the session (slot · time · room · title).
|
||||
- **1–5 star** rating + optional comment ("bonus points for details").
|
||||
- If the user already rated this session, it pre-fills and the button reads
|
||||
**"Update feedback"** (the RPC updates without re-awarding points).
|
||||
- On submit: `submitFeedback(sessionId, rating, comment)` → `refreshProfile()` →
|
||||
a success card ("+N pts earned!" or "Feedback updated!").
|
||||
- On submit: `submitFeedback(sessionId, rating, comment)` → a success toast
|
||||
("+N pts ⭐").
|
||||
|
||||
Data: `useEvent()` (session/slot) + `getMyFeedback()` (to detect existing) +
|
||||
`submitFeedback`.
|
||||
Data: `useEvent()` (session/slot) + `submitFeedback`.
|
||||
|
||||
## Leaderboard
|
||||
|
||||
@@ -122,17 +136,18 @@ supabase.channel('leaderboard-live')
|
||||
.subscribe();
|
||||
```
|
||||
|
||||
Data: `getLeaderboard()` (initial + on each realtime event). The `leaderboard`
|
||||
table is kept in sync transactionally by the RPCs — see
|
||||
Data: `getLeaderboard()` (the `get_leaderboard()` RPC — initial + on each realtime
|
||||
event). The `leaderboard` table is kept in sync transactionally by the RPCs — see
|
||||
[../backend/schema.md#leaderboard--realtime-mirror](../backend/schema.md#leaderboard--realtime-mirror).
|
||||
|
||||
## Profile
|
||||
|
||||
- **Header** — avatar, name, company, role pill, points pill.
|
||||
- **My QR code** — renders `profile.qr_token` as a scannable QR (`QrImage`).
|
||||
- **Header** — avatar, name, email, registration-type pill, a **staff** pill when
|
||||
`contact.is_admin`, and a points pill.
|
||||
- **My QR code** — renders `contact.qr_token` as a scannable QR (`QrImage`).
|
||||
"Show this to staff for check-in and to peers to connect."
|
||||
- **Points breakdown** — sums `points_log` by category
|
||||
(Session check-ins / Connections / Feedback / Other) + Total.
|
||||
- **Log out** — `signOut()`.
|
||||
|
||||
Data: `useAuth()` (profile) + `getMyPointsLog()`.
|
||||
Data: `useAuth()` (contact + registration) + `getMyPointsLog(email)`.
|
||||
Reference in new issue
Block a user