refactor: resolve structural inconsistencies and dead code
Build and Publish Mana Loop Docker Image / build-and-publish (push) Failing after 55s

- 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
This commit is contained in:
2026-05-18 14:21:59 +02:00
parent 2805f75f5e
commit ca86b6268c
57 changed files with 405 additions and 3726 deletions
+69
View File
@@ -0,0 +1,69 @@
'use client';
import { createContext, useContext, useState, useEffect, type ReactNode } from 'react';
interface DebugContextType {
showComponentNames: boolean;
toggleComponentNames: () => void;
}
const DebugContext = createContext<DebugContextType | null>(null);
export function DebugProvider({ children }: { children: ReactNode }) {
// Initialize from localStorage if available
const [showComponentNames, setShowComponentNames] = useState(() => {
if (typeof window !== 'undefined') {
const saved = localStorage.getItem('debug-show-component-names');
return saved === 'true';
}
return false;
});
const toggleComponentNames = () => {
setShowComponentNames(prev => {
const newValue = !prev;
localStorage.setItem('debug-show-component-names', String(newValue));
return newValue;
});
};
return (
<DebugContext.Provider value={{ showComponentNames, toggleComponentNames }}>
{children}
</DebugContext.Provider>
);
}
export function useDebug() {
const context = useContext(DebugContext);
if (!context) {
// Return default values if used outside provider
return { showComponentNames: false, toggleComponentNames: () => {} };
}
return context;
}
// Wrapper component to show component name in debug mode
interface DebugNameProps {
name: string;
children: ReactNode;
}
export function DebugName({ name, children }: DebugNameProps) {
const { showComponentNames } = useDebug();
if (!showComponentNames) {
return <>{children}</>;
}
return (
<div className="relative">
<div className="absolute -top-5 left-0 text-[10px] font-mono text-yellow-400 bg-yellow-900/50 px-1 rounded z-50">
{name}
</div>
{children}
</div>
);
}
DebugName.displayName = "DebugName";