refactor: extract components from SkillsTab.tsx to reduce below 400 lines
Build and Publish Mana Loop Docker Image / build-and-publish (push) Failing after 1m10s

This commit is contained in:
Refactoring Agent
2026-05-01 16:41:29 +02:00
parent 86683fe288
commit f0ab3ca3ce
8 changed files with 422 additions and 232 deletions
@@ -3,6 +3,7 @@
import { useState, useMemo, useCallback, SetStateAction, Dispatch } from 'react';
import type { SkillUpgradeChoice } from '@/lib/game/types';
import { getUpgradesForSkillAtMilestone } from '@/lib/game/skill-evolution';
export interface UseSkillUpgradeSelectionResult {
pendingSelections: string[];
@@ -12,6 +13,36 @@ export interface UseSkillUpgradeSelectionResult {
handleCancel: (onClose: () => void) => void;
}
/**
* Check if skill has milestone available (also exported for use in SkillRow/CategorySkillsList)
*/
export function hasMilestoneUpgrade(
skillId: string,
level: number,
skillTiers: Record<string, number>,
skillUpgrades: Record<string, string[]>
): { milestone: 5 | 10; hasUpgrades: boolean; selectedCount: number } | null {
// Check level 5 milestone
if (level >= 5) {
const upgrades5 = getUpgradesForSkillAtMilestone(skillId, 5, skillTiers);
const selected5 = (skillUpgrades[skillId] || []).filter((id) => id.includes('_l5'));
if (upgrades5.length > 0 && selected5.length < 2) {
return { milestone: 5, hasUpgrades: true, selectedCount: selected5.length };
}
}
// Check level 10 milestone
if (level >= 10) {
const upgrades10 = getUpgradesForSkillAtMilestone(skillId, 10, skillTiers);
const selected10 = (skillUpgrades[skillId] || []).filter((id) => id.includes('_l10'));
if (upgrades10.length > 0 && selected10.length < 2) {
return { milestone: 10, hasUpgrades: true, selectedCount: selected10.length };
}
}
return null;
}
/**
* Hook for managing skill upgrade selection state in the SkillsTab milestone upgrade dialog.
* Manages pending selections across the dialog open/close cycle.
+2 -1
View File
@@ -20,7 +20,8 @@ export type {
SkillTierDef,
SkillPerkChoice,
SkillUpgradeChoice,
PrestigeDef
PrestigeDef,
SkillCost
} from './skills';
// Equipment types