v1.10.0: top-bar Log out (ISS-157) + Admin button gated to admins (ISS-158) #164

Merged
kamilkrzywda merged 1 commits from feat/topbar-logout-admin-gate into master 2026-09-28 00:37:50 +02:00
Owner

v1.10.0

#157 — Top-bar Log out. New Log out button as the last child of the top bar (components/Map.tsx) — flex row puts it top-right, no CSS. Same three steps as the admin panel's in-modal button: best-effort POST /api/logout with the session header, clear the stored session id, drop back to sign-in via the existing onLogout. The two in-modal Log out buttons are kept (zero e2e churn).

#158 — Admin button only for admins. The top-bar Admin button now renders only when /api/me reports admin: true — hidden entirely, not disabled. No server change: the endpoint already returns {username, admin}; app/page.tsx parses that body on its mount probe and passes isAdmin down AppShell → Map. The probe also re-runs after a form sign-in (bumped probeKey) so isAdmin tracks the user who just signed in — an admin logging out followed by a non-admin signing in no longer sees the Admin button.

E2E. New test in e2e/map.spec.ts: top-bar Log out → sign-in form visible and app header gone (mirrors the existing admin-panel logout assertion).

Local verification: tsc --noEmit clean, vitest 41 files / 445 tests passed, playwright list = 67 tests in 18 files. Full e2e runs in CI.

## v1.10.0 **#157 — Top-bar Log out.** New `Log out` button as the last child of the top bar (`components/Map.tsx`) — flex row puts it top-right, no CSS. Same three steps as the admin panel's in-modal button: best-effort `POST /api/logout` with the session header, clear the stored session id, drop back to sign-in via the existing `onLogout`. The two in-modal Log out buttons are kept (zero e2e churn). **#158 — Admin button only for admins.** The top-bar `Admin` button now renders only when `/api/me` reports `admin: true` — hidden entirely, not disabled. No server change: the endpoint already returns `{username, admin}`; `app/page.tsx` parses that body on its mount probe and passes `isAdmin` down AppShell → Map. The probe also re-runs after a form sign-in (bumped `probeKey`) so `isAdmin` tracks the user who just signed in — an admin logging out followed by a non-admin signing in no longer sees the Admin button. **E2E.** New test in `e2e/map.spec.ts`: top-bar Log out → sign-in form visible and app header gone (mirrors the existing admin-panel logout assertion). Local verification: `tsc --noEmit` clean, vitest 41 files / 445 tests passed, playwright list = 67 tests in 18 files. Full e2e runs in CI.
kamilkrzywda added 1 commit 2026-09-28 00:31:34 +02:00
v1.10.0: top-bar Log out (ISS-157) + Admin button gated to admins (ISS-158)
CI / build + unit + e2e (pull_request) Successful in 6m18s
cde4334946
kamilkrzywda scheduled this pull request to auto merge when all checks succeed 2026-09-28 00:32:16 +02:00
kamilkrzywda merged commit 5093fba82e into master 2026-09-28 00:37:50 +02:00
kamilkrzywda deleted branch feat/topbar-logout-admin-gate 2026-09-28 00:37:50 +02:00
Sign in to join this conversation.