'use client';
import { GameCard } from '@/components/ui/game-card';
import { SectionHeader } from '@/components/ui/section-header';
import { ActionButton } from '@/components/ui/action-button';
import { Badge } from '@/components/ui/badge';
import { ScrollArea } from '@/components/ui/scroll-area';
import { Separator } from '@/components/ui/separator';
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
import { AlertCircle, Wand2, Plus, Minus } from 'lucide-react';
import { ENCHANTMENT_EFFECTS, calculateEffectCapacityCost } from '@/lib/game/data/enchantment-effects';
import type { EffectSelectorProps } from './types';
export function EffectSelector({
selectedEquipmentType,
selectedEffects,
setSelectedEffects,
availableEffects,
incompatibleEffects,
enchantingLevel,
efficiencyBonus,
designProgress,
addEffect,
removeEffect,
getIncompatibilityReason,
}: EffectSelectorProps) {
return (
<>
{enchantingLevel < 1 ? (
Learn Enchanting skill to design enchantments
) : designProgress ? (
Design in progress...
{designProgress.effects.map(eff => {
const def = ENCHANTMENT_EFFECTS[eff.effectId];
return (
{def?.name} x{eff.stacks}
{eff.capacityCost} cap
);
})}
) : !selectedEquipmentType ? (
Select an equipment type first
) : (
<>
{/* Compatible Effects */}
{availableEffects.map(effect => {
const selected = selectedEffects.find(e => e.effectId === effect.id);
const cost = calculateEffectCapacityCost(effect.id, (selected?.stacks || 0) + 1, efficiencyBonus);
return (
{effect.name}
{effect.description}
Cost: {effect.baseCapacityCost} cap | Max: {effect.maxStacks}
{selected && (
removeEffect(effect.id)}
>
)}
addEffect(effect.id)}
disabled={!selected && selectedEffects.length >= 5}
>
{selected && (
{selected.stacks}/{effect.maxStacks}
)}
);
})}
{/* Incompatible Effects - Requirement: greyed-out "Unavailable" section with tooltips */}
{incompatibleEffects.length > 0 && (
<>
Unavailable
{incompatibleEffects.map(effect => {
const reason = getIncompatibilityReason(effect);
return (
{effect.name}
{effect.description}
Incompatible Effect
{reason}
);
})}
>
)}
>
)}
>
);
}
EffectSelector.displayName = 'EffectSelector';