From 1008128bccb1eab1cf966951ba2c146350131330 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Fri, 17 May 2024 20:49:23 +0200 Subject: [PATCH] feat: ability to drag and drop charges (#124) --- src/components/HardwareListing/HardwareListing.tsx | 1 + src/components/ShipFit/Slot.tsx | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/components/HardwareListing/HardwareListing.tsx b/src/components/HardwareListing/HardwareListing.tsx index 81918b7..9fc7a3a 100644 --- a/src/components/HardwareListing/HardwareListing.tsx +++ b/src/components/HardwareListing/HardwareListing.tsx @@ -72,6 +72,7 @@ const ModuleGroup = (props: { level: number; group: ListingGroup; hideGroup?: bo level={2} content={item.name} onClick={() => shipSnapShot.addCharge(item.typeId)} + onDragStart={onItemDragStart(item.typeId, "charge")} /> ); } else { diff --git a/src/components/ShipFit/Slot.tsx b/src/components/ShipFit/Slot.tsx index 79d89f5..8096a90 100644 --- a/src/components/ShipFit/Slot.tsx +++ b/src/components/ShipFit/Slot.tsx @@ -181,6 +181,11 @@ export const Slot = (props: { type: string; index: number; fittable: boolean; ma return; } + if (draggedSlotType === "charge") { + shipSnapshot.addCharge(draggedTypeId, esiFlag); + return; + } + const isValidSlotGroup = draggedSlotType === esiFlagType; if (!isValidSlotGroup) { return;