feat: Refactor vehicle management and update storage unit load handling; remove unused vehicle component and enhance vehicle status types
This commit is contained in:
@@ -25,7 +25,7 @@ interface StorageUnitStore {
|
||||
setStorageUnitState: (modelUuid: string, newState: StorageUnitStatus['state']) => void;
|
||||
|
||||
// Load updates
|
||||
updateStorageUnitLoad: (modelUuid: string, load: number) => void;
|
||||
updateStorageUnitLoad: (modelUuid: string, incrementBy: number) => void;
|
||||
|
||||
// Time tracking
|
||||
incrementActiveTime: (modelUuid: string, incrementBy: number) => void;
|
||||
@@ -95,11 +95,11 @@ export const useStorageUnitStore = create<StorageUnitStore>()(
|
||||
},
|
||||
|
||||
// Load updates
|
||||
updateStorageUnitLoad: (modelUuid, load) => {
|
||||
updateStorageUnitLoad: (modelUuid, incrementBy) => {
|
||||
set((state) => {
|
||||
const unit = state.storageUnits.find(s => s.modelUuid === modelUuid);
|
||||
if (unit) {
|
||||
unit.currentLoad = load;
|
||||
unit.currentLoad += incrementBy;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@@ -30,7 +30,6 @@ interface VehiclesStore {
|
||||
getVehiclesByProduct: (productId: string) => VehicleStatus[];
|
||||
getVehiclesByState: (state: string) => VehicleStatus[];
|
||||
getActiveVehicles: () => VehicleStatus[];
|
||||
getIdleVehicles: () => VehicleStatus[];
|
||||
}
|
||||
|
||||
export const useVehicleStore = create<VehiclesStore>()(
|
||||
@@ -125,10 +124,6 @@ export const useVehicleStore = create<VehiclesStore>()(
|
||||
|
||||
getActiveVehicles: () => {
|
||||
return get().vehicles.filter(v => v.isActive);
|
||||
},
|
||||
|
||||
getIdleVehicles: () => {
|
||||
return get().vehicles.filter(v => !v.isActive && v.currentLoad > 0);
|
||||
}
|
||||
}))
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user