25 lines
1.0 KiB
TypeScript
25 lines
1.0 KiB
TypeScript
|
import { useConveyorActions } from "./conveyor/useConveyorActions";
|
||
|
import { useMachineActions } from "./machine/useMachineActions";
|
||
|
import { useRoboticArmActions } from "./roboticArm/useRoboticArmActions";
|
||
|
import { useStorageActions } from "./storageUnit/useStorageUnitActions";
|
||
|
import { useVehicleActions } from "./vehicle/useVehicleActions";
|
||
|
|
||
|
// Master hook that selects the appropriate action handler
|
||
|
export function useActionHandler(point: PointsScheme) {
|
||
|
if ('actions' in point) {
|
||
|
// Robotic Arm
|
||
|
useRoboticArmActions(point);
|
||
|
} else if (point.action.actionType === 'travel') {
|
||
|
// Vehicle
|
||
|
useVehicleActions(point as VehiclePointSchema);
|
||
|
} else if (point.action.actionType === 'process') {
|
||
|
// Machine
|
||
|
useMachineActions(point as MachinePointSchema);
|
||
|
} else if (point.action.actionType === 'store') {
|
||
|
// Storage
|
||
|
useStorageActions(point as StoragePointSchema);
|
||
|
} else {
|
||
|
// Conveyor
|
||
|
useConveyorActions(point as ConveyorPointSchema);
|
||
|
}
|
||
|
}
|