Merge remote-tracking branch 'origin/dev-storageunit-refactor' into main-demo

This commit is contained in:
2025-08-22 09:55:21 +05:30
33 changed files with 632 additions and 424 deletions

View File

@@ -80,7 +80,13 @@ export const createMaterialStore = () => {
addMaterial: (material) => {
let updatedMaterial: MaterialSchema | undefined;
set((state) => {
const existingIndex = state.materials.findIndex(m => m.materialId === material.materialId);
if (existingIndex !== -1) {
state.materials.splice(existingIndex, 1);
}
state.materials.push(material);
updatedMaterial = JSON.parse(JSON.stringify(material));
});
return updatedMaterial;
},

View File

@@ -205,7 +205,7 @@ export const createStorageUnitStore = () => {
getFullStorageUnits: () => {
return get().storageUnits.filter(
s => s.currentLoad >= s.point.action.storageCapacity
s => s.currentLoad >= s.storageCapacity
);
},