ux(chargen): render stats as label-above-value grid for scannability#169
Merged
ux(chargen): render stats as label-above-value grid for scannability#169
Conversation
…tsx by combining stats grid (this PR) with edit-affordance Pencil/hover (#168)
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
Per playtest 2026-04-26 ping-pong section
[UX] Stats line on the chargen sheet is dense horizontal text — Alex-unfriendly.The "Your Character" review surface rendered the stats row as a single dense horizontal line —
STR 10 DEX 7 CON 12 INT 17 WIS 5 CHA 11— because the server emits stats as a flat string incharacter_preview.stats(built insidequest-server/sidequest/server/dispatch/chargen_summary.py~line 193).Per CLAUDE.md playgroup notes: Alex (slow reader) loses this at-a-glance, and Sebastien (mechanics-first) wants stats clearly visible. This PR detects the stat-line shape client-side and renders it as a 3-column label-above-value mini-grid that mirrors the
creation-rolled-statslayout already used during the chargen scene where stats are rolled.Pure presentational — wire data shape unchanged. The detector keys off the value shape (uppercase 2-4 letter label + signed integer pairs), not the literal "Stats" key, so genre packs that label the field "Vitals", "Attributes", etc. still get the scannable layout.
Files changed
src/components/CharacterCreation/parseStatLine.ts— new helper module (split out so react-refresh's only-export-components rule stays happy onCharacterCreation.tsx).src/components/CharacterCreation/CharacterCreation.tsx— confirmation preview branch now callsparseStatLine(value)per row; if it returns pairs, render a<dl>grid withdata-testid="review-stats-grid"and per-statdata-testid="review-stat-{NAME}"cells using<dt>/<dd>. Falls through to the existing<p>for non-stat rows.src/components/CharacterCreation/__tests__/CharacterCreation.stats-grid.test.tsx— unit suite (10 tests): pure-helper boundary cases (canonical line, single-space tolerance, negative values, prose rejection, non-string rejection) + grid render assertions (testid present,grid-cols-3class pinned, term/definition roles, dense one-liner not present, edit button still wired, fallback to plain text for non-stat rows, key-name agnostic).src/__tests__/chargen-stats-grid-wiring.test.tsx— wiring test (per CLAUDE.md "Every Test Suite Needs a Wiring Test"): drives aCHARACTER_CREATION{phase:"confirmation"}frame through the live App → MemoryRouter → MockWebSocket pipeline (modeled onlobby-start-ws-open.test.tsx) and asserts the grid is reachable in the live DOM with all six stat cells.Test plan
npx vitest run src/components/CharacterCreation/__tests__/ src/__tests__/chargen-stats-grid-wiring.test.tsx→ 13/13 passnpx eslinton touched files → clean (no warnings)bg-background/40 border-border/30cells,text-[var(--primary)]values).Out of scope
developincharacter-creation-wiring.test.tsx(Router context error) — unrelated; flagged by playtest pingpong.