import { Flex } from '@radix-ui/themes'; import { ConsumableEntry } from '../core/blitzkit/consumableDefinitions'; import { ConsumableButton } from './ModuleButtons/ConsumableButton'; interface ConsumablesManagerProps { consumables: ConsumableEntry[]; selected: number[]; onChange?: (consumables: number[]) => void; disabled?: boolean; timers?: boolean; hasHighEndConsumables?: boolean; hasConsumableDeliverySystem?: boolean; cooldownBooster?: number; } export function ConsumablesManager({ consumables, selected, onChange, disabled, timers, hasConsumableDeliverySystem, cooldownBooster, hasHighEndConsumables, }: ConsumablesManagerProps) { return ( {consumables.map((consumable, index) => { const isSelected = selected.some((id) => id === consumable.id); return ( { if (!onChange) return; const draft = [...selected]; if (draft.some((id) => id === consumable.id)) { draft.splice(draft.indexOf(consumable.id), 1); } else { draft.push(consumable.id); } onChange(draft); }} /> ); })} ); }