Implement the 010-ui-baseline feature that establishes a modern UI using Tailwind CSS v4 and shadcn/ui-style components for the encounter screen

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lukas
2026-03-05 18:36:39 +01:00
parent 8185fde0e8
commit 1c40bf7889
20 changed files with 1533 additions and 273 deletions

View File

@@ -0,0 +1,75 @@
# Data Model: UI Baseline
**Feature**: 010-ui-baseline | **Date**: 2026-03-05
## Domain Entities (UNCHANGED)
This feature makes no domain changes. The existing domain types are consumed as-is by the UI layer.
### Combatant (read-only from UI perspective)
| Field | Type | Notes |
|-------|------|-------|
| id | CombatantId (branded string) | Unique identifier |
| name | string | Display name, editable inline |
| initiative | number \| undefined | Sort order, editable inline |
| maxHp | number \| undefined | Maximum hit points |
| currentHp | number \| undefined | Current hit points (present when maxHp is set) |
### Encounter (read-only from UI perspective)
| Field | Type | Notes |
|-------|------|-------|
| combatants | readonly Combatant[] | Sorted by initiative descending |
| activeIndex | number | Index of current turn's combatant |
| roundNumber | number | Current round counter |
## UI Component Model (NEW)
These are adapter-layer visual components — not domain entities.
### CombatantRow
Renders a single combatant as a structured row with consistent column alignment.
| Column | Content | Behavior |
|--------|---------|----------|
| Initiative | Number or placeholder | Text input with `inputmode="numeric"`, no spinners, direct typing only |
| Name | Combatant name | Inline editable, click-to-edit. Truncates with ellipsis |
| HP | currentHp / maxHp | Text inputs with `inputmode="numeric"`, no spinners, direct entry for both values |
| Actions | Remove icon button | Compact icon (X or trash), tooltip on hover |
**Numeric field styling**: All numeric inputs use `type="text"` with `inputmode="numeric"` to suppress browser spinners while showing the numeric keyboard on mobile. Initiative uses `6ch` width (12 digit values typical). HP fields use `7ch` width (supports up to 4-digit values like 1000). All use tabular numerals (`font-variant-numeric: tabular-nums`) for column alignment and centered text.
**Visual states**:
- Default row
- Active row (highlighted background/border for current turn)
- Editing state (inline input replaces display text)
### ActionBar
Groups primary encounter controls.
| Element | Type | Behavior |
|---------|------|----------|
| Name input | Text input | Enter combatant name |
| Add button | Primary button | Adds combatant to encounter |
| Next Turn button | Secondary/outline button | Advances to next combatant |
### EncounterHeader
Displays encounter status.
| Element | Content |
|---------|---------|
| Title | "Initiative Tracker" |
| Status | Round number and active combatant name |
### EmptyState
Displayed when combatants list is empty.
| Element | Content |
|---------|---------|
| Message | "No combatants yet" or similar |
| Hint | Prompt to add first combatant |