Files
Convivo/docs/frontend/admin-app.md
T
23af4f3930 fix(admin): clamp tooltips into the viewport
The portal kept cards out of table overflow but nothing kept them on screen:
centred on a fixed-width card, any trigger near an edge lost text -- reported
on Sessions' right-aligned Generate button. The shared Tooltip now measures the
card, clamps it to the viewport, flips below when there is no room above, and
keeps the arrow aimed at the trigger. No more CSS centreing transform, JS owns
the coordinates.

New tooltip-containment.spec.ts (4 tests) asserts the measured rectangle, no
document widening and arrow alignment at wide/narrow/short viewports; verified
it catches the bug by reverting the fix (3 of 4 fail). Full serial e2e: 211
passed, 0 failed.

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]>
2026-10-19 21:19:30 +02:00

460 lines
33 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.
# Frontend — APPE Admin
The admin console is a **desktop-first single-page React app** in
[`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). Its admin gate accepts an existing contact with **`is_admin = true`
or an `@appe.at` email**, matching the database admin rule; other accounts are
signed out. Backend RLS remains the authorization boundary.
It runs on **port 3001** (Vite dev) or as the `convivo-admin` Docker container
(nginx). The attendee app stays on 3000.
## What it does
| View | Purpose |
|---|---|
| **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`). Edit, toggle `is_admin`, set visibility, adjust points. (No QR token here — it lives on the registration.) A general search matches **first name, last name or email address**; the **LinkedIn**, **Visibility** and **Admin** columns each have an Excel-style **multi-select filter** with live counts. |
| **Registrations** | Per active event: list (contact, type, **QR token**, checked_in, points). Change type (enforces the sponsor rule — a failed sponsor change opens an **in-place sponsor lookup** popup), mark checked-in, **view the QR token** (final — no reset), and **preview the attendee's badge** (renders the event's badge layout with that row's own name / ticket type / QR token / company), plus a **Print** button that queues the badge on the print station ([../backend/printing.md](../backend/printing.md)). When the event has **no badge configured**, the Badge button stays visible but **grayed out**, and hovering it shows a tooltip explaining a badge must be designed first. A general search matches **first name, last name, email address or type**; the **Type**, **QR token** (ticket) and **Checked in** columns each have an Excel-style **multi-select filter** with live counts. The **checked-in toggle is per-row and optimistic**: it patches that one row (and its points) in place — **no list reload**, so rows never jump or vanish mid-edit (the list is sorted by points) — while a small "Saving…" pulse marks the busy row and only that checkbox is disabled; other rows stay live and a second row can be toggled concurrently. A rejected write rolls the row back to the server's values. Changing the type behaves the same way. The toggle is what grants front-desk eligibility from the console (see [../backend/rpcs.md](../backend/rpcs.md)). |
| **Sponsors** | List (paid only visible to attendees; admin sees all). Add/edit (type, name, email, phone, paid, amount, **contact search-and-pick**). |
| **Schedule** | Slots (with a **type optionset** — `Session` / `Service Session`) + sessions (with speakers 1:N via a **multi-select search dropdown**, material upload with a **submitted / not submitted** state and `average_feedback`), plus an admin-only **Delete current schedule** action for the active event. |
| **Sessions** | Everything about the **active event's sessions** in one place (nav sits between Schedule and Activity): one row per session with its slot date/time, room / level / area, **speakers**, **check-in count** (with capacity when set), **average rating and response count**, and whether an AI summary is stored, **out of date**, or impossible. Click a row to expand it: description, the full **speaker list**, the **roster of who checked in** (with time and which staff member scanned them), and the stored **AI summary**. A **search** box matches title, room, level, area or speaker, and the **attendee filter** answers "which sessions did this person actually attend?" — the list narrows to those sessions, the header states the count, and the expanded roster highlights that person. **Generate AI Feedback Summary** (see below) summarises every session with feedback in one click. Data comes from `sessions` ⨝ `slots` ⨝ `session_speakers` ⨝ `checkins` ⨝ `feedback`, joined in the client so the numbers match the other views exactly and no new RLS policy is needed. |
| **Activity** | Tables of check-ins, connections, and feedback (per active event), with manual **Generate AI Summary** controls for the event and individual sessions. |
| **Raffle** | Draws eligible attendees one at a time for the active event. Configure the number of picks (default 5), then **Spin** a roulette that decelerates onto a server-chosen winner; repeat until the pick count is reached. Excludes staff/Admin and the leaderboard top 3, and no one can win twice in a run. **New run** clears the current winners. See [../backend/rpcs.md#raffle](../backend/rpcs.md#raffle). |
| **Badges** | A **per-event WYSIWYG badge / PDF layout editor** (modelled on pretix's PDF Editor). Pick the event, then design one or more named **layouts** (a **Default** per event, switchable / creatable / deletable). Add **text boxes**, **QR codes** and **images** to a millimetre canvas; drag to move, use the 8 resize handles + rotation handle, **Shift-click to multi-select**, and **press `Del`** to remove. While dragging, **PowerPoint-style smart guides** appear — dashed alignment lines (edges / centres, page and neighbouring items) plus equal-spacing lines — and the element **snaps** to them. A **Word-style align** toolbar (left / center / right, top / middle / bottom) plus **PowerPoint-style** object alignment — align to the **page** or to the **selection**, and **distribute** horizontally / vertically — with the same controls in the properties panel. Text binds to attendee fields (name, email, ticket type, QR token, event name, **company / organizer**, or static) with font, size, line-height, colour, bold/italic, a labelled **Align text in box** section (horizontal left / center / right and vertical top / middle / bottom, inside the element's own frame) and case transform; QR binds to the token / check-in URL / email / name / static. **Undo/redo** (`Ctrl`+`Z` / `Ctrl`+`Y`, also `Ctrl`+`Shift`+`Z`), a **Preview** mode (no handles), a **JSON** view of the layout, and **Save**. Previewed against a real sample registration. See [../backend/rpcs.md#badge-editor](../backend/rpcs.md#badge-editor). |
| **Printing** | Badge-print control center: printer stations (add / inline **rename** / **revoke**, the `cvp_…` token shown **once** on creation), live station cards with state + staff hints, queue counters (pending / in flight / dead letters / completed), the last completed jobs with **Reprint**, and dead letters with **Requeue** / **Discard**. Backed by `get_print_overview` (polled every 5 s) — see [../backend/printing.md](../backend/printing.md). |
| **Settings** | **Badge printing** section first: how many labels a front-desk (welcome) check-in prints for the **active event** — a 1–4 segmented picker (`events.badge_copies`), saving on its own single-column write with a "Copies saved" confirmation; it renders even when the LLM/sidecar call fails. Then the global LLM endpoint, model and optional API key for feedback summaries, plus **Validate AI connection** — one real chat request against the stored settings, with the verdict left on the page (latency, the model's reply, and whether the provider reported **reasoning tokens**, i.e. whether thinking is actually off). See [../backend/printing.md](../backend/printing.md) and [../backend/feedback-ai.md](../backend/feedback-ai.md). |
| **Events** | Create event, toggle active/inactive (a switch; only one can be active at a time — activating one deactivates the rest), edit dates/location + the **Sessionize endpoint** + the **Real-time clock** toggle (on = the attendee app uses the real system clock for Live/Next/Done; off = the simulated mid-event clock, the default) + the **badge copies** picker (same 1–4 control as Settings). Each row has a **Sync** button that runs a (blocking) Sessionize sync and shows a result modal. |
| **Interfaces** | Manages the Sessionize sync **sidecar**: status (online / running / last run), a **Run sync** control (event picker + blocking run + result modal), an **Import Excel** control (upload the Sessionize "Sessions and speakers (advanced)" `.xlsx` + a "How to get this file" tooltip), and a **Recent runs** table from `sync_runs`. See [../backend/sidecar.md](../backend/sidecar.md). |
## Sessionize Source Editing
The Events editor accepts a Sessionize `All` or `GridSmart` URL, or the full
Sessionize `<script src="...">` tag, in the same multiline source field. Save
extracts and validates the HTTPS Sessionize URL and stores it as
`sessionize_endpoint`; the script is never executed. Invalid sources produce an
in-place error and are not saved. Active configured events sync at startup and
every 15 minutes by default; the existing Sync button still runs immediately.
See [source parsing and polling](../backend/sidecar.md#gridsmart-sources-and-polling).
## Auth guard
Login uses **email-only magic links**, with no password field, sign-in method
selector, password fallback, or password-change prompt. `AuthContext` checks
the contact after signing in:
- If `is_admin === true` or the contact email ends in `@appe.at` → 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.
### Magic links
The email-only form calls `signInWithOtp` with `shouldCreateUser: false` and
`emailRedirectTo: <current Admin origin>/auth/callback`. It does not create
accounts or grant admin privileges. Eligible accounts must already exist in
Supabase Auth and have a matching contact. Account-related send failures show
the same generic confirmation as success; rate limits, network failures and
server failures show a generic retry error instead of server details. The
recipient is locked while sending, and resend has a 60-second UI
cooldown. A failed resend clears the previous confirmation.
`/auth/callback` accepts implicit-flow access/refresh tokens in the fragment,
or a PKCE `code` query parameter when a verifier exists in the same browser.
The callback is consumed once even under React StrictMode. It removes query
parameters and fragments from browser history before exchanging credentials,
ignores supplied `next`/`redirect_to` destinations, and always returns to `/`.
Invalid, expired or rejected links clear the local Auth session and allow a new
link request. The default client uses implicit flow and
`detectSessionInUrl: false`; the callback performs session handling explicitly.
A token-hash `/auth/confirm` email template is not supported by this handler.
Auth-state listeners defer Supabase calls with `setTimeout` rather than awaiting
them inside `onAuthStateChange`, avoiding Auth lock deadlocks. Revision checks
discard outdated listener/session-restore lookups after later auth events.
Vite proxies only `/auth/v1` so the SPA owns `/auth/callback`; nginx serves the
callback with `Cache-Control: no-store` and `Referrer-Policy: no-referrer`.
Local redirect allowlisting, Mailpit, and explicit production SMTP/URL setup are
documented in [Supabase Core](../backend/supabase-core.md#magic-link-configuration).
`admin.appe.at` is an intended production domain, not a verified deployment.
Focused browser coverage (mocked Auth/REST; no real email or database writes):
```bash
npm --prefix apps/admin run build
npm --prefix e2e test -- admin-magic-link.spec.ts
```
The spec defaults to `http://localhost:3001`; set `CONVIVO_ADMIN_URL` to test an
alternate local server. Real delivery and Supabase redirect enforcement require
a separate local Mailpit smoke test after restarting the local Auth service.
This is an **Admin frontend-only** change. Existing database passwords, password
sync triggers, shared password operations and Supabase Auth's password endpoint
remain unchanged because attendee/staff login still uses them. Admin sessions
remain event-independent, and contacts with existing default passwords do not
receive a password-change prompt. See [demo accounts](../backend/seed.md#demo-accounts)
for seeded staff credentials used by the Convivo app.
## Source layout
```
apps/admin/src/
├─ main.tsx # ReactDOM entry
├─ App.tsx # Providers + Shell (sidebar nav + view switch)
├─ styles.css # Desktop-first styling (same design tokens as the PWA)
├─ context/
│ ├─ AuthContext.tsx # session + contact + is_admin guard
│ └─ ToastContext.tsx # transient toasts
├─ lib/
│ ├─ supabase.ts # createClient (same-origin)
│ ├─ api.ts # typed wrapper: reads + writes (contacts, registrations, sponsors, schedule, points, printing)
│ ├─ useSilentRefresh.ts # background poll + 500 ms-after-write debounce (see "Staying fresh")
│ ├─ printStatus.tsx # PrintStatusProvider (5 s get_print_overview poll) + pill/hint helpers
│ └─ types.ts # TS types mirroring the DB (incl. BadgePrintPayload, PrintOverview)
├─ components/
│ ├─ ui.tsx # Avatar, Spinner, Empty, Modal, QrImage, TypeBadge, Toggle, Tooltip, ColumnFilter
│ ├─ BadgeRender.tsx # shared badge renderer: resolveText/resolveQr, BadgeElementBody, BadgePagePreview, fitScale
│ ├─ badge-render.css # badge rules + bundled @fontsource fonts aliased to the editor family names
│ └─ PrinterStatusPill.tsx # always-visible sidebar pill (aggregated station state)
├─ print/
│ └─ main.tsx # standalone print renderer entry: window.renderBadge(payload, opts)
├─ screens/
│ └─ Login.tsx # email-only magic-link login (admin-only)
└─ views/
├─ Dashboard.tsx # active event + aggregates + top points + activity
├─ Contacts.tsx # table + edit / is_admin / visibility / points
├─ Registrations.tsx# per-event list + type / QR token (view) / badge preview / checked-in + sponsor lookup
├─ Sponsors.tsx # sponsor CRUD
├─ Schedule.tsx # slots + sessions + speakers + material
├─ Sessions.tsx # per-session speakers / attendance / feedback + attendee filter + bulk AI summaries
├─ Activity.tsx # check-ins / connections / feedback tables
├─ Events.tsx # event management (+ sessionize_endpoint + per-row Sync + talk networking bonus + badge copies)
├─ Interfaces.tsx # sidecar status / run / recent runs
├─ Reports.tsx # post-event summary + CSV / Excel / PDF export (sidecar /export)
└─ Settings.tsx # badge-print copies (active event) + server-only LLM configuration (redacted key)
```
Shared component: `components/BadgeCopiesSetting.tsx` exports the presentational
1–4 segmented picker (`BadgeCopiesPicker`), the clamping helper
(`clampBadgeCopies`) and the self-saving Settings card (`BadgeCopiesSetting`,
which writes `events.badge_copies` through `setBadgeCopies` — one column, so it
can never clobber the rest of the row).
## Data access
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 `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** — `adjust_points` (manual, audited as `admin`), `upsert_contact`,
`create_registration`, `set_registration_type`,
`set_session_material` (attach uploaded material),
`delete_event_schedule` (clear the active event's slots/sessions), and the
badge-print admin RPCs (`get_print_overview`, `enqueue_badge_print`,
`create_print_station`, `rename_print_station`, `revoke_print_station`,
`requeue_dead_badge_print`, `discard_dead_badge_print`). The
`reset_registration_qr_token` RPC still exists but the admin UI no longer
exposes a token reset. See
[../backend/rpcs.md](../backend/rpcs.md).
### Viewing a QR token
The QR token lives on the **registration** (per event), not the contact. The
**Registrations** view shows each registration's token and a **QR** button that
opens a modal with the scannable code. The token is **final** — it is generated
per event and can't be reset from the UI (the `reset_registration_qr_token` RPC
still exists, but the admin UI no longer exposes a reset action).
### Previewing a badge
Every registration row also has a **Badge** button. It opens a modal that renders
the event's **badge layout** for that specific attendee — the same millimetre
markup the Badges editor draws, minus the editing chrome — so the bound fields
resolve against that row's own **name**, **ticket type**, **QR token**, plus the
event's **name** and **company / organizer**. The event's layouts are loaded with
the list (one request per event, reused by every preview); when an event has
several layouts a **Layout** dropdown picks between them (the default is
preselected), and the badge is scaled to fit the dialog on any viewport.
A badge counts as **configured** only when a layout for the event actually has
elements — an empty layout would render a blank white badge. When nothing is
configured, the **Badge** button is still shown on every row but **disabled**
(grayed out, not clickable), and hovering or focusing it reveals a tooltip —
*“A badge needs to be configured for this event first. Design one in the Badges
view.”* — pointing the admin to the **Badges** view. The tooltip is the shared
`Tooltip` component in `components/ui.tsx`: the Uiverse dark-glass card already
used in Interfaces, re-themed to the APPE red accent and rendered through a
portal so it is never clipped by the table's `overflow: hidden`. The shared badge
renderer lives in `components/BadgeRender.tsx`, used by both the editor and this
preview.
> **Portalling is not enough on its own.** It stops an `overflow` ancestor
> clipping the card, but nothing used to keep the card inside the **viewport**: it
> was centred on its trigger with a fixed 250px width, so any tooltip on a
> right-aligned control ran off the right edge — which is exactly what happened to
> Sessions' “Generate AI Feedback Summary”, whose card sat half off screen. The
> component now measures the laid-out card and clamps it to the viewport, flips it
> **below** a trigger that has no room above it, and re-aims the arrow so it still
> points at the control after the card has been pushed sideways. The card carries
> **no CSS transform**: `left`/`top` are its real viewport coordinates, because a
> centring transform makes the clamp arithmetic disagree with what is painted.
### Printing
The **Printing** view is the badge-print control center; the queue, stations and
RPCs behind it are documented in [../backend/printing.md](../backend/printing.md).
- **Status pill** — `PrinterStatusPill` sits in the sidebar on **every** view
(desktop and mobile): the Pi has no screen, so staff must see the printer
state from anywhere. It aggregates the active stations by worst state
(error > offline > printing > ready), shows a shortened error / "offline · 2
min" text, and a tooltip lists every station (roll, network, last seen, hint).
Clicking it navigates to the Printing view.
- **Shared poller** — `PrintStatusProvider` (`lib/printStatus.tsx`) calls
`get_print_overview` once every **5 s** while the tab is visible (immediate
refresh on `visibilitychange`, one request in flight at a time, last data kept
on failure). The pill, the Printing view and the Registrations Print button
all read from it.
- **Stations** — **Add station** opens a modal that shows the generated
`cvp_…` token **once** (copy button; it is gone after Done — only its digest
is stored). Each card shows the derived state, roll, network, uptime and a
plain-language **hint** for staff (e.g. the offline hint points to the open
`Convivo-Printer-XXXX` Wi-Fi and http://10.41.0.1). Inline **rename** (Save
disabled while blank, Escape cancels) and **Revoke** (confirm; the token stops
working immediately).
- **Queue** — counters for pending / in flight / dead letters / completed, the
last 20 completed jobs each with **Reprint** (calls `enqueue_badge_print` for
that registration), and dead letters with **Requeue** / **Discard**.
- **Registrations Print** — every row has a **Print** button that queues the
badge and toasts the result (when every station is offline the toast says the
job is queued and will print when the station returns). With **no badge
layout** configured, the button is disabled with the same configure-first
tooltip as the Badge preview.
### Print renderer entry (`print.html`)
The badge image the Pi prints is produced by the **same React renderer** as the
previews, in a standalone bundle: `apps/admin/print.html` +
`src/print/main.tsx`, built by `npm run build:print`
([`vite.print.config.ts`](../../apps/admin/vite.print.config.ts) →
`dist-print/`). The bundle exposes `window.renderBadge(payload, {checkinOrigin})`,
which validates the `convivo.badge-print/v1` payload, renders the layout through
the shared `BadgePagePreview` at exact millimetre scale, waits for fonts and
images, and resolves with the badge's CSS-pixel size. The worker serves the
static files in a headless Chromium and screenshots the page — see
[../backend/printing.md](../backend/printing.md#7-the-pi-worker-appsprinterworker).
Fonts are **bundled** via `@fontsource` in `components/badge-render.css`,
aliased to the editor's family names, so rendering never depends on fonts
installed on the viewer's OS (admin laptop vs. the Pi).
Browser coverage (API-mocked, no real printer):
```bash
CONVIVO_ADMIN_URL=http://127.0.0.1:3001 npm test --prefix e2e -- printing.spec.ts --project=chromium
```
See [Badge Print Queue Regression](../backend/tests.md#badge-print-queue-regression).
### Sponsor lookup (in-place)
Setting a registration's type to **Sponsor** requires a sponsor lookup. If none
exists for that contact, the change fails with `a sponsor registration requires a
sponsor lookup` and the UI opens an **in-place sponsor popup** (instead of just
erroring). The popup lets the admin either **link an existing sponsor** (a
dropdown lists the event's sponsors; picking one pre-fills the form) or **create
a new one** (type, name, email, phone, amount, paid). On save it upserts the
sponsor linked to that contact's email, then sets the registration type to
`sponsor` in one step.
### Adjusting points
`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 `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).
### Feedback AI Summaries
Configure the complete OpenAI-compatible HTTPS endpoint, model and optional key
in **Settings > Feedback AI**. The key is never returned to the browser. In
**Activity**, the event feedback tab has one **Generate AI Summary** button;
the session feedback tab has one per session with responses. Generation is manual,
disabled without feedback or configuration, and shows loading and recoverable
error states. Saved plain-text summaries include their model, response count and
generation time. Regeneration replaces a result only after success.
The obsolete Schedule evaluation stub has been removed and its RPC is no longer
client-callable. See the [backend contract](../backend/feedback-ai.md) for provider
compatibility, data privacy, permissions and deployment requirements.
### Validating the AI connection
**Settings → Feedback AI → Validate AI connection** calls the sidecar
(`POST /sidecar/llm-test`), which reads the **stored** settings, resolves the
endpoint through the same SSRF guard, and makes **one** real chat request
("Reply with OK") with the same body shape a summary uses. It always answers with
a verdict rather than an exception, so the UI can name the reason:
| What you see | Meaning |
|---|---|
| **Green** "Connection works — replied in 412 ms" | Endpoint, key and response parsing are fine, **and** the provider reported `reasoning_tokens: 0`. |
| **Neutral** "Connection works — replied in 424 ms", with "This endpoint does not report a reasoning-token count…" | The transport is fine; the provider simply does not return a reasoning counter. **This is the normal state for `ai.lago.dev`**, which answers `usage.completion_tokens_details: {}`. Thinking is still sent disabled; it just cannot be confirmed from the usage block. |
| **Amber** "Connection works, but the model is still thinking" | The transport is fine but non-zero reasoning tokens came back, so summaries will be slow and costly — the endpoint is ignoring the thinking-off fields. |
| **Red** "Connection failed" + one line of detail | No settings saved yet, a non-2xx from the provider (a wrong key reads as `HTTP 401: …`), an endpoint that failed validation, a timeout, or a reply with no content. |
Three things are deliberate here:
- The button is **disabled while the form has unsaved changes**. The key never
reaches the browser, so a test can only ever exercise what is stored — being
able to press it against half-typed values would report on the wrong endpoint.
- The reasoning verdict is **three-state, not two**. `0` means "reported and
off"; `null` means "this provider does not report it"; only a reported
non-zero value raises the warning. Collapsing `null` into the warning was the
first implementation and it was wrong: measured against the production
gateway, which omits the counter entirely, every healthy connection showed a
"still thinking" warning. `null` is never displayed as zero — **only `0`
proves thinking is off**, because these gateways answer `200 OK` while
silently ignoring fields they do not implement.
- The verdict is rendered on the page, not as a toast — the latency and the
reasoning line are worth reading twice, and a toast expires.
### Generate AI Feedback Summary (all sessions at once)
The **Sessions** view has one button that summarises every session with at least
one feedback response — one request per session, issued from the browser against
the existing `POST /sidecar/feedback-summary` route (no new backend endpoint, and
the per-target `409` guard in the sidecar still applies).
- Concurrency is capped at **3**. The gateway behind `ai.lago.dev` is a single
vLLM worker, so firing N requests at once only makes each one slower.
- The page is **blocked until every request has settled**: a full-screen overlay
with a spinner and a `done / total` counter, the button disabled, the filters
disabled, and the background poll paused so it cannot race the writes.
- Each result is stored as it arrives (`feedback_summaries`, keyed by
`(scope, target_id)`), so a run that dies halfway keeps what it finished, and a
re-run only has to redo the rest.
- One failing session does not stop the others. The summary line reports
`2 session summaries stored · 1 failed: Power Apps Deep Dive: <reason>`.
- A **Stop** button ends the loop after the in-flight requests return; stored
results stay stored.
- Summaries are **flagged as stale** in the table when the session's response
count has moved since they were generated, so nobody quotes an old digest.
Provider requests disable model thinking with both `reasoning_effort: "none"` and
`chat_template_kwargs: { enable_thinking: false }` — see
[../backend/feedback-ai.md](../backend/feedback-ai.md) for why both, and why a
`200` proves nothing on its own.
### Staying fresh (silent reload)
Every data view keeps itself current without a reload, through
[`lib/useSilentRefresh.ts`](../../apps/admin/src/lib/useSilentRefresh.ts):
- a background poll every **5 s** (15 s for **Reports**, which pulls nine tables
at once), and a debounced pull **500 ms** after any write, so a burst of edits
settles on the server before it is read back;
- **silent** has teeth: no spinner, no scroll jump, no `setLoaded(false)`, and
background errors are swallowed — these views render `if (error) return <Empty/>`,
so one failed poll would otherwise replace a good table with an error screen;
- never fires on mount (the view's own `load()` owns the first fetch), drops
overlapping ticks instead of queueing them, and pauses while the tab is hidden,
refreshing the moment it becomes visible again;
- **Registrations** patches in place: the current row order is preserved (the list
is sorted by points, so a naive reload slid the row you had just toggled
somewhere else), rows with a write in flight are left alone so an optimistic
checkbox cannot flicker back, new rows append at the end and removed rows
disappear. **Schedule** and **Contacts** pause while a modal is open; **Raffle**
never refreshes mid-spin, because the animation reads the pool.
This is what makes a phone scan by a colleague on the other side of the room show
up on the console within a few seconds.
### Points, and who does not earn them
The Registrations table shows a plain number for anyone who can earn points, and
for everyone else `— no points` in a tooltip that explains the rule: staff passes,
Admin contacts and `@appe.at` addresses are excluded by `_points_eligible` on
purpose, so a `0` there is not a broken check-in. The client-side mirror
(`canEarnPoints`) is commented to stay in step with the SQL predicate. The Contacts
points modal applies the same rule before the write: the **Apply** button is
disabled with an explanation, because `adjust_points` returns `void` and would
otherwise report success while having changed nothing.
`set_registration_checked_in` reports both halves of its work
(`points_removed`, `points_added`), and the toggle's toast says which happened —
`+20 check-in pts restored` when switching a pass back on tops the score up from
the check-in rows that still exist. See
[../backend/rpcs.md](../backend/rpcs.md#points-rules).
### Registration Tickets
Registration totals and check-in totals exclude blank/missing QR tokens. Unticketed
rows remain listed separately. Check-in toggles update immediately, disable during
the request and restore their previous value on failure, without a page refresh.
**Merge tickets** appears only on QR-less Sessionize-imported registration rows.
Its modal ranks purchased tickets from the same event by matching name words,
including accent normalization, and allows searching/selecting any purchased
ticket regardless of whether its name matches. Nothing merges until confirmation.
The destination keeps its QR/email, attendance and points; session assignments and
the speaker/staff role transfer before deleting the imported registration. Contact
and Auth records and other events are preserved. Source attendee activity requires
manual reconciliation before merging. See [the RPC contract](../backend/rpcs.md).
### Delete current schedule
The Schedule view keeps the existing active-event selection pattern: it loads
`getActiveEvent()`, then reads slots/sessions for that event. **Delete current
schedule** captures the active event ID/name when the confirmation modal opens
and calls `delete_event_schedule(p_event_id)`. Success refreshes only that same
event view and reports deleted slot/session counts; if the admin navigates away
or changes the active event while the RPC is pending, the stale completion does
not clear the newly selected event's UI.
The confirmation spells out the irreversible data loss: slots, sessions,
speaker links, preferences, check-ins and feedback are deleted; registrations
are preserved; material paths are removed with session rows, but Storage objects
are not physically purged. The UI disables schedule mutation controls while the
delete is pending. A later or concurrent Sessionize/Pretix sync can recreate
schedule rows because the admin delete does not lock the import sidecar.
### Reports (post-event summary + export)
The **Reports** view is the post-event reporting surface. It works for **any**
event (active or past) — the event selector defaults to the active event but can
pick a past one.
- **On-screen summary** — computed client-side from the same reads the export
uses: registrations (by type), check-ins, connections (total / accepted),
session feedback (count + average), event feedback (count + average), points by
category, and a top-5 leaderboard.
- **Session feedback summary** — a per-session table (title, room, average
rating, response count) sorted by average; this is the post-event session
feedback summary.
- **Export** — three buttons call the sidecar's [`POST /export`](../backend/sidecar.md#http-api):
**Download CSV**, **Download Excel**, **Download PDF report**. CSV/XLSX include
the tables ticked in the checkbox list (default: all); the PDF always uses the
full dataset. The response's base64 body is decoded and downloaded in the
browser (`downloadReport` in `lib/api.ts`).
## 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 **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.