Files
mimic-big/frontend
ux-frontend 2eefd11019 feat(frontend): wire LoginPage + EngagementsPage + create dialog to backend
LoginPage
- RT mode now POSTs /api/v1/auth/login with controlled username/password
  fields. Success seeds the session cache via queryClient.setQueryData and
  navigates to /engagements. 401 surfaces as the generic
  "Identifiants invalides" — no echo of the backend detail (avoids
  user enumeration leaks).
- SOC mode kept visually for masthead continuity but disabled with a
  "sprint 2" placeholder pointing at the deferred
  POST /api/v1/auth/soc/session endpoint.
- Removed the sprint-0 mock role-picker.

EngagementsPage
- MOCK_ENGAGEMENTS dropped. useQuery against fetchEngagements (handles
  both bare-array and { items: [] } envelope shapes — backend has not
  pinned this yet).
- Distinct loading / empty / error states. Error row surfaces an HTTP
  code and a Retry button. Empty state offers the create dialog.
- Column shape aligned with the real Engagement schema (snake_case:
  name, client_name, c2_type, start_date, end_date). Dropped mock-only
  columns (operators, socAnalysts) — those land when backend exposes
  /engagements/:id/members and /engagements/:id/soc-sessions counts.

engagementsApi.ts
- fetchEngagements + createEngagement, both bound to /api/v1/engagements.
- ENGAGEMENTS_QUERY_KEY exported so the dialog can invalidate without
  re-knowing the key.

EngagementCreateDialog (frontend-design skill — new non-trivial component)
- "Arm engagement" mission-control dialog. Backdrop is a graphite dim
  with a faint scanline overlay (no soft blur) — reads as "cockpit
  paused while you issue a command", not as a SaaS modal.
- Surface --surface-3 with corner-marks and an amber hairline accent
  under the title; underline-style inputs that light amber on focus;
  label-system uppercase microtypography throughout.
- Esc + outside-click close (suspended while the mutation is in flight).
- Rudimentary tab focus trap.
- 422 Pydantic errors map per-field via the last loc segment;
  401/5xx surface as a generic top-of-form alert.
- On 201 invalidates ['engagements'] and closes.
2026-05-23 04:26:48 +02:00
..

Mimic frontend

React + TypeScript SPA for the Mimic BAS platform. Lives behind the existing RT reverse proxy (Caddy + TLS + IP allowlist) — see D-007.

Stack

  • React 19, TypeScript strict
  • Vite 8 (dev/build)
  • Tailwind 4 (semantic tokens in src/styles/theme.css)
  • TanStack Query 5 for server state
  • react-router-dom v7 for routing
  • Recharts for the report visualisations
  • Vitest + Testing Library for unit tests
  • Playwright for E2E (covered in sprint 1+)

Scripts

npm install
npm run dev          # vite dev server on :5173
npm run build        # tsc -b && vite build
npm run typecheck    # tsc -b --noEmit
npm run lint         # eslint . (strict TS + react-hooks + prettier)
npm run format       # prettier --write .
npm test             # vitest run
npm run e2e          # playwright test (needs npm run e2e:install once)

Layout

src/
├── components/
│   ├── brand/        # Wordmark (provisional, awaits PR3 charter)
│   ├── shell/        # AppShell, Sidebar, StatusRail
│   └── ui/           # Panel, Pill, Button — instrument-grade primitives
├── mocks/            # sprint 0 fixtures (no backend yet)
├── router/           # RootLayout helper
├── screens/          # one folder per top-level route
├── session/          # mock auth context (D-003 v1 hook-in point)
├── styles/           # theme.css (tokens), fonts.css, globals.css
└── types/            # cross-cutting type aliases

Design system status (provisional)

The token layer in src/styles/theme.css is structured to receive the RT graphic charter (PR3) without touching component code. Component CSS reads exclusively from semantic tokens (--accent-rt, --status-detected, …); swapping the underlying primitive palette is the only change required when PR3 lands.

Auth status (sprint 0)

The session context reads/writes a mock user in sessionStorage. No real auth yet. v1 will wire local username/password + bcrypt (D-003); v2 maps Keycloak OIDC claims onto the same role enum.

Fonts

IBM Plex (Sans / Sans Condensed / Mono), self-hosted under public/fonts/. Files are not yet vendored — see public/fonts/README.md. Until then the UI falls back to ui-sans-serif / ui-monospace.