feat: Refactor PickAndPlaceAction component to accept props for pick and place points; enhance RoboticArmMechanics with action handling and state management
This commit is contained in:
@@ -90,4 +90,28 @@ export const useSelectedProduct = create<SelectedProductState>()(
|
||||
});
|
||||
},
|
||||
}))
|
||||
);
|
||||
|
||||
interface SelectedActionState {
|
||||
selectedAction: { actionId: string; actionName: string };
|
||||
setSelectedAction: (actionId: string, actionName: string) => void;
|
||||
clearSelectedAction: () => void;
|
||||
}
|
||||
|
||||
export const useSelectedAction = create<SelectedActionState>()(
|
||||
immer((set) => ({
|
||||
selectedAction: { actionId: '', actionName: '' },
|
||||
setSelectedAction: (actionId, actionName) => {
|
||||
set((state) => {
|
||||
state.selectedAction.actionId = actionId;
|
||||
state.selectedAction.actionName = actionName;
|
||||
});
|
||||
},
|
||||
clearSelectedAction: () => {
|
||||
set((state) => {
|
||||
state.selectedAction.actionId = '';
|
||||
state.selectedAction.actionName = '';
|
||||
});
|
||||
},
|
||||
}))
|
||||
);
|
||||
Reference in New Issue
Block a user