Skip to content

UI Overhaul Integration#97

Open
b006n97 wants to merge 12 commits into
mainfrom
ui-overhaul-integration
Open

UI Overhaul Integration#97
b006n97 wants to merge 12 commits into
mainfrom
ui-overhaul-integration

Conversation

@b006n97

@b006n97 b006n97 commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Overview

Full UI overhaul of the MJC website: a new design-token system with light/dark
color schemes and a runtime accent switcher, a decomposed navigation module,
consolidated routing, and a redesign of every feature surface (home, leaderboard,
statistics, games, record-game, auth/account, resources).

78 files, +6,389 / −2,352, 12 commits. No backend/DB schema changes of
substance — this is a frontend overhaul plus one small backend page-size tweak.

How to review

This branch is the one-cutover merge of a 12-PR reviewed stack. Review the
small, ordered slices below (bottom-up); this PR is the single atomic merge to
main. Do not merge until all 12 are approved.

  • PR-A — Increase recent games page size 30→50 (jp + hk)
  • PR-1 — Design-system foundation (tokens, theming, accent, color scheme)
  • PR-2 — Shared atoms (StatCard, IconBadge, SectionHeader)
  • PR-3 — Decompose NavBar into a navbar/ module
  • PR-4 — Home landing page + hero artwork
  • PR-6 — Statistics page + placement visualizations
  • PR-5 — Leaderboard → one query-param page
  • PR-9 — Auth pages + account settings (accent picker)
  • PR-10 — Resources page
  • PR-11 — Incidental cleanup + dep bump
  • PR-7 — Consolidate live games + logs into one Games page
  • PR-8 — Record-game flow (stepped entry) — behavioral

Changes by area

  • Design system (theme/tokens.ts, theme/index.ts, AccentContext.tsx,
    animations.ts, theme/utils.ts, DESIGN.md): single source of truth for
    colors/typography/timing; MUI colorSchemes light + dark exposed as CSS vars;
    runtime accent (red/blue/green) persisted in localStorage; Manrope font;
    InitColorSchemeScript to prevent theme flash.
  • Navigation: 469-line NavBar.tsx → focused common/navbar/ module
    (DesktopNav, MobileDrawer, LogoIcon, navStyles, navActive).
  • Pages: Home + Hero, Leaderboard, Statistics, Games, Record-game, Login/
    Register/reset, Account settings, Resources — all restyled onto the system,
    with shared atoms and game/common primitives.

Behavioral changes (intentional — please scrutinize)

  • Backend take: 30 → 50: live-games queries now return 50 rows/variant.
  • Record-game default hand: JP_UNDEFINED_HAND {han:-2,fu:10}{han:1,fu:30};
    HK_UNDEFINED_HAND (-1)HK_DEFAULT_HAND (3). Entry starts from a valid
    minimum hand instead of a sentinel.
  • assignRoundAction: centralizes role-exclusivity (a player can't be
    winner and loser simultaneously) across every assignment path.
  • Soft validators getUnmet{Japanese,HongKong}RoundRequirements: non-throwing
    checks that gate the Submit button; the existing throwing validators remain the
    submit-time safety net.

Routing changes

  • /leaderboard/{jp,hk}[/casual] → single /leaderboard?variant=&type=; legacy
    URLs 301-redirect carrying the selection.
  • /games/current/{jp,hk}/games/current; /games now renders the merged
    Games page.
  • /games/create/{jp,hk}[/casual] → single /games/create?variant=&type=; legacy
    URLs redirect.

Deliberately NOT included (accidental cruft dropped from the original branch)

