Bug: Perks displayed as "infinite 0", "capped 1" instead of human-readable text #145

Closed
opened 2026-05-27 10:22:51 +02:00 by Anexim · 2 comments
Owner

Bug Description

In the Disciplines tab, unlocked perks are displayed as internal type strings like "infinite 0", "capped 1", "once 0" instead of their human-readable descriptions.

Root Cause

In src/components/game/tabs/DisciplinesTab.tsx lines 100-113, the unlockedPerks array is built by constructing strings like `${typ}-${idx}` where typ is the raw enum value ('infinite' | 'once' | 'capped'). The render code at lines 141-154 only applies a cosmetic regex .replace(/-([0-9]+)$/, ' $1').

The DisciplinePerk type (src/lib/game/types/disciplines.ts line 23) already has a description: string field with human-readable text (e.g. "+50 Max Mana", "Every 100 XP: +25 Max Mana"), but it is never used in the rendering.

Fix Required

Change the unlockedPerks builder at lines 100-113 to store the perk's description field instead of `${typ}-${idx}`. Update the render at lines 141-154 to display the description string directly.

Affected Files

  • src/components/game/tabs/DisciplinesTab.tsx — lines 100-113 (unlockedPerks builder) and lines 141-154 (perk rendering)
  • src/lib/game/types/disciplines.tsDisciplinePerk.description field (already exists, just unused)
## Bug Description In the Disciplines tab, unlocked perks are displayed as internal type strings like `"infinite 0"`, `"capped 1"`, `"once 0"` instead of their human-readable descriptions. ## Root Cause In `src/components/game/tabs/DisciplinesTab.tsx` lines 100-113, the `unlockedPerks` array is built by constructing strings like `` `${typ}-${idx}` `` where `typ` is the raw enum value (`'infinite'` | `'once'` | `'capped'`). The render code at lines 141-154 only applies a cosmetic regex `.replace(/-([0-9]+)$/, ' $1')`. The `DisciplinePerk` type (`src/lib/game/types/disciplines.ts` line 23) already has a `description: string` field with human-readable text (e.g. `"+50 Max Mana"`, `"Every 100 XP: +25 Max Mana"`), but it is never used in the rendering. ## Fix Required Change the `unlockedPerks` builder at lines 100-113 to store the perk's `description` field instead of `` `${typ}-${idx}` ``. Update the render at lines 141-154 to display the description string directly. ## Affected Files - `src/components/game/tabs/DisciplinesTab.tsx` — lines 100-113 (unlockedPerks builder) and lines 141-154 (perk rendering) - `src/lib/game/types/disciplines.ts` — `DisciplinePerk.description` field (already exists, just unused)
Anexim added the ai:todo label 2026-05-27 10:22:51 +02:00
n8n-gitea was assigned by Anexim 2026-05-27 10:22:51 +02:00
Author
Owner

Starting work on #145 — Perks show "infinite 0", "capped 1" instead of human-readable text. Will fix the unlockedPerks builder and rendering in DisciplinesTab.tsx.

Starting work on #145 — Perks show "infinite 0", "capped 1" instead of human-readable text. Will fix the unlockedPerks builder and rendering in DisciplinesTab.tsx.
Author
Owner

Fixed #145 — Perks now show human-readable descriptions instead of "infinite 0", "capped 1".

Root cause: The unlockedPerks array was built from raw type strings (${typ}-${idx}) and the render only applied a cosmetic regex. The DisciplinePerk.description field existed but was never used.

Fix:

  • Added perkDescriptions to DisciplineCardDefinition and passed it from the parent
  • Changed unlockedPerks builder to store perkDescriptions[idx] instead of ${typ}-${idx}
  • Updated render to display the description string directly

All 902 tests pass. Committed and pushed as a6dd947.

Fixed #145 — Perks now show human-readable descriptions instead of "infinite 0", "capped 1". **Root cause**: The `unlockedPerks` array was built from raw type strings (`${typ}-${idx}`) and the render only applied a cosmetic regex. The `DisciplinePerk.description` field existed but was never used. **Fix**: - Added `perkDescriptions` to `DisciplineCardDefinition` and passed it from the parent - Changed `unlockedPerks` builder to store `perkDescriptions[idx]` instead of `${typ}-${idx}` - Updated render to display the description string directly All 902 tests pass. Committed and pushed as a6dd947.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#145