'use client'; import { EquipmentSlot } from '@/lib/game/data/equipment'; import { SLOT_NAMES } from './EquipmentTab'; import type { GameStore, EquipmentInstance } from '@/lib/game/types'; import { GameCard } from '@/components/ui/game-card'; import { Badge } from '@/components/ui/badge'; import { AlertCircle, Sword, Shield, HardHat, Shirt, Hand, Footprints, Gem } from 'lucide-react'; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'; import { RARITY_BORDER_COLORS, RARITY_BG_COLORS, RARITY_TEXT_COLORS } from './EquipmentTab'; import { ENCHANTMENT_EFFECTS } from '@/lib/game/data/enchantment-effects'; import type { EquipmentType } from '@/lib/game/data/equipment'; const SLOT_ICONS: Record = { mainHand: Sword, offHand: Shield, head: HardHat, body: Shirt, hands: Hand, feet: Footprints, accessory1: Gem, accessory2: Gem, }; interface EquipmentSlotGridProps { store: GameStore; selectedSlot: EquipmentSlot | null; onSlotClick: (slot: EquipmentSlot) => void; onUnequip: (slot: EquipmentSlot) => void; isSlotBlocked: (slot: EquipmentSlot) => boolean; SLOT_GROUPS: Array<{ label: string; slots: EquipmentSlot[] }>; } export function EquipmentSlotGrid({ store, selectedSlot, onSlotClick, onUnequip, isSlotBlocked, SLOT_GROUPS, }: EquipmentSlotGridProps) { const renderSlot = (slot: EquipmentSlot) => { const instanceId = store.equippedInstances[slot]; const instance = instanceId ? store.equipmentInstances[instanceId] : null; const equipmentType = instance ? (store as any).EQUIPMENT_TYPES?.[instance.typeId] : null; const blocked = isSlotBlocked(slot); const isEmpty = !instance; const SlotIcon = SLOT_ICONS[slot]; const slotContent = ( !blocked && onSlotClick(slot)} onKeyDown={(e) => { if (!blocked && (e.key === 'Enter' || e.key === ' ')) { onSlotClick(slot); } }} >
{SLOT_NAMES[slot]} {blocked && ( Occupied — 2H Weapon )}
{instance && !blocked && ( )}
{instance ? ( ) : blocked ? (
Blocked by 2-handed weapon
) : (
{SLOT_NAMES[slot]}
)}
); if (blocked) { return ( {slotContent}

The offhand slot is blocked because a 2-handed weapon is equipped in the main hand.

Unequip the 2-handed weapon to use this slot.

); } return
{slotContent}
; }; return (
{SLOT_GROUPS.map((group) => (

{group.label}

{group.slots.map((slot) => renderSlot(slot))}
))}
); } interface EquipmentItemDisplayProps { instance: EquipmentInstance; equipmentType: EquipmentType | undefined; isTwoHanded: boolean; isCompact?: boolean; } function EquipmentItemDisplay({ instance, equipmentType, isTwoHanded, isCompact = false, }: EquipmentItemDisplayProps) { return (
{instance.name} {isTwoHanded && ( 2-Handed )}
Enchantments: {instance.enchantments.length}/{instance.totalCapacity}
{instance.enchantments.length > 0 && ( )}
); } interface EnchantmentsDisplayProps { enchantments: Array<{ effectId: string; stacks: number }>; compact?: boolean; } function EnchantmentsDisplay({ enchantments, compact = false }: EnchantmentsDisplayProps) { return (
{enchantments.map((ench, i) => { const effect = ENCHANTMENT_EFFECTS[ench.effectId]; return ( {effect?.name || ench.effectId} {ench.stacks > 1 && ` x${ench.stacks}`}

{effect?.description || 'Unknown effect'}

Category: {effect?.category || 'unknown'}

); })}
); }