'use client'; import { Button } from '@/components/ui/button'; import { Progress } from '@/components/ui/progress'; import { Card, CardContent } from '@/components/ui/card'; import { Zap, ChevronDown, ChevronUp } from 'lucide-react'; import { fmt, fmtDec } from '@/lib/game/store'; import { ELEMENTS } from '@/lib/game/constants'; import { useState } from 'react'; interface ManaDisplayProps { rawMana: number; maxMana: number; effectiveRegen: number; meditationMultiplier: number; clickMana: number; isGathering: boolean; onGatherStart: () => void; onGatherEnd: () => void; elements: Record; } export function ManaDisplay({ rawMana, maxMana, effectiveRegen, meditationMultiplier, clickMana, isGathering, onGatherStart, onGatherEnd, elements, }: ManaDisplayProps) { const [expanded, setExpanded] = useState(true); // Get unlocked elements with current > 0, sorted by current amount const unlockedElements = Object.entries(elements) .filter(([, state]) => state.unlocked && state.current > 0) .sort((a, b) => b[1].current - a[1].current); return ( {/* Raw Mana - Main Display */}
{fmt(rawMana)} / {fmt(maxMana)}
+{fmtDec(effectiveRegen)} mana/hr {meditationMultiplier > 1.01 && ({fmtDec(meditationMultiplier, 1)}x med)}
{/* Elemental Mana Pools */} {unlockedElements.length > 0 && (
{expanded && (
{unlockedElements.map(([id, state]) => { const elem = ELEMENTS[id]; if (!elem) return null; return (
{elem.sym} {elem.name}
{fmt(state.current)}/{fmt(state.max)}
); })}
)}
)} ); }