From ca86b6268ca35a16b2b74dabd43753ce00dea3e7 Mon Sep 17 00:00:00 2001 From: n8n-gitea Date: Mon, 18 May 2026 14:21:59 +0200 Subject: [PATCH] refactor: resolve structural inconsistencies and dead code - Fix broken barrel exports in components/game/index.ts - Remove skill system from stores (gameStore, gameActions, gameLoopActions, gameHooks, craftingStore, combat) - Remove skill system from components (page.tsx, LeftPanel, StatsTab, SpellsTab, EnchantmentDesigner, EnchantmentPreparer, GameContext/Provider) - Delete dead code: stats/ directory, attunements/ directory, layout/ Header+TabBar, shared/ StudyProgress+UpgradeDialog duplicates, effects.ts.fix, study-slice.ts, navigation-slice.ts - Delete legacy store/ and store-modules/ directories, redirect remaining callers - Merge root formatting.ts into utils/formatting.ts - Move effects files (dynamic-compute, upgrade-effects, special-effects, upgrade-effects.types) into effects/ directory - Move debug-context.tsx into components/game/debug/ - Create tabs/index.ts barrel for tab components - Fix page.tsx lazy imports to use tabs barrel - Fix all broken import paths across codebase - Remove SKILLS_DEF and skill-evolution references - Trim store.ts to under 400 lines by removing dead skill actions --- CLAUDE.md | 43 --- docs/circular-deps.txt | 4 +- docs/dependency-graph.json | 45 +-- docs/project-structure.txt | 44 +-- src/app/components/LeftPanel.tsx | 2 +- src/app/layout.tsx | 2 +- src/app/page.tsx | 90 +---- src/components/game/GameContext/Provider.tsx | 4 +- src/components/game/GameContext/types.ts | 4 +- src/components/game/StudyProgress.tsx | 10 +- src/components/game/UpgradeDialog.tsx | 28 +- src/components/game/debug/GameStateDebug.tsx | 2 +- .../game/debug}/debug-context.tsx | 0 src/components/game/debug/index.tsx | 1 - .../game/shared/MemorySlotPicker.tsx | 52 ++- src/components/game/tabs/index.ts | 6 + src/components/ui/index.ts | 1 - src/lib/game/constants/index.ts | 8 - .../game/crafting-actions/design-actions.ts | 4 +- src/lib/game/crafting-apply.ts | 4 +- src/lib/game/crafting-design.ts | 4 +- src/lib/game/crafting-slice.ts | 6 +- src/lib/game/effects.ts | 10 +- src/lib/game/{ => effects}/dynamic-compute.ts | 0 src/lib/game/{ => effects}/special-effects.ts | 0 src/lib/game/effects/upgrade-effects.ts | 68 ++++ .../{ => effects}/upgrade-effects.types.ts | 0 src/lib/game/hooks/useGameDerived.ts | 176 +++++----- src/lib/game/store-modules/activity-log.ts | 29 -- src/lib/game/store-modules/computed-stats.ts | 208 ------------ src/lib/game/store-modules/enemy-utils.ts | 58 ---- src/lib/game/store-modules/initial-state.ts | 223 ------------- src/lib/game/store-modules/room-utils.ts | 222 ------------ src/lib/game/store-modules/store-actions.ts | 120 ------- src/lib/game/store-modules/tick-logic.ts | 261 --------------- src/lib/game/store.test.ts | 8 +- src/lib/game/store.ts | 196 +++++------ src/lib/game/store/combatSlice.ts | 189 ----------- src/lib/game/store/computed.ts | 315 ------------------ .../store/crafting-modules/initial-state.ts | 23 -- .../game/store/crafting-modules/selectors.ts | 49 --- .../store/crafting-modules/slice-logic.ts | 252 -------------- .../crafting-modules/starting-equipment.ts | 51 --- .../store/crafting-modules/tick-processors.ts | 178 ---------- src/lib/game/store/crafting-modules/types.ts | 66 ---- src/lib/game/store/crafting-modules/utils.ts | 167 ---------- src/lib/game/store/craftingSlice.ts | 29 -- src/lib/game/store/manaSlice.ts | 204 ------------ src/lib/game/store/pactSlice.ts | 180 ---------- src/lib/game/store/prestigeSlice.ts | 128 ------- src/lib/game/store/timeSlice.ts | 82 ----- src/lib/game/stores/gameStore.ts | 2 +- src/lib/game/stores/index.ts | 1 - src/lib/game/types.ts | 12 - src/lib/game/upgrade-effects.ts | 191 ----------- src/lib/game/utils/mana-utils.ts | 2 +- src/lib/game/utils/pact-utils.ts | 67 ++++ 57 files changed, 405 insertions(+), 3726 deletions(-) delete mode 100644 CLAUDE.md rename src/{lib/game => components/game/debug}/debug-context.tsx (100%) create mode 100644 src/components/game/tabs/index.ts rename src/lib/game/{ => effects}/dynamic-compute.ts (100%) rename src/lib/game/{ => effects}/special-effects.ts (100%) create mode 100755 src/lib/game/effects/upgrade-effects.ts rename src/lib/game/{ => effects}/upgrade-effects.types.ts (100%) delete mode 100644 src/lib/game/store-modules/activity-log.ts delete mode 100644 src/lib/game/store-modules/computed-stats.ts delete mode 100644 src/lib/game/store-modules/enemy-utils.ts delete mode 100644 src/lib/game/store-modules/initial-state.ts delete mode 100644 src/lib/game/store-modules/room-utils.ts delete mode 100644 src/lib/game/store-modules/store-actions.ts delete mode 100644 src/lib/game/store-modules/tick-logic.ts delete mode 100755 src/lib/game/store/combatSlice.ts delete mode 100755 src/lib/game/store/computed.ts delete mode 100644 src/lib/game/store/crafting-modules/initial-state.ts delete mode 100644 src/lib/game/store/crafting-modules/selectors.ts delete mode 100644 src/lib/game/store/crafting-modules/slice-logic.ts delete mode 100644 src/lib/game/store/crafting-modules/starting-equipment.ts delete mode 100644 src/lib/game/store/crafting-modules/tick-processors.ts delete mode 100644 src/lib/game/store/crafting-modules/types.ts delete mode 100644 src/lib/game/store/crafting-modules/utils.ts delete mode 100755 src/lib/game/store/craftingSlice.ts delete mode 100755 src/lib/game/store/manaSlice.ts delete mode 100755 src/lib/game/store/pactSlice.ts delete mode 100755 src/lib/game/store/prestigeSlice.ts delete mode 100755 src/lib/game/store/timeSlice.ts delete mode 100755 src/lib/game/upgrade-effects.ts create mode 100644 src/lib/game/utils/pact-utils.ts diff --git a/CLAUDE.md b/CLAUDE.md deleted file mode 100644 index 96186fc..0000000 --- a/CLAUDE.md +++ /dev/null @@ -1,43 +0,0 @@ - -# GitNexus — Code Intelligence - -This project is indexed by GitNexus as **Mana-Loop** (3795 symbols, 6409 relationships, 146 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely. - -> If any GitNexus tool warns the index is stale, run `npx gitnexus analyze` in terminal first. - -## Always Do - -- **MUST run impact analysis before editing any symbol.** Before modifying a function, class, or method, run `gitnexus_impact({target: "symbolName", direction: "upstream"})` and report the blast radius (direct callers, affected processes, risk level) to the user. -- **MUST run `gitnexus_detect_changes()` before committing** to verify your changes only affect expected symbols and execution flows. -- **MUST warn the user** if impact analysis returns HIGH or CRITICAL risk before proceeding with edits. -- When exploring unfamiliar code, use `gitnexus_query({query: "concept"})` to find execution flows instead of grepping. It returns process-grouped results ranked by relevance. -- When you need full context on a specific symbol — callers, callees, which execution flows it participates in — use `gitnexus_context({name: "symbolName"})`. - -## Never Do - -- NEVER edit a function, class, or method without first running `gitnexus_impact` on it. -- NEVER ignore HIGH or CRITICAL risk warnings from impact analysis. -- NEVER rename symbols with find-and-replace — use `gitnexus_rename` which understands the call graph. -- NEVER commit changes without running `gitnexus_detect_changes()` to check affected scope. - -## Resources - -| Resource | Use for | -|----------|---------| -| `gitnexus://repo/Mana-Loop/context` | Codebase overview, check index freshness | -| `gitnexus://repo/Mana-Loop/clusters` | All functional areas | -| `gitnexus://repo/Mana-Loop/processes` | All execution flows | -| `gitnexus://repo/Mana-Loop/process/{name}` | Step-by-step execution trace | - -## CLI - -| Task | Read this skill file | -|------|---------------------| -| Understand architecture / "How does X work?" | `.claude/skills/gitnexus/gitnexus-exploring/SKILL.md` | -| Blast radius / "What breaks if I change X?" | `.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md` | -| Trace bugs / "Why is X failing?" | `.claude/skills/gitnexus/gitnexus-debugging/SKILL.md` | -| Rename / extract / split / refactor | `.claude/skills/gitnexus/gitnexus-refactoring/SKILL.md` | -| Tools, resources, schema reference | `.claude/skills/gitnexus/gitnexus-guide/SKILL.md` | -| Index, status, clean, wiki CLI commands | `.claude/skills/gitnexus/gitnexus-cli/SKILL.md` | - - \ No newline at end of file diff --git a/docs/circular-deps.txt b/docs/circular-deps.txt index d44be8a..daa8704 100644 --- a/docs/circular-deps.txt +++ b/docs/circular-deps.txt @@ -1,8 +1,8 @@ # Circular Dependencies -Generated: 2026-05-18T09:26:29.031Z +Generated: 2026-05-18T10:08:43.704Z Found: 7 circular chain(s) — these MUST be fixed before modifying involved files. -1. Processed 151 files (1.5s) (37 warnings) +1. Processed 142 files (1.3s) (37 warnings) 2. 1) data/equipment/index.ts > data/equipment/utils.ts 3. 2) data/golems/index.ts > data/golems/utils.ts 4. 3) stores/combat-actions.ts > stores/combatStore.ts diff --git a/docs/dependency-graph.json b/docs/dependency-graph.json index ff6229f..a3bc9ac 100644 --- a/docs/dependency-graph.json +++ b/docs/dependency-graph.json @@ -1,26 +1,10 @@ { "_meta": { - "generated": "2026-05-18T09:26:27.302Z", + "generated": "2026-05-18T10:08:42.124Z", "description": "Import dependency graph for src/lib/game. Keys are files, values are arrays of files they import.", "usage": "To find what a file affects, search for its path in the VALUES. To find what a file depends on, look at its KEY entry." }, "graph": { - "attunements/data.ts": [ - "types.ts" - ], - "attunements/index.ts": [ - "attunements/data.ts", - "attunements/types.ts", - "attunements/utils.ts" - ], - "attunements/types.ts": [], - "attunements/utils.ts": [ - "attunements/data.ts", - "attunements/types.ts" - ], - "computed-stats.ts": [ - "utils/index.ts" - ], "constants.ts": [ "constants/index.ts" ], @@ -379,9 +363,6 @@ "types.ts", "utils/discipline-math.ts" ], - "formatting.ts": [ - "computed-stats.ts" - ], "hooks/useGameDerived.ts": [ "constants.ts", "special-effects.ts", @@ -389,10 +370,6 @@ "store/computed.ts", "upgrade-effects.ts" ], - "navigation-slice.ts": [ - "computed-stats.ts", - "types.ts" - ], "special-effects.ts": [ "upgrade-effects.types.ts" ], @@ -528,10 +505,6 @@ "store/crafting-modules/types.ts", "store/crafting-modules/utils.ts" ], - "store/index.ts": [ - "store.ts", - "store/computed.ts" - ], "store/manaSlice.ts": [ "constants.ts", "special-effects.ts", @@ -578,18 +551,14 @@ "stores/craftingStore.ts": [ "crafting-actions/application-actions.ts", "crafting-actions/preparation-actions.ts", - "crafting-apply.ts", "crafting-design.ts", "crafting-equipment.ts", + "crafting-slice.ts", "crafting-utils.ts", - "special-effects.ts", - "store/crafting-modules/starting-equipment.ts", "stores/combatStore.ts", - "stores/gameStore.ts", "stores/manaStore.ts", "stores/uiStore.ts", - "types.ts", - "upgrade-effects.ts" + "types.ts" ], "stores/discipline-slice.ts": [ "data/disciplines/base.ts", @@ -604,7 +573,6 @@ "stores/manaStore.ts", "stores/prestigeStore.ts", "stores/uiStore.ts", - "upgrade-effects.ts", "utils/index.ts" ], "stores/gameHooks.ts": [ @@ -637,7 +605,6 @@ "stores/manaStore.ts", "stores/prestigeStore.ts", "stores/uiStore.ts", - "upgrade-effects.ts", "utils/index.ts" ], "stores/index.ts": [ @@ -662,12 +629,6 @@ "types.ts" ], "stores/uiStore.ts": [], - "study-slice.ts": [ - "constants.ts", - "special-effects.ts", - "types.ts", - "upgrade-effects.ts" - ], "types.ts": [ "data/equipment/types.ts", "types/attunements.ts", diff --git a/docs/project-structure.txt b/docs/project-structure.txt index 7f8125f..3e6c656 100644 --- a/docs/project-structure.txt +++ b/docs/project-structure.txt @@ -103,11 +103,13 @@ Mana-Loop/ │ │ │ │ ├── GameStateDebug.tsx │ │ │ │ ├── GolemDebug.tsx │ │ │ │ ├── PactDebug.tsx +│ │ │ │ ├── debug-context.tsx │ │ │ │ └── index.tsx │ │ │ ├── shared/ │ │ │ │ └── MemorySlotPicker.tsx │ │ │ ├── tabs/ -│ │ │ │ └── DisciplinesTab.tsx +│ │ │ │ ├── DisciplinesTab.tsx +│ │ │ │ └── index.ts │ │ │ ├── AchievementsDisplay.tsx │ │ │ ├── ActionButtons.tsx │ │ │ ├── ActivityLogPanel.tsx @@ -247,34 +249,13 @@ Mana-Loop/ │ │ │ ├── enchantment-types.ts │ │ │ └── loot-drops.ts │ │ ├── effects/ -│ │ │ └── discipline-effects.ts +│ │ │ ├── discipline-effects.ts +│ │ │ ├── dynamic-compute.ts +│ │ │ ├── special-effects.ts +│ │ │ ├── upgrade-effects.ts +│ │ │ └── upgrade-effects.types.ts │ │ ├── hooks/ │ │ │ └── useGameDerived.ts -│ │ ├── store/ -│ │ │ ├── crafting-modules/ -│ │ │ │ ├── initial-state.ts -│ │ │ │ ├── selectors.ts -│ │ │ │ ├── slice-logic.ts -│ │ │ │ ├── starting-equipment.ts -│ │ │ │ ├── tick-processors.ts -│ │ │ │ ├── types.ts -│ │ │ │ └── utils.ts -│ │ │ ├── combatSlice.ts -│ │ │ ├── computed.ts -│ │ │ ├── craftingSlice.ts -│ │ │ ├── manaSlice.ts -│ │ │ ├── pactSlice.ts -│ │ │ ├── prestigeSlice.ts -│ │ │ └── timeSlice.ts -│ │ ├── store-modules/ -│ │ │ ├── {room-utils,enemy-utils,initial-state,activity-log,store-actions}/ -│ │ │ ├── activity-log.ts -│ │ │ ├── computed-stats.ts -│ │ │ ├── enemy-utils.ts -│ │ │ ├── initial-state.ts -│ │ │ ├── room-utils.ts -│ │ │ ├── store-actions.ts -│ │ │ └── tick-logic.ts │ │ ├── stores/ │ │ │ ├── attunementStore.ts │ │ │ ├── combat-actions.ts @@ -308,6 +289,7 @@ Mana-Loop/ │ │ │ ├── formatting.ts │ │ │ ├── index.ts │ │ │ ├── mana-utils.ts +│ │ │ ├── pact-utils.ts │ │ │ └── room-utils.ts │ │ ├── constants.ts │ │ ├── crafting-apply.ts @@ -318,23 +300,17 @@ Mana-Loop/ │ │ ├── crafting-prep.ts │ │ ├── crafting-slice.ts │ │ ├── crafting-utils.ts -│ │ ├── debug-context.tsx -│ │ ├── dynamic-compute.ts │ │ ├── effects.ts -│ │ ├── special-effects.ts │ │ ├── store.test.ts │ │ ├── store.ts │ │ ├── stores.test.ts -│ │ ├── types.ts -│ │ ├── upgrade-effects.ts -│ │ └── upgrade-effects.types.ts +│ │ └── types.ts │ └── utils.ts ├── test-results/ │ └── .last-run.json ├── .dockerignore ├── .gitignore ├── AGENTS.md -├── CLAUDE.md ├── Caddyfile ├── Dockerfile ├── README.md diff --git a/src/app/components/LeftPanel.tsx b/src/app/components/LeftPanel.tsx index 54df15f..15bc323 100644 --- a/src/app/components/LeftPanel.tsx +++ b/src/app/components/LeftPanel.tsx @@ -8,7 +8,7 @@ import { ManaDisplay } from '@/components/game'; import { ActionButtons } from '@/components/game'; import { AttunementStatus } from '@/components/game/AttunementStatus'; import { ActivityLogPanel } from '@/components/game/ActivityLogPanel'; -import { DebugName } from '@/lib/game/debug-context'; +import { DebugName } from '@/components/game/debug/debug-context'; import { useGameStore, useManaStore, useCombatStore, useCraftingStore, usePrestigeStore } from '@/lib/game/stores'; import { getUnifiedEffects } from '@/lib/game/effects'; import { getMeditationBonus, getIncursionStrength } from '@/lib/game/stores'; diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 44725c7..d000018 100755 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -3,7 +3,7 @@ import localFont from "next/font/local"; import "./globals.css"; import { Toaster } from "@/components/ui/toaster"; import { GameToaster } from "@/components/game/GameToast"; -import { DebugProvider } from "@/lib/game/debug-context"; +import { DebugProvider } from "@/components/game/debug/debug-context"; const geistSans = localFont({ src: '../../public/fonts/GeistVF.woff', diff --git a/src/app/page.tsx b/src/app/page.tsx index 1bb12e8..6dda20f 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -31,24 +31,16 @@ import { ScrollArea } from '@/components/ui/scroll-area'; import { TooltipProvider } from '@/components/ui/tooltip'; import { ErrorBoundary } from '@/components/ErrorBoundary'; -import { DebugName } from '@/lib/game/debug-context'; +import { DebugName } from '@/components/game/debug/debug-context'; // Import extracted components import { GameOverScreen } from './components/GameOverScreen'; import { LeftPanel } from './components/LeftPanel'; // Lazy load tab components -const SpireTab = lazy(() => import('@/components/game/tabs').then(module => ({ default: module.SpireTab }))); +const DisciplinesTab = lazy(() => import('@/components/game/tabs').then(module => ({ default: module.DisciplinesTab }))); const SpellsTab = lazy(() => import('@/components/game/tabs').then(module => ({ default: module.SpellsTab }))); - const StatsTab = lazy(() => import('@/components/game/tabs').then(module => ({ default: module.StatsTab }))); -const EquipmentTab = lazy(() => import('@/components/game/tabs').then(module => ({ default: module.EquipmentTab }))); -const AttunementsTab = lazy(() => import('@/components/game/tabs').then(module => ({ default: module.AttunementsTab }))); -const DebugTab = lazy(() => import('@/components/game/tabs').then(module => ({ default: module.DebugTab }))); -const LootTab = lazy(() => import('@/components/game/tabs').then(module => ({ default: module.LootTab }))); -const AchievementsTab = lazy(() => import('@/components/game/tabs').then(module => ({ default: module.AchievementsTab }))); -const GolemancyTab = lazy(() => import('@/components/game/tabs').then(module => ({ default: module.GolemancyTab }))); -const CraftingTab = lazy(() => import('@/components/game/tabs').then(module => ({ default: module.CraftingTab }))); const TabLoadingFallback = () =>
Loading...
; @@ -125,7 +117,7 @@ function GrimoireTab() { export default function ManaLoopGame() { const [selectedManaType, setSelectedManaType] = useState(''); - const [activeTab, setActiveTab] = useState('spire'); + const [activeTab, setActiveTab] = useState('spells'); // ALL hooks must be called before any conditional returns const day = useGameStore((s) => s.day); @@ -208,7 +200,7 @@ export default function ManaLoopGame() { // React to spireMode changes from combat store useEffect(() => { if (spireMode) { - setActiveTab('spire'); // eslint-disable-line react-hooks/set-state-in-effect + setActiveTab('spells'); // eslint-disable-line react-hooks/set-state-in-effect } }, [spireMode]); @@ -240,44 +232,12 @@ export default function ManaLoopGame() {
- ⚔️ Spire - ✨ Attune - 🗿 Golems 🔮 Spells - 🛡️ Gear - 🔧 Craft - 💎 Loot - 🏆 Achieve - 📊 Stats - 🐛 Debug + 📚 Disciplines 📖 Grimoire - - spire tab failed to load.
}> - }> - - - - - - - attunements tab failed to load.}> - }> - - - - - - - golemancy tab failed to load.}> - }> - - - - - spells tab failed to load.}> }> @@ -286,40 +246,6 @@ export default function ManaLoopGame() { - - equipment tab failed to load.}> - }> - - - - - - - crafting tab failed to load.}> - }> - - - - - - - loot tab failed to load.}> - }> - - - - - - - achievements tab failed to load.}> - }> - - - - - - - stats tab failed to load.}> }> @@ -328,10 +254,10 @@ export default function ManaLoopGame() { - - debug tab failed to load.}> + + disciplines tab failed to load.}> }> - + diff --git a/src/components/game/GameContext/Provider.tsx b/src/components/game/GameContext/Provider.tsx index 01e9564..04d8c1a 100644 --- a/src/components/game/GameContext/Provider.tsx +++ b/src/components/game/GameContext/Provider.tsx @@ -6,8 +6,8 @@ import { usePrestigeStore } from '@/lib/game/stores/prestigeStore'; import { useUIStore } from '@/lib/game/stores/uiStore'; import { useCombatStore } from '@/lib/game/stores/combatStore'; import { useGameStore } from '@/lib/game/stores/gameStore'; -import { computeEffects } from '@/lib/game/upgrade-effects'; -import { hasSpecial, SPECIAL_EFFECTS } from '@/lib/game/special-effects'; +import { computeEffects } from '@/lib/game/effects/upgrade-effects'; +import { hasSpecial, SPECIAL_EFFECTS } from '@/lib/game/effects/special-effects'; import { computeMaxMana, computeRegen, diff --git a/src/components/game/GameContext/types.ts b/src/components/game/GameContext/types.ts index b97b077..3d3f07a 100644 --- a/src/components/game/GameContext/types.ts +++ b/src/components/game/GameContext/types.ts @@ -3,8 +3,8 @@ import { useManaStore } from '@/lib/game/stores/manaStore'; import { usePrestigeStore } from '@/lib/game/stores/prestigeStore'; import { useUIStore } from '@/lib/game/stores/uiStore'; import { useCombatStore } from '@/lib/game/stores/combatStore'; -import { computeEffects } from '@/lib/game/upgrade-effects'; -import { hasSpecial, SPECIAL_EFFECTS } from '@/lib/game/special-effects'; +import { computeEffects } from '@/lib/game/effects/upgrade-effects'; +import { hasSpecial, SPECIAL_EFFECTS } from '@/lib/game/effects/special-effects'; import { getBoonBonuses } from '@/lib/game/utils'; // Define a unified store type that combines all stores diff --git a/src/components/game/StudyProgress.tsx b/src/components/game/StudyProgress.tsx index 59f3f9a..43f7159 100755 --- a/src/components/game/StudyProgress.tsx +++ b/src/components/game/StudyProgress.tsx @@ -3,7 +3,7 @@ import { Button } from '@/components/ui/button'; import { Progress } from '@/components/ui/progress'; import { BookOpen, X } from 'lucide-react'; -import { SKILLS_DEF, SPELLS_DEF } from '@/lib/game/constants'; +import { SPELLS_DEF } from '@/lib/game/constants'; import { formatStudyTime } from '@/lib/game/utils/formatting'; import type { StudyTarget } from '@/lib/game/types'; @@ -21,20 +21,20 @@ export function StudyProgress({ cancelStudy, }: StudyProgressProps) { if (!currentStudyTarget) return null; - + const target = currentStudyTarget; const progressPct = Math.min(100, (target.progress / target.required) * 100); const isSkill = target.type === 'skill'; - const def = isSkill ? SKILLS_DEF[target.id] : SPELLS_DEF[target.id]; + const def = isSkill ? undefined : SPELLS_DEF[target.id]; const currentLevel = isSkill ? (skills[target.id] || 0) : 0; - + return (
- {def?.name} + {def?.name ?? target.id} {isSkill && ` Lv.${currentLevel + 1}`}
diff --git a/src/components/game/UpgradeDialog.tsx b/src/components/game/UpgradeDialog.tsx index f88a2d2..a5ffdcf 100755 --- a/src/components/game/UpgradeDialog.tsx +++ b/src/components/game/UpgradeDialog.tsx @@ -1,6 +1,5 @@ 'use client'; -import { SKILLS_DEF } from '@/lib/game/constants'; import type { SkillUpgradeChoice } from '@/lib/game/types'; import { Button } from '@/components/ui/button'; import { Badge } from '@/components/ui/badge'; @@ -32,35 +31,34 @@ export function UpgradeDialog({ onOpenChange, }: UpgradeDialogProps) { if (!skillId) return null; - - const skillDef = SKILLS_DEF[skillId]; + const currentSelections = pendingSelections.length > 0 ? pendingSelections : alreadySelected; - + return ( - Choose Upgrade - {skillDef?.name || skillId} + Choose Upgrade - {skillId} Level {milestone} Milestone - Select 2 upgrades ({currentSelections.length}/2 chosen) - +
{available.map((upgrade) => { const isSelected = currentSelections.includes(upgrade.id); const canToggle = currentSelections.length < 2 || isSelected; - + return (
{ @@ -93,15 +91,15 @@ export function UpgradeDialog({ ); })}
- +
- -