fix(layout): add missing deps and fix variable references
This commit is contained in:
parent
133bf9ea3a
commit
a13d6f6907
3 changed files with 36 additions and 3 deletions
22
frontend/package-lock.json
generated
22
frontend/package-lock.json
generated
|
|
@ -19,6 +19,7 @@
|
||||||
"browser-image-compression": "^2.0.2",
|
"browser-image-compression": "^2.0.2",
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
|
"date-fns": "^4.1.0",
|
||||||
"framer-motion": "^12.23.26",
|
"framer-motion": "^12.23.26",
|
||||||
"i18next": "^25.7.2",
|
"i18next": "^25.7.2",
|
||||||
"i18next-browser-languagedetector": "^8.2.0",
|
"i18next-browser-languagedetector": "^8.2.0",
|
||||||
|
|
@ -32,6 +33,7 @@
|
||||||
"react-i18next": "^16.4.1",
|
"react-i18next": "^16.4.1",
|
||||||
"react-konva": "^18.2.10",
|
"react-konva": "^18.2.10",
|
||||||
"react-router-dom": "^7.10.1",
|
"react-router-dom": "^7.10.1",
|
||||||
|
"sonner": "^2.0.7",
|
||||||
"tailwind-merge": "^3.4.0",
|
"tailwind-merge": "^3.4.0",
|
||||||
"three": "0.165.0",
|
"three": "0.165.0",
|
||||||
"zod": "^4.3.4",
|
"zod": "^4.3.4",
|
||||||
|
|
@ -4389,6 +4391,16 @@
|
||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/date-fns": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/kossnocorp"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/debug": {
|
"node_modules/debug": {
|
||||||
"version": "4.4.3",
|
"version": "4.4.3",
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
||||||
|
|
@ -8075,6 +8087,16 @@
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/sonner": {
|
||||||
|
"version": "2.0.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/sonner/-/sonner-2.0.7.tgz",
|
||||||
|
"integrity": "sha512-W6ZN4p58k8aDKA4XPcx2hpIQXBRAgyiWVkYhT7CvK6D3iAu7xjvVyhQHg2/iaKJZ1XVJ4r7XuwGL+WGEK37i9w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^18.0.0 || ^19.0.0 || ^19.0.0-rc",
|
||||||
|
"react-dom": "^18.0.0 || ^19.0.0 || ^19.0.0-rc"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/source-map-js": {
|
"node_modules/source-map-js": {
|
||||||
"version": "1.2.1",
|
"version": "1.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
"browser-image-compression": "^2.0.2",
|
"browser-image-compression": "^2.0.2",
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
|
"date-fns": "^4.1.0",
|
||||||
"framer-motion": "^12.23.26",
|
"framer-motion": "^12.23.26",
|
||||||
"i18next": "^25.7.2",
|
"i18next": "^25.7.2",
|
||||||
"i18next-browser-languagedetector": "^8.2.0",
|
"i18next-browser-languagedetector": "^8.2.0",
|
||||||
|
|
@ -35,6 +36,7 @@
|
||||||
"react-i18next": "^16.4.1",
|
"react-i18next": "^16.4.1",
|
||||||
"react-konva": "^18.2.10",
|
"react-konva": "^18.2.10",
|
||||||
"react-router-dom": "^7.10.1",
|
"react-router-dom": "^7.10.1",
|
||||||
|
"sonner": "^2.0.7",
|
||||||
"tailwind-merge": "^3.4.0",
|
"tailwind-merge": "^3.4.0",
|
||||||
"three": "0.165.0",
|
"three": "0.165.0",
|
||||||
"zod": "^4.3.4",
|
"zod": "^4.3.4",
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,15 @@ export function LayoutEditor({ floorId, className }: LayoutEditorProps) {
|
||||||
const [configRack, setConfigRack] = useState<RackData | null>(null);
|
const [configRack, setConfigRack] = useState<RackData | null>(null);
|
||||||
|
|
||||||
// Load floor data and plant types
|
// Load floor data and plant types
|
||||||
|
const reloadFloorData = useCallback(async () => {
|
||||||
|
try {
|
||||||
|
const floor = await layoutApi.getFloor3D(floorId);
|
||||||
|
setFloorData(floor);
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Failed to reload floor:', e);
|
||||||
|
}
|
||||||
|
}, [floorId]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function load() {
|
async function load() {
|
||||||
try {
|
try {
|
||||||
|
|
@ -228,7 +237,7 @@ export function LayoutEditor({ floorId, className }: LayoutEditorProps) {
|
||||||
layoutApi.updatePlant(selectedSlot.plant!.id, { tagNumber: newTag })
|
layoutApi.updatePlant(selectedSlot.plant!.id, { tagNumber: newTag })
|
||||||
.then(() => {
|
.then(() => {
|
||||||
toast({ title: 'Tag Updated', description: newTag });
|
toast({ title: 'Tag Updated', description: newTag });
|
||||||
loadFloor(selectedFloor.id);
|
reloadFloorData();
|
||||||
setSelectedSlot(prev => prev ? ({ ...prev, plant: { ...prev.plant!, tagNumber: newTag } }) : null);
|
setSelectedSlot(prev => prev ? ({ ...prev, plant: { ...prev.plant!, tagNumber: newTag } }) : null);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -324,7 +333,7 @@ export function LayoutEditor({ floorId, className }: LayoutEditorProps) {
|
||||||
layoutApi.harvestPlant(selectedSlot.plant.id, { weight: parseFloat(weight), unit: 'g' })
|
layoutApi.harvestPlant(selectedSlot.plant.id, { weight: parseFloat(weight), unit: 'g' })
|
||||||
.then(() => {
|
.then(() => {
|
||||||
toast.success('Plant Harvested');
|
toast.success('Plant Harvested');
|
||||||
loadFloor(selectedFloor.id);
|
reloadFloorData();
|
||||||
setSelectedSlot(null);
|
setSelectedSlot(null);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -341,7 +350,7 @@ export function LayoutEditor({ floorId, className }: LayoutEditorProps) {
|
||||||
layoutApi.destroyPlant(selectedSlot.plant.id, 'Manual Destruction')
|
layoutApi.destroyPlant(selectedSlot.plant.id, 'Manual Destruction')
|
||||||
.then(() => {
|
.then(() => {
|
||||||
toast.error('Plant Destroyed');
|
toast.error('Plant Destroyed');
|
||||||
loadFloor(selectedFloor.id);
|
reloadFloorData();
|
||||||
setSelectedSlot(null);
|
setSelectedSlot(null);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue