fix: migrate golemancy/activity/achievements, fix CraftingTab/SkillsTab/SpireTab/GolemancyTab/AchievementsTab store reads
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 2m1s

This commit is contained in:
Refactoring Agent
2026-05-05 16:11:28 +02:00
parent ed616738fd
commit ed69a8f2b4
9 changed files with 352 additions and 140 deletions
+8 -8
View File
@@ -1,16 +1,16 @@
'use client';
import { AchievementsDisplay } from '@/components/game/AchievementsDisplay';
import { useGameStore } from '@/lib/game/stores';
import { useCombatStore, useManaStore, usePrestigeStore } from '@/lib/game/stores';
export function AchievementsTab() {
const achievements = useGameStore((s) => s.achievements);
const maxFloorReached = useGameStore((s) => s.maxFloorReached);
const totalManaGathered = useGameStore((s) => s.totalManaGathered);
const signedPacts = useGameStore((s) => s.signedPacts);
const totalSpellsCast = useGameStore((s) => s.totalSpellsCast);
const totalDamageDealt = useGameStore((s) => s.totalDamageDealt);
const totalCraftsCompleted = useGameStore((s) => s.totalCraftsCompleted);
const achievements = useCombatStore((s) => s.achievements);
const maxFloorReached = useCombatStore((s) => s.maxFloorReached);
const totalManaGathered = useManaStore((s) => s.totalManaGathered);
const signedPacts = usePrestigeStore((s) => s.signedPacts);
const totalSpellsCast = useCombatStore((s) => s.totalSpellsCast);
const totalDamageDealt = useCombatStore((s) => s.totalDamageDealt);
const totalCraftsCompleted = useCombatStore((s) => s.totalCraftsCompleted);
return (
<div className="space-y-4">
+11 -11
View File
@@ -13,18 +13,18 @@ import {
EnchantmentApplier,
EquipmentCrafter,
} from '@/components/game/crafting';
import { useGameStore } from '@/lib/game/stores';
import { useCombatStore, useCraftingStore } from '@/lib/game/stores';
import { useGameToast } from '@/components/game/GameToast';
export function CraftingTab() {
const showToast = useGameToast();
const currentAction = useGameStore((s) => s.currentAction);
const designProgress = useGameStore((s) => s.designProgress);
const preparationProgress = useGameStore((s) => s.preparationProgress);
const applicationProgress = useGameStore((s) => s.applicationProgress);
const equipmentCraftingProgress = useGameStore((s) => s.equipmentCraftingProgress);
const pauseApplication = useGameStore((s) => s.pauseApplication);
const resumeApplication = useGameStore((s) => s.resumeApplication);
const currentAction = useCombatStore((s) => s.currentAction);
const designProgress = useCraftingStore((s) => s.designProgress);
const preparationProgress = useCraftingStore((s) => s.preparationProgress);
const applicationProgress = useCraftingStore((s) => s.applicationProgress);
const equipmentCraftingProgress = useCraftingStore((s) => s.equipmentCraftingProgress);
const pauseApplication = useCraftingStore((s) => s.pauseApplication);
const resumeApplication = useCraftingStore((s) => s.resumeApplication);
const [activeTab, setActiveTab] = useState<'fabricate' | 'enchant'>('fabricate');
const [enchantStage, setEnchantStage] = useState<'design' | 'prepare' | 'apply'>('design');
@@ -176,7 +176,7 @@ export function CraftingTab() {
<SectionHeader
title="Designing Enchantment"
action={
<ActionButton variant="ghost" size="sm" onClick={() => useGameStore.getState().cancelDesign()}>
<ActionButton variant="ghost" size="sm" onClick={() => useCraftingStore.getState().cancelDesign()}>
Cancel
</ActionButton>
}
@@ -198,7 +198,7 @@ export function CraftingTab() {
<SectionHeader
title="Preparing Equipment"
action={
<ActionButton variant="ghost" size="sm" onClick={() => useGameStore.getState().cancelPreparation()}>
<ActionButton variant="ghost" size="sm" onClick={() => useCraftingStore.getState().cancelPreparation()}>
Cancel
</ActionButton>
}
@@ -230,7 +230,7 @@ export function CraftingTab() {
<>
<ActionButton variant="secondary" size="sm" onClick={pauseApplication}>Pause</ActionButton>
<ActionButton variant="ghost" size="sm" onClick={() => {
useGameStore.getState().cancelApplication();
useCraftingStore.getState().cancelApplication();
showToast('warning', 'Enchantment Cancelled', 'The enchantment application was cancelled.');
}}>Cancel</ActionButton>
</>
+4 -4
View File
@@ -9,16 +9,16 @@ import {
} from 'lucide-react';
import { GOLEMS_DEF, getGolemSlots, isGolemUnlocked, getGolemDamage, getGolemAttackSpeed, getGolemFloorDuration } from '@/lib/game/data/golems';
import { ELEMENTS } from '@/lib/game/constants';
import { useGameStore, useManaStore, useSkillStore, useCombatStore, useAttunementStore } from '@/lib/game/stores';
import { useManaStore, useSkillStore, useCombatStore, useAttunementStore } from '@/lib/game/stores';
export function GolemancyTab() {
const attunements = useAttunementStore((s) => s.attunements);
const elements = useManaStore((s) => s.elements);
const skills = useSkillStore((s) => s.skills);
const golemancy = useGameStore((s) => s.golemancy);
const golemancy = useCombatStore((s) => s.golemancy);
const currentFloor = useCombatStore((s) => s.currentFloor);
const currentRoom = useGameStore((s) => s.currentRoom);
const toggleGolem = useGameStore((s) => s.toggleGolem);
const currentRoom = useCombatStore((s) => s.currentRoom);
const toggleGolem = useCombatStore((s) => s.toggleGolem);
const rawMana = useManaStore((s) => s.rawMana);
// Get Fabricator level and golem slots
+4 -4
View File
@@ -39,7 +39,7 @@ import { ChevronDown, ChevronRight } from 'lucide-react';
import { SkillRow } from './SkillRow';
import { useSkillUpgradeSelection } from '@/lib/game/hooks/useSkillUpgradeSelection';
import { CategorySkillsList } from './CategorySkillsList';
import { useGameStore, useSkillStore, usePrestigeStore } from '@/lib/game/stores';
import { useSkillStore, usePrestigeStore } from '@/lib/game/stores';
export function SkillsTab() {
const showToast = useGameToast();
@@ -55,11 +55,11 @@ export function SkillsTab() {
const skillUpgrades = useSkillStore((s) => s.skillUpgrades);
const skillTiers = useSkillStore((s) => s.skillTiers);
const prestigeUpgrades = usePrestigeStore((s) => s.prestigeUpgrades);
const currentStudyTarget = useGameStore((s) => s.currentStudyTarget);
const parallelStudyTarget = useGameStore((s) => s.parallelStudyTarget);
const currentStudyTarget = useSkillStore((s) => s.currentStudyTarget);
const parallelStudyTarget = useSkillStore((s) => s.parallelStudyTarget);
const startStudyingSkill = useSkillStore((s) => s.startStudyingSkill);
const startParallelStudySkill = useSkillStore((s) => s.startParallelStudySkill);
const cancelStudy = useGameStore((s) => s.cancelStudy);
const cancelStudy = useSkillStore((s) => s.cancelStudy);
const commitSkillUpgrades = useSkillStore((s) => s.commitSkillUpgrades);
const tierUpSkill = useSkillStore((s) => s.tierUpSkill);
+13 -13
View File
@@ -12,7 +12,7 @@ import { getActiveEquipmentSpells, getTotalDPS } from '@/lib/game/computed-stats
import { getUnifiedEffects } from '@/lib/game/effects';
import { formatSpellCost, getSpellCostColor } from '@/lib/game/formatting';
import { canAffordSpellCost, getFloorElement } from '@/lib/game/stores';
import { useGameStore, useManaStore, useSkillStore, useCombatStore, usePrestigeStore, useCraftingStore } from '@/lib/game/stores';
import { useManaStore, useSkillStore, useCombatStore, usePrestigeStore, useCraftingStore } from '@/lib/game/stores';
import { GOLEMS_DEF, getGolemDamage, getGolemAttackSpeed } from '@/lib/game/data/golems';
// Extracted components
@@ -52,16 +52,16 @@ export function SpireTab({ simpleMode = false }: SpireTabProps) {
const activeSpell = useCombatStore((s) => s.activeSpell);
const startClimbUp = useCombatStore((s) => s.startClimbUp);
const startClimbDown = useCombatStore((s) => s.startClimbDown);
const enterSpireMode = useGameStore((s) => s.enterSpireMode);
const spireMode = useGameStore((s) => s.spireMode);
const climbDirection = useGameStore((s) => s.climbDirection) || 'up';
const clearedFloors = useGameStore((s) => s.clearedFloors || {});
const currentRoom = useGameStore((s) => s.currentRoom);
const equipmentSpellStates = useGameStore((s) => s.equipmentSpellStates);
const golemancy = useGameStore((s) => s.golemancy);
const activityLog = useGameStore((s) => s.activityLog);
const currentStudyTarget = useGameStore((s) => s.currentStudyTarget);
const parallelStudyTarget = useGameStore((s) => s.parallelStudyTarget);
const enterSpireMode = useCombatStore((s) => s.enterSpireMode);
const spireMode = useCombatStore((s) => s.spireMode);
const climbDirection = useCombatStore((s) => s.climbDirection) || 'up';
const clearedFloors = useCombatStore((s) => s.clearedFloors || {});
const currentRoom = useCombatStore((s) => s.currentRoom);
const equipmentSpellStates = useCombatStore((s) => s.equipmentSpellStates);
const golemancy = useCombatStore((s) => s.golemancy);
const activityLog = useCombatStore((s) => s.activityLog);
const currentStudyTarget = useSkillStore((s) => s.currentStudyTarget);
const parallelStudyTarget = useSkillStore((s) => s.parallelStudyTarget);
const signedPacts = usePrestigeStore((s) => s.signedPacts);
const skills = useSkillStore((s) => s.skills);
const skillUpgrades = useSkillStore((s) => s.skillUpgrades);
@@ -73,8 +73,8 @@ export function SpireTab({ simpleMode = false }: SpireTabProps) {
const designProgress = useCraftingStore((s) => s.designProgress);
const designProgress2 = useCraftingStore((s) => s.designProgress2);
const preparationProgress = useCraftingStore((s) => s.preparationProgress);
const applicationProgress = useGameStore((s) => s.applicationProgress);
const equipmentCraftingProgress = useGameStore((s) => s.equipmentCraftingProgress);
const applicationProgress = useCraftingStore((s) => s.applicationProgress);
const equipmentCraftingProgress = useCraftingStore((s) => s.equipmentCraftingProgress);
// Derived data
const floorElem = getFloorElement(currentFloor);