From 0f4d706e76c24d557d9301559919a54657af17eb Mon Sep 17 00:00:00 2001 From: csawatzky Date: Thu, 14 May 2026 10:39:21 -0600 Subject: [PATCH] hooked up the mode change stuff for the new summary --- src/bin/binSummary/BinSummary.tsx | 16 ++++- .../binSummary/components/bin3dVisualizer.tsx | 67 ++++++++++++++++--- src/bin/binSummary/components/binDetails.tsx | 17 +++++ src/pages/BinV2.tsx | 20 +++++- 4 files changed, 107 insertions(+), 13 deletions(-) create mode 100644 src/bin/binSummary/components/binDetails.tsx diff --git a/src/bin/binSummary/BinSummary.tsx b/src/bin/binSummary/BinSummary.tsx index 9621d8b..6327cba 100644 --- a/src/bin/binSummary/BinSummary.tsx +++ b/src/bin/binSummary/BinSummary.tsx @@ -21,9 +21,11 @@ interface Props { permissions: pond.Permission[] componentDevices: Map componentMap: Map + binPrefs?: Map + updateBinCallback?: (bin: Bin) => void } export default function BinSummary(props: Props){ - const {bin, devices, fans, heaters, permissions, componentDevices, componentMap} = props + const {bin, devices, fans, heaters, permissions, componentDevices, componentMap, binPrefs, updateBinCallback} = props const [currentDevice, setCurrentDevice] = useState(undefined) const isMobile = useMobile() @@ -155,7 +157,17 @@ export default function BinSummary(props: Props){ - + diff --git a/src/bin/binSummary/components/bin3dVisualizer.tsx b/src/bin/binSummary/components/bin3dVisualizer.tsx index 295374c..67c4a67 100644 --- a/src/bin/binSummary/components/bin3dVisualizer.tsx +++ b/src/bin/binSummary/components/bin3dVisualizer.tsx @@ -8,6 +8,8 @@ import { useState } from "react"; import NodeControls from "./nodeControls"; import { NodeData } from "bin/3dView/Data/BuildNodeData"; import { CableData } from "bin/3dView/Data/BuildCableData"; +import ModeChangeDialog from "bin/conditioning/modeChangeDialog"; +import { cloneDeep } from "lodash"; interface Props { bin: Bin @@ -18,23 +20,27 @@ interface Props { permissions: pond.Permission[] componentDevices: Map componentMap: Map + binPrefs?: Map + updateBinCallback?: (bin: Bin) => void } export default function bin3dVisualizer(props: Props){ - const {bin, fans, heaters, permissions, devices, componentDevices, componentMap} = props + const {bin, fans, heaters, permissions, devices, componentDevices, componentMap, binPrefs, updateBinCallback} = props const [showHeatmap, setShowHeatmap] = useState(true) - const [showHotspots, setShowHotspots] = useState(false) - const [showFill, setShowFill] = useState(false) + // const [showHotspots, setShowHotspots] = useState(false) + // const [showFill, setShowFill] = useState(false) const [showTemp, setShowTemp] = useState(true) const [showMoisture, setShowMoisture] = useState(false) const [showMoistureHeatmap, setShowMoistureHeatmap] = useState(false) const [binDisplay, setBinDisplay] = useState("temp") const [binMode, setBinMode] = useState(pond.BinMode.BIN_MODE_NONE) + const [openModeChange, setOpenModeChange] = useState(false) const [selectedCable, setSelectedCable] = useState(undefined) const [selectedNode, setSelectedNode] = useState(undefined) const [selectedCableDevice, setSelectedCableDevice] = useState(Device.create()) //this is the device that the cable that has the node that was clicked on belongs to const [filteredComponents, setFilteredComponents] = useState([]) //components that are filtered to only include ones on the same device const [openNodeControls, setOpenNodeControls] = useState(false) const [devMap, setDevMap] = useState>(new Map()) + const [modeChangeInProgress, setModeChangeInProgress] = useState(false) useEffect(()=>{ let newMap: Map = new Map() @@ -48,6 +54,14 @@ export default function bin3dVisualizer(props: Props){ setBinMode(bin.settings.mode) },[bin]) + const updateBin = () => { + if(updateBinCallback){ + let clone = cloneDeep(bin) + clone.settings.mode = binMode + updateBinCallback(clone) + } + }; + const binModeControl = () => { return ( @@ -55,6 +69,7 @@ export default function bin3dVisualizer(props: Props){