Files
Convivo/docs/frontend/screens.md
T
Lago 4abdc7691b docs: add /docs living documentation per AGENT.MD
- 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
2026-08-22 17:10:50 +02:00

139 lines
6.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Screens
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()`.
| Screen | File | Reach |
|---|---|---|
| Login | `Login.tsx` | shown when not authenticated |
| Home | `Home.tsx` | tab (default) |
| Agenda | `Agenda.tsx` | tab |
| Scan / Check-in | `Scan.tsx` | tab (role-aware label) |
| Connections | `Connections.tsx` | tab |
| Profile | `Profile.tsx` | tab |
| Leaderboard | `Leaderboard.tsx` | from Home (points pill / quick action) |
| Feedback | `Feedback.tsx` | full-screen takeover from Agenda |
## Login
A 3-step flow: **splash → scan → confirm**.
1. **Splash** — "Convivo / 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.
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
shown ("Email and QR code do not match").
> This is the QR + email login — no email is ever sent. See
> [../architecture.md#6-authentication-model](../architecture.md#6-authentication-model)
> and [../backend/rls.md](../backend/rls.md).
## Home
The landing screen. Shows:
- **Greeting + points pill** — "Good morning, Ana 👋" and `⚡ {points}` (tapping
the pill opens the Leaderboard).
- **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.
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)).
## 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).
- **Tap a session** → opens a bottom **sheet** with details (description, speaker,
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)`.
- 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()`.
## 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**.
- **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).
- **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
extra points" (the `already` flag from the RPC).
Data: `useEvent()` (for the session list) + the RPCs above.
## Connections
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)).
Data: `getMyConnections()` + `getPublicProfiles()` (to resolve names/companies).
## Feedback
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!").
Data: `useEvent()` (session/slot) + `getMyFeedback()` (to detect existing) +
`submitFeedback`.
## Leaderboard
The live leaderboard.
- **Podium** for the top 3 (1st/2nd/3rd bars), then the rest as ranked rows.
- **Your row is highlighted** (`me`).
- **Live:** subscribes to Realtime `postgres_changes` on the `leaderboard` table
and re-fetches on any change — so it updates the moment points change anywhere.
```ts
supabase.channel('leaderboard-live')
.on('postgres_changes', { event: '*', schema: 'public', table: 'leaderboard' }, () => {
getLeaderboard().then(setRows);
})
.subscribe();
```
Data: `getLeaderboard()` (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`).
"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()`.