'use client'; import { useState } from 'react'; import { Button } from '@/components/ui/button'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Separator } from '@/components/ui/separator'; import { Switch } from '@/components/ui/switch'; import { Label } from '@/components/ui/label'; import { RotateCcw, AlertTriangle, Zap, Clock, Eye, } from 'lucide-react'; import { useDebug } from '@/components/game/debug/debug-context'; import { useGameStore, useManaStore, useUIStore, useCombatStore } from '@/lib/game/stores'; import { computeMaxMana } from '@/lib/game/stores'; // ─── Display Options ───────────────────────────────────────────────────────── function DisplayOptions() { const { showComponentNames, toggleComponentNames } = useDebug(); return ( Display Options Show Component Names Display component names at the top of each component for debugging ); } // ─── Game Reset Section ────────────────────────────────────────────────────── function GameResetSection({ confirmReset, onReset }: { confirmReset: boolean; onReset: () => void }) { return ( Game Reset Reset all game progress and start fresh. This cannot be undone. {confirmReset ? ( <> Click Again to Confirm Reset > ) : ( <> Reset Game > )} ); } // ─── Mana Debug Section ────────────────────────────────────────────────────── function ManaDebugSection({ rawMana, onAddMana, onFillMana }: { rawMana: number; onAddMana: (amount: number) => void; onFillMana: () => void; }) { const maxMana = computeMaxMana( { skills: {}, prestigeUpgrades: {}, skillUpgrades: {}, skillTiers: {} } ); return ( Mana Debug Current: {rawMana} / {maxMana || '?'} onAddMana(10)}> +10 onAddMana(100)}> +100 onAddMana(1000)}> +1K onAddMana(10000)}> +10K Fill to max: Fill Mana ); } // ─── Time Control Section ──────────────────────────────────────────────────── function TimeControlSection({ day, hour, paused, onSetDay, onTogglePause }: { day: number; hour: number; paused: boolean; onSetDay: (day: number) => void; onTogglePause: () => void; }) { return ( Time Control Current: Day {day}, Hour {hour} onSetDay(1)}>Day 1 onSetDay(10)}>Day 10 onSetDay(20)}>Day 20 onSetDay(30)}>Day 30 {paused ? '▶ Resume' : '⏸ Pause'} ); } // ─── Quick Actions Section ─────────────────────────────────────────────────── function QuickActionsSection({ elements, onUnlockBase, onSkipToFloor, onResetFloorHP }: { elements: Record; onUnlockBase: () => void; onSkipToFloor: () => void; onResetFloorHP: () => void; }) { return ( Quick Actions Unlock All Base Elements Skip to Floor 100 Reset Floor HP ); } // ─── Main Component ─────────────────────────────────────────────────────────── export function GameStateDebugSection() { const [confirmReset, setConfirmReset] = useState(false); const { showComponentNames, toggleComponentNames } = useDebug(); const rawMana = useManaStore((s) => s.rawMana); const day = useGameStore((s) => s.day); const hour = useGameStore((s) => s.hour); const paused = useUIStore((s) => s.paused); const togglePause = useUIStore((s) => s.togglePause); const resetGame = useGameStore((s) => s.resetGame); const gatherMana = useGameStore((s) => s.gatherMana); const debugSetFloor = useCombatStore((s) => s.debugSetFloor); const resetFloorHP = useCombatStore((s) => s.resetFloorHP); const elements = useManaStore((s) => s.elements); const unlockElement = useManaStore((s) => s.unlockElement); const handleReset = () => { if (confirmReset) { resetGame(); setConfirmReset(false); } else { setConfirmReset(true); setTimeout(() => setConfirmReset(false), 3000); } }; const handleAddMana = (amount: number) => { for (let i = 0; i < amount; i++) { gatherMana(); } }; const handleFillMana = () => { const maxMana = computeMaxMana( { skills: {}, prestigeUpgrades: {}, skillUpgrades: {}, skillTiers: {} } ) || 100; useManaStore.setState((s) => ({ rawMana: Math.max(s.rawMana, maxMana) })); }; const handleSetDay = (d: number) => { useGameStore.setState({ day: d, hour: 0 }); }; const handleUnlockBase = () => { ['fire', 'water', 'air', 'earth', 'light', 'dark', 'death'].forEach(e => { if (!elements[e]?.unlocked) { unlockElement(e, 0); } }); }; return ( debugSetFloor?.(100)} onResetFloorHP={() => resetFloorHP?.()} /> ); } GameStateDebugSection.displayName = 'GameStateDebugSection';
Display component names at the top of each component for debugging
Reset all game progress and start fresh. This cannot be undone.