'use client'; import { GameCard, ElementBadge, ActionButton } from '@/components/ui'; import { Button } from '@/components/ui/button'; import { ELEMENTS } from '@/lib/game/constants'; interface LabTabProps { store: { rawMana: number; elements: Record; skills: Record; craftComposite: (target: string) => void; }; } export function LabTab({ store }: LabTabProps) { // Render elemental mana grid - only show elements with current > 0 const renderElementsGrid = () => (
{Object.entries(store.elements || {}) .filter(([, state]) => state.unlocked && state.current > 0) .map(([id, state]) => { const def = ELEMENTS[id]; return (
{def?.name}
{state.current}/{state.max}
); })}
); // Render composite crafting const renderCompositeCrafting = () => { const compositeElements = Object.entries(ELEMENTS) .filter(([, def]) => def.recipe) .filter(([id]) => (store.elements || {})[id]?.unlocked); if (compositeElements.length === 0) return null; return (

Composite Crafting

{compositeElements.map(([id, def]) => { const recipe = def.recipe || []; const canCraft = recipe.every(r => ((store.elements || {})[r]?.current || 0) >= 1); const craftBonus = 1 + (store.skills.elemCrafting || 0) * 0.25; const output = Math.floor(craftBonus); return (
{def.name} ({recipe.map(r => { const rDef = ELEMENTS[r]; return rDef?.sym || r; }).join(' + ')})
); })}
); }; // Check if there are any unlocked elements with current > 0 const hasUnlockedElements = Object.values(store.elements || {}).some(e => e.unlocked && e.current > 0); if (!hasUnlockedElements) { return (
No elemental mana available. Gather or convert mana to see elemental pools.
); } return (
{/* Elemental Mana Display */}

Elemental Mana

{renderElementsGrid()}
{/* Composite Crafting */} {renderCompositeCrafting()}
); } LabTab.displayName = "LabTab";