Root package-lock.json (orphaned framer-motion, imported nowhere),
backend/package-lock.json name-line churn, a schema.prisma whitespace-only
edit, and comment noise in dead game/new/*. Also cleaned up: the now-unused
TransactionTypeButtonList.tsx (replaced by TransactionTypeSelector).

Testing

  • tsc --noEmit and full npm run build pass on this branch (each of the 12
    slices also typechecks independently).
  • ⚠️ No automated coverage for the record-game behavioral change — the
    frontend has no test runner. Before merge, either add vitest to cover
    assignRoundAction / isValidHand / getUnmet*RoundRequirements, or manually
    QA game entry in both variants:
    • Deal-in, self-draw, pao variants, nagashi mangan (jp), deck-out
    • Submit gating matches unmet-requirements output
    • Default hand can't silently submit an invalid score
  • ⚠️ Manrope loads from Google Fonts (external request per page) — consider
    self-hosting for privacy/offline/CSP.

b006n97 added 12 commits July 2, 2026 11:33
Return the 50 most recent games per variant instead of 30, matching the
redesigned Games page which surfaces more history. Symmetric change across
both variant services; no other behavior affected.
Introduces the platform layer the rest of the UI overhaul sits on, with no
feature redesigns yet:

- theme/tokens.ts: single source of truth for accent ramps (red/blue/green),
  per-scheme neutrals, medal/placement colors, and timing.
- theme/index.ts: createAppTheme(accent) builds a colorSchemes (light/dark)
  theme, exposing accent + neutrals as CSS vars (--mui-palette-*).
- theme/AccentContext.tsx: runtime accent switch (localStorage-persisted),
  orthogonal to MUI's color-scheme mode.
- theme/utils.ts: additive sx presets (gradientTitle, eyebrowLabel) plus
  restyled existing helpers; export names/types unchanged so current
  components keep compiling.
- index.tsx: InitColorSchemeScript to avoid a flash of the wrong theme.
- index.html: load the Manrope font used by the theme typography.
- App.tsx: swap ThemeProvider(createAppTheme()) for <AccentProvider> only;
  routing is left untouched here and migrated in later PRs.
- DESIGN.md: design-system reference. Fixed the tokens.ts docstring drift
  (was "two accent variants"; there are three: red/blue/green).

Typechecks independently (tsc --noEmit clean) with the still-un-migrated
components consuming the new theme.
Reusable presentational primitives consumed by the Home, Leaderboard, and
Statistics redesigns in later PRs. Depend only on React + MUI (theme values
resolve at runtime via CSS vars); additive with no importers yet, so this
lands clean and keeps the feature PRs small.
Replace the 469-line monolithic common/NavBar.tsx with a focused module:
- navbar/index.tsx: composition + shared AppBar shell
- DesktopNav.tsx / MobileDrawer.tsx: the two responsive layouts
- LogoIcon.tsx, navStyles.ts (shared sx + easing), navActive.ts (active-route helpers)

WithNav.tsx now imports @/common/navbar. Behavior is preserved (same links,
auth gating, active highlighting); styling is updated to the new theme.
Depends only on the design-system foundation.
New Hero.tsx (full-bleed hero with gradient title over a left-anchored scrim
and hero.webp artwork) and a restructured Home.tsx using the shared IconBadge
and SectionHeader atoms. Depends on the design-system foundation and shared
atoms; no routing or data changes.
- StatisticsSummary.tsx: new stat-tile summary built on the StatCard atom.
- PlacementDistributionBar.tsx: new 1st-4th distribution bar using the shared
  placement colors from theme tokens.
- PlacementHistoryGraph.tsx: reworked placement history chart.
- placementConstants.ts: shared ORDINALS / PLACEMENTS constants.
- Statistics.tsx: slimmed to compose the above; DisplayStatistics export kept
  backward-compatible so the (still-legacy) Leaderboard keeps compiling.

Depends on the design-system foundation and shared atoms.
Collapse the four prop-driven per-board routes into a single /leaderboard
page that reads ?variant=&type= via useSearchParams and lets the user switch
boards in-page. Legacy URLs (/leaderboard/jp, .../casual, /leaderboard/hk,
...) now redirect with the intended board carried in the query string, so
existing links/bookmarks still land on the right selection.

App.tsx changes are scoped to the leaderboard routes; games/create routing is
migrated in later PRs.
- Shared AuthLayout.tsx + BrandHeader.tsx wrap Login / Register / password-reset
  flows in a consistent branded shell.
- Login, Register, RequestPasswordReset, PasswordReset restyled onto the layout.
- Settings.tsx gains an accent picker (red/blue/green) driven by useAccent, with
  dragon-tile SVG swatches per accent.

Depends on the design-system foundation (theme + AccentContext).
Restyle the resources/guides page onto the new design system (section headers,
cards, typography). Content and routing unchanged.
Unrelated micro-changes batched to keep the feature PRs pure:
- admin/{AdminChombo,AdminPlayers,AdminSeason}: drop unused imports.
- common/{AuthContext,LoadingFallback,Unauthorized}: small cleanups/restyle.
- App.scss: global-style tweaks.
- bump @types/react 18.3.11 -> 18.3.31 (types-only).

No behavior or routing changes.
Merge the separate LiveGames and GameLogs views into a single /games page:
- Games.tsx composes LiveGamesSection + GameLogsSection under shared
  GameSectionHeader.
- LiveGames.tsx / GameLogs.tsx refactored to export those sections and share
  GameSummaryCard -> GameSummaryBody, with placement.ts (new) as the shared
  place-color/label source and Utils.formatRelativeTime for "5m ago" stamps.
- App.tsx: /games/current/{jp,hk} collapse to /games/current; /games now
  renders Games. (Record-game /games/create routing is migrated in the next PR.)

placement.ts is added here as an additive shared helper; the record-game flow
picks it up in the following PR. Record-game code is untouched and still
compiles against the existing constants.
Rework game entry (CreateGame, Game, and the legacy jp/hk game screens) onto a
stepped UI with clearer per-round requirements, and consolidate create routing:
- StepSection / RoundRequirements / TransactionTypeSelector (replacing
  TransactionTypeButtonList) / PlayerScoreCard drive the new entry flow;
  Footer, PlayerButtonRow, PointsInput, DropdownInput, TableDisplay restyled.
- App.tsx: /games/create/{jp,hk}[/casual] collapse to a single query-param
  /games/create page; legacy URLs redirect carrying variant/type.

BEHAVIORAL CHANGES (intentional, confirmed):
- constants.ts default hand: JP_UNDEFINED_HAND {han:-2,fu:10} -> {han:1,fu:30};
  HK_UNDEFINED_HAND (-1) renamed/retuned to HK_DEFAULT_HAND (3). Entry now
  starts from a valid minimum hand instead of a sentinel.
- assignRoundAction centralizes role-exclusivity (a player can't be winner and
  loser at once) across every assignment path.
- getUnmet{Japanese,HongKong}RoundRequirements add soft, non-throwing
  validation so the UI can gate Submit; the throwing validators remain the
  submit-time safety net.

TESTING GAP: assignRoundAction / isValidHand / getUnmet*RoundRequirements are
pure and unit-testable, but the frontend has no test runner configured. Cover
via a follow-up (add vitest to frontend) or manual QA of deal-in / self-draw /
pao / nagashi / deck-out entry in both variants before release.
@b006n97 b006n97 mentioned this pull request Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant