refactor(frontend): align LoginPage and DataPage on DA v2 (#72 #73 #74) - #83
Merged
Conversation
The two remaining pages that predated the design system were still using raw Tailwind slate-* utilities and an incorrect post-login redirect. Pivoted both onto the operator-calm v2 tokens, fixed the redirect, and guarded the demo credentials behind the Vite DEV flag. LoginPage: - Layout + typography rebuilt on DS v2 tokens (Inter sentence-case, `--ds-radius-md` 10px, `--ds-accent` + `--ds-accent-ring` focus, `--ds-bg-surface`/`elevated`/`base` hierarchy, no decorative shadow). - AriaMark + wordmark + ThemeToggle in the top bar — users can switch theme before authenticating (no flash on first surface). - Inputs: h-9, bg `--ds-bg-elevated`, border `--ds-border` → focus `--ds-accent` with 2px ring. Autocomplete (`username` / `current-password`), `useId` for `htmlFor`, `aria-describedby`, `aria-busy`, `role="alert"` on error. - Redirect after auth reads `location.state.from.pathname` first (respects RequireAuth's remembered destination) and falls back to `/control-room` (not `/data`). Closes #72. - Credentials prefill and dev-seed hint both gated by `import.meta.env.DEV`. Vite strips the string literals in the prod bundle (verified: `grep 'admin123' dist/assets/index-*.js` empty). Closes #74. DataPage: - Debug viewer fully preserved (queries, sections, logic unchanged). - All legacy classes swapped to tokens: `bg-slate-*` / `bg-white` → `var(--ds-bg-*)`, `text-slate-*` → `var(--ds-fg-*)`, `text-red-*` / `bg-red-*` → `--ds-status-critical` (with `color-mix` for tints), `border-slate-*` → `--ds-border`, `rounded-lg` → `--ds-radius-md`. Decorative `shadow` removed entirely. - Legacy `<Section>` / `<StatusBadge>` replaced by DS primitives (`Card` + `SectionHeader` + `Badge`). Sentence-case everywhere, no uppercase or tracking-wide. Numerics stay in mono tabular-nums per §3.3. Closes #73. - Header aligned with the app shell (h-14, AriaMark + wordmark + ThemeToggle + user info + logout), same tokens as `TopBar.tsx`. - Logbook entries keep a subtle left border (`--ds-border-strong`) — StatusRail reserved for live entities under watch per §5.2. Zero new deps. No changes to `RequireAuth.tsx` (already passes `state={{ from: location }}`). All gates green (typecheck / build / check). Bundle +0.5kB gz (expected — two pages re-templated on DS primitives). Closes #72 Closes #73 Closes #74
There was a problem hiding this comment.
Pull request overview
Refactors the remaining legacy frontend pages (LoginPage, DataPage) to use the DA v2 design system tokens/components, while also fixing post-login redirect behavior and gating demo credentials in production builds.
Changes:
- Rebuilds
/loginUI with v2 tokens/components (TopBar branding +ThemeToggle, updated form styling/accessibility attributes). - Updates login redirect to respect
location.state.fromand default to/control-roominstead of/data. - Reskins
/datawith design-system primitives (Card,SectionHeader,Badge) while preserving existing query logic.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| frontend/src/pages/LoginPage.tsx | v2 design rebuild; redirect logic updated; demo credentials gated by import.meta.env.DEV. |
| frontend/src/pages/DataPage.tsx | v2 visual swap using DS primitives/components; keeps existing data-fetching logic intact. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+30
to
+32
| const from = (location.state as LocationState | null)?.from?.pathname; | ||
| const target = from && from !== "/login" ? from : "/control-room"; | ||
| navigate(target, { replace: true }); |
| <form | ||
| onSubmit={onSubmit} | ||
| aria-busy={loading} | ||
| noValidate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pivots the two remaining legacy pages (
LoginPage+DataPage) onto the operator-calm v2 design system and resolves three M6.3 follow-ups in one pass.Changes
LoginPage — full v2 rebuild
--ds-radius-md10px,--ds-accent+--ds-accent-ringfocus ring,--ds-bg-{base,surface,elevated}hierarchy). No decorative shadow.ThemeTogglein the top bar — theme-switching available before auth (no first-surface flash).autocompleteset (username/current-password),useIdpairshtmlFor,aria-describedby,aria-busy,role="alert"on error.location.state.from.pathnamefirst (respects RequireAuth memory), falls back to/control-room. No more hardcoded/data.import.meta.env.DEVgates both the prefill (useState("")in prod) and the seed hint footer. Vite strips the literals in prod bundle (grep 'admin123' dist/assets/index-*.js→ empty).DataPage — debug viewer, v2 skin
bg-slate-*/bg-white→var(--ds-bg-*)text-slate-*→var(--ds-fg-*)text-red-*/bg-red-*→--ds-status-critical(withcolor-mixtints)border-slate-*→--ds-borderrounded-lg→--ds-radius-mdshadow→ removed<Section>/<StatusBadge>→ DS primitives (Card+SectionHeader+Badge).TopBar(h-14, same tokens) — AriaMark + wordmark + ThemeToggle + user info + logout.grep -nE "(bg-slate|text-slate|bg-white|bg-red|text-red|#[0-9a-fA-F]{3,6})" src/pages/{LoginPage,DataPage}.tsxreturns 0 occurrences.Architecture
RequireAuth.tsx— it already passesstate={{ from: location }}; LoginPage now reads it.Acceptance
/loginuses DS v2 tokens (no raw slate classes)/datauses DS v2 tokens (no raw slate classes)/control-room(or thefromstate if present)ThemeToggleaccessible before authTest plan
Visual checks (both dark and light via
ThemeToggleon /login):/login— card centered, tokens v2 (no white card on light bg), AriaMark + wordmark at top, ThemeToggle top-right, inputs with focus ring on tab, no visible shadow, seed-hint footer visible (DEV mode only)./control-room(not/data)./datawhile logged out → bounces to/login, then post-auth → lands back on/data(respectsfromstate)./data— sentence-case, cards with hairlines, sentence-case OEE chips, logbook with--ds-border-strongrail, no raw slate anywhere.Prod bundle check (optional):
Gates (all green):
npm run typechecknpm run build(465 kB / 146 kB gz)npm run check(Biome, 35 files, 0 errors)Follow-ups opened on this PR
None — this PR resolves all 3 outstanding M6.3 follow-ups.
Closes #72
Closes #73
Closes #74