Add rules edition setting for condition tooltips (5e/5.5e)
All checks were successful
CI / check (push) Successful in 1m8s
CI / build-image (push) Successful in 16s

Introduce a settings modal (opened from the kebab menu) with a rules
edition selector for condition tooltip descriptions and a theme picker
replacing the inline cycle button. About half the conditions have
meaningful mechanical differences between editions.

- Add description5e field to ConditionDefinition with 5e (2014) text
- Add RulesEditionProvider context with localStorage persistence
- Create SettingsModal with Conditions and Theme sections
- Wire condition tooltips to edition-aware descriptions
- Fix 6 inaccurate 5.5e condition descriptions
- Update spec 003 with stories CC-3, CC-8 and FR-095–FR-102

Closes #12

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Lukas
2026-03-24 17:08:41 +01:00
parent cfd4aef724
commit 4043612ccf
18 changed files with 663 additions and 82 deletions

View File

@@ -229,12 +229,13 @@ Acceptance scenarios:
2. **Given** the condition picker is open, **When** the user clicks an active condition, **Then** it is toggled off and removed from the row.
3. **Given** a combatant with one condition and it is removed, **Then** only the hover-revealed "+" button remains.
**Story CC-3 — View Condition Name via Tooltip (P2)**
As a DM, I want to hover over a condition icon to see its name so I can identify conditions without memorizing icons.
**Story CC-3 — View Condition Details via Tooltip (P2)**
As a DM, I want to hover over a condition icon to see its name and rules description so I can quickly reference the condition's effects during play.
Acceptance scenarios:
1. **Given** a combatant has an active condition, **When** the user hovers over its icon, **Then** a tooltip shows the condition name (e.g., "Blinded").
1. **Given** a combatant has an active condition, **When** the user hovers over its icon, **Then** a tooltip shows the condition name and its rules description matching the selected edition.
2. **Given** the user moves the cursor away from the icon, **Then** the tooltip disappears.
3. **Given** the rules edition is set to 5e (2014), **When** the user hovers over "Exhaustion", **Then** the tooltip shows the 2014 exhaustion rules (6-level escalating table). **When** the edition is 5.5e (2024), **Then** the tooltip shows the 2024 rules (2 per level to d20 tests, 5 ft speed per level).
**Story CC-4 — Multiple Conditions (P2)**
As a DM, I want to apply multiple conditions to a single combatant so I can track complex combat situations.
@@ -272,9 +273,21 @@ Acceptance scenarios:
3. **Given** a combatant is NOT concentrating, **When** damage is taken, **Then** no pulse/flash occurs.
4. **Given** a concentrating combatant takes damage, **When** the animation completes, **Then** the row returns to its normal concentration-active appearance.
**Story CC-8 — Rules Edition Setting (P2)**
As a DM who plays in both 5e (2014) and 5.5e (2024) groups, I want to choose which edition's condition descriptions appear in tooltips so I reference the correct rules for the game I am running.
Acceptance scenarios:
1. **Given** the user opens the kebab menu, **When** they click "Settings", **Then** a settings modal opens.
2. **Given** the settings modal is open, **When** viewing the Conditions section, **Then** a rules edition selector shows 5e (2014) and 5.5e (2024) with 5.5e selected by default.
3. **Given** the user selects 5e (2014), **When** hovering a condition icon (e.g., Exhaustion), **Then** the tooltip shows the 2014 description.
4. **Given** the user selects 5.5e (2024), **When** hovering the same condition, **Then** the tooltip shows the 2024 description.
5. **Given** the user changes the edition and reloads the page, **Then** the selected edition is preserved.
6. **Given** a condition with identical rules across editions (e.g., Deafened), **Then** the tooltip text is the same regardless of setting.
7. **Given** the settings modal is open, **When** viewing the Theme section, **Then** a System / Light / Dark selector is available, replacing the inline cycle button in the kebab menu.
### Requirements
- **FR-032**: The MVP MUST support the following 15 standard D&D 5e conditions: blinded, charmed, deafened, exhaustion, frightened, grappled, incapacitated, invisible, paralyzed, petrified, poisoned, prone, restrained, stunned, unconscious.
- **FR-032**: The MVP MUST support the following 15 standard D&D 5e/5.5e conditions: blinded, charmed, deafened, exhaustion, frightened, grappled, incapacitated, invisible, paralyzed, petrified, poisoned, prone, restrained, stunned, unconscious.
- **FR-033**: Each condition MUST have a fixed icon and color mapping (Lucide icons; no emoji):
| Condition | Icon | Color |
@@ -301,7 +314,7 @@ Acceptance scenarios:
- **FR-037**: Clicking "+" MUST open the compact condition picker showing all conditions as icon + label pairs.
- **FR-038**: Clicking a condition in the picker MUST toggle it on or off.
- **FR-039**: Clicking an active condition icon tag in the row MUST remove that condition.
- **FR-040**: Hovering an active condition icon MUST show a tooltip with the condition name.
- **FR-040**: Hovering an active condition icon MUST show a tooltip with the condition name and its rules description for the selected edition.
- **FR-041**: Condition icons MUST NOT increase the row's width; row height MAY increase to accommodate wrapping.
- **FR-042**: The condition picker MUST close when the user clicks outside of it.
- **FR-043**: Conditions MUST persist as part of combatant state (surviving page reload).
@@ -327,6 +340,9 @@ Acceptance scenarios:
- When concentration is toggled during an active pulse animation, the animation cancels and the new state applies immediately.
- Multiple combatants may concentrate simultaneously; concentration is independent per combatant.
- Conditions have no mechanical effects in the MVP baseline (no auto-disadvantage, no automation).
- When the rules edition preference is missing from localStorage, the system defaults to 5.5e (2024).
- Changing the edition while a condition tooltip is visible updates the tooltip on next hover (no live update required).
- The settings modal is app-level UI; it does not interact with encounter state.
---
@@ -472,6 +488,14 @@ Acceptance scenarios:
- **FR-092**: The "Initiative Tracker" heading MUST be removed to maximize vertical space for combatants.
- **FR-093**: All interactive elements in the row MUST remain keyboard-accessible (focusable and operable via keyboard).
- **FR-094**: On touch devices, hover-only controls ("+" button, "x" button) MUST remain accessible via tap or focus.
- **FR-095**: The system MUST provide a settings modal accessible via a "Settings" item in the kebab overflow menu.
- **FR-096**: The settings modal MUST include a Conditions section with a rules edition selector offering two options: 5e (2014) and 5.5e (2024).
- **FR-097**: The default rules edition MUST be 5.5e (2024).
- **FR-098**: Each condition definition MUST carry a description for both editions. Conditions with identical rules across editions MAY share a single description value.
- **FR-099**: Condition tooltips MUST display the description corresponding to the active rules edition preference.
- **FR-100**: The rules edition preference MUST persist across sessions via localStorage (key `"initiative:rules-edition"`).
- **FR-101**: The settings modal MUST include a Theme section with System / Light / Dark options, replacing the inline theme cycle button in the kebab menu.
- **FR-102**: The settings modal MUST close on Escape, click-outside, or the close button.
### Edge Cases
@@ -515,3 +539,6 @@ Acceptance scenarios:
- **SC-028**: The AC number is visually identifiable as armor class through the shield shape alone.
- **SC-029**: No layout shift occurs when hovering/unhovering rows.
- **SC-030**: All HP, AC, initiative, condition, and concentration interactions remain fully operable using only a keyboard.
- **SC-031**: The user can switch rules edition in 2 interactions (open settings → select edition).
- **SC-032**: Condition tooltips accurately reflect the selected edition's rules text for all conditions that differ between editions.
- **SC-033**: The rules edition preference survives a full page reload.