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