From 5020c1f392e5c4f15f1a42f30307d1cbd87ba301 Mon Sep 17 00:00:00 2001 From: Jerald-Golden-B Date: Fri, 22 Aug 2025 17:47:54 +0530 Subject: [PATCH] action bug fix --- .../eventProperties/mechanics/craneMechanics.tsx | 2 +- .../eventProperties/mechanics/humanMechanics.tsx | 1 + .../eventProperties/mechanics/roboticArmMechanics.tsx | 2 +- .../eventProperties/mechanics/storageMechanics.tsx | 11 ++--------- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/app/src/components/layout/sidebarRight/properties/eventProperties/mechanics/craneMechanics.tsx b/app/src/components/layout/sidebarRight/properties/eventProperties/mechanics/craneMechanics.tsx index 405eb5d..3df0401 100644 --- a/app/src/components/layout/sidebarRight/properties/eventProperties/mechanics/craneMechanics.tsx +++ b/app/src/components/layout/sidebarRight/properties/eventProperties/mechanics/craneMechanics.tsx @@ -17,7 +17,7 @@ function CraneMechanics() { const { selectedEventData } = useSelectedEventData(); const { productStore } = useSceneContext(); - const { getPointByUuid, updateAction, addAction, removeAction } = productStore(); + const { getPointByUuid, addAction, removeAction } = productStore(); const { selectedProductStore } = useProductContext(); const { selectedProduct } = selectedProductStore(); const { selectedAction, setSelectedAction, clearSelectedAction } = useSelectedAction(); diff --git a/app/src/components/layout/sidebarRight/properties/eventProperties/mechanics/humanMechanics.tsx b/app/src/components/layout/sidebarRight/properties/eventProperties/mechanics/humanMechanics.tsx index 2cdcf7d..22bdbbf 100644 --- a/app/src/components/layout/sidebarRight/properties/eventProperties/mechanics/humanMechanics.tsx +++ b/app/src/components/layout/sidebarRight/properties/eventProperties/mechanics/humanMechanics.tsx @@ -47,6 +47,7 @@ function HumanMechanics() { if (point?.actions?.length) { setSelectedPointData(point); const firstAction = point.actions[0]; + setSelectedAction(firstAction.actionUuid, firstAction.actionName); setCurrentAction(firstAction); setSpeed(( getEventByModelUuid( diff --git a/app/src/components/layout/sidebarRight/properties/eventProperties/mechanics/roboticArmMechanics.tsx b/app/src/components/layout/sidebarRight/properties/eventProperties/mechanics/roboticArmMechanics.tsx index 120e1c7..dea6ef5 100644 --- a/app/src/components/layout/sidebarRight/properties/eventProperties/mechanics/roboticArmMechanics.tsx +++ b/app/src/components/layout/sidebarRight/properties/eventProperties/mechanics/roboticArmMechanics.tsx @@ -29,7 +29,7 @@ function RoboticArmMechanics() { const { projectId } = useParams(); useEffect(() => { - if (selectedEventData) { + if (selectedEventData && selectedEventData.data.type === 'roboticArm') { const point = getPointByUuid( selectedProduct.productUuid, selectedEventData.data.modelUuid, diff --git a/app/src/components/layout/sidebarRight/properties/eventProperties/mechanics/storageMechanics.tsx b/app/src/components/layout/sidebarRight/properties/eventProperties/mechanics/storageMechanics.tsx index 627dcbd..bf264fb 100644 --- a/app/src/components/layout/sidebarRight/properties/eventProperties/mechanics/storageMechanics.tsx +++ b/app/src/components/layout/sidebarRight/properties/eventProperties/mechanics/storageMechanics.tsx @@ -48,15 +48,8 @@ function StorageMechanics() { setCurrentCapacity(eventData?.storageCapacity?.toString() || "1"); setSpawnedCount(eventData?.storageCount?.toString() || "0"); setSpawnedMaterial(eventData?.materialType?.toString() || "Default material"); - - const actionUuid = selectedAction.actionId || firstAction.actionUuid; - const newCurrentAction = getActionByUuid(selectedProduct.productUuid, actionUuid); - - if (newCurrentAction) { - const uiOption = newCurrentAction.actionType === "retrieve" ? "spawn" : "store"; - setActiveOption(uiOption); - setSelectedAction(newCurrentAction.actionUuid, newCurrentAction.actionName); - } + setSelectedAction(firstAction.actionUuid, firstAction.actionName); + setActiveOption(firstAction.actionType === "retrieve" ? "spawn" : "store"); } } else { clearSelectedAction();