'use client'; import { useState, useEffect } from 'react'; import { Button } from '@/components/ui/button'; import { Mountain } from 'lucide-react'; import { ManaDisplay } from '@/components/game'; import { ActionButtons } from '@/components/game'; import { CalendarDisplay } from '@/components/game'; import { DebugName } from '@/lib/game/debug-context'; import type { GameStore } from '@/lib/game/store'; import { computeMaxMana, computeClickMana, getMeditationBonus } from '@/lib/game/store'; import { getUnifiedEffects } from '@/lib/game/effects'; import { useGameLoop } from '@/lib/game/stores/gameHooks'; interface LeftPanelProps { store: GameStore; effectiveRegen: number; incursionStrength: number; } export function LeftPanel({ store, effectiveRegen, incursionStrength }: LeftPanelProps) { const [isGathering, setIsGathering] = useState(false); const handleGatherStart = () => { setIsGathering(true); store.gatherMana(); }; const handleGatherEnd = () => { setIsGathering(false); }; useEffect(() => { if (!isGathering) return; let lastGatherTime = 0; const minGatherInterval = 100; let animationFrameId: number; const gatherLoop = (timestamp: number) => { if (timestamp - lastGatherTime >= minGatherInterval) { store.gatherMana(); lastGatherTime = timestamp; } animationFrameId = requestAnimationFrame(gatherLoop); }; animationFrameId = requestAnimationFrame(gatherLoop); return () => cancelAnimationFrame(animationFrameId); }, [isGathering, store]); const maxMana = computeMaxMana(store, getUnifiedEffects(store)); const clickMana = computeClickMana(store); const meditationMultiplier = getMeditationBonus(store.meditateTicks, store.skills, getUnifiedEffects(store).meditationEfficiency); return (
{!store.spireMode && ( )} {!store.spireMode && ( )}
); }