[medium] Discipline UI doesn't show other requirements (prerequisites) for practicing #133
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
UI Issue: Discipline cards don't show prerequisite requirements
Description
Some disciplines have a
requiresfield (array of discipline IDs that must be completed first), but this is never shown in the UI. Players can't tell why they can't activate a discipline.Current State
DisciplineDefinition.requires?: string[]exists in the type systemstudy-advanced-weapon-enchantmentshasrequires: ['study-basic-weapon-enchantments']study-intermediate-spell-enchantmentshasrequires: ['study-basic-spell-enchantments']study-special-enchantmentshasrequires: ['study-advanced-weapon-enchantments']DisciplineCardDefinitioninterface does NOT includerequiresDisciplineCardcomponent never renders requirementsactivate()function indiscipline-slice.tscheckscanProceedDiscipline()but the UI gives no feedbackExpected Behavior
Each discipline card should show:
Files Involved
src/components/game/tabs/DisciplinesTab.tsx—DisciplineCardDefinitionneedsrequires, card needs to render locked statesrc/lib/game/types/disciplines.ts—DisciplineDefinition.requiresalready existssrc/lib/game/stores/discipline-slice.ts—canProceedDiscipline()already checks requirements but UI doesn't reflect themSuggested Fix
requires?: string[]toDisciplineCardDefinitionrequiresfrom discipline definitions in the tab mappingFix applied for Issue #133: Discipline cards now show prerequisites and locked state
Changes Made
New utility function (
src/lib/game/utils/discipline-math.ts):checkDisciplinePrerequisites()— checks if a discipline'srequiresprerequisites are met by looking at discipline states (XP > 0 means unlocked). Returns{ canProceed: boolean, missingPrereqs: string[] }with human-readable names of missing prerequisites.Store enforcement (
src/lib/game/stores/discipline-slice.ts):activate()to callcheckDisciplinePrerequisites()and block activation if prerequisites aren't met.UI component (
src/components/game/tabs/DisciplinesTab.tsx):isLockedandmissingPrereqstoDisciplineCardRuntimeinterfacerequirestoDisciplineCardDefinitioninterfacecheckDisciplinePrerequisites()to determine locked state per cardVerification: TypeScript compiles cleanly, all 42 discipline-math tests + 11 store-discipline tests pass.
Fixed — discipline cards now show prerequisites, locked state, and which requirements are missing.