added headspace warning indicators to the bin svg
This commit is contained in:
parent
8a6ff80df2
commit
7020cd90be
4 changed files with 52 additions and 5 deletions
2
package-lock.json
generated
2
package-lock.json
generated
|
|
@ -9780,7 +9780,7 @@
|
||||||
},
|
},
|
||||||
"node_modules/protobuf-ts": {
|
"node_modules/protobuf-ts": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#cf0774d8aab2663916bbb0b2c44f4bb3352487b5",
|
"resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#6cbc16a8de336d72e2e65619327e4462d26ce05d",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"protobufjs": "^6.8.8"
|
"protobufjs": "^6.8.8"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -401,6 +401,7 @@ export default function BinCard(props: Props) {
|
||||||
fillPercentage={bin.fillPercent()}
|
fillPercentage={bin.fillPercent()}
|
||||||
lidarEstimate={lidarPercentage}
|
lidarEstimate={lidarPercentage}
|
||||||
cables={cables}
|
cables={cables}
|
||||||
|
co2Sensors={bin.status.co2}
|
||||||
highTemp={bin.settings.highTemp}
|
highTemp={bin.settings.highTemp}
|
||||||
lowTemp={bin.settings.lowTemp}
|
lowTemp={bin.settings.lowTemp}
|
||||||
hottestNodeTemp={valDisplay === "high" ? hotNode?.temp : undefined}
|
hottestNodeTemp={valDisplay === "high" ? hotNode?.temp : undefined}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,22 @@ const useStyles = makeStyles((theme: Theme) => {
|
||||||
fill: "#0575E6"
|
fill: "#0575E6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@keyframes headspaceWarning": {
|
||||||
|
from: {
|
||||||
|
fill: "#d18221"
|
||||||
|
},
|
||||||
|
to: {
|
||||||
|
fill: "#9a9d9f"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@keyframes headspaceCritical": {
|
||||||
|
from: {
|
||||||
|
fill: "#ff0000"
|
||||||
|
},
|
||||||
|
to: {
|
||||||
|
fill: "#9a9d9f"
|
||||||
|
}
|
||||||
|
},
|
||||||
outerShell: {
|
outerShell: {
|
||||||
fill: "url(#outerShellGradient)"
|
fill: "url(#outerShellGradient)"
|
||||||
},
|
},
|
||||||
|
|
@ -39,9 +55,17 @@ const useStyles = makeStyles((theme: Theme) => {
|
||||||
container: {
|
container: {
|
||||||
fill: "#a1a9b1"
|
fill: "#a1a9b1"
|
||||||
},
|
},
|
||||||
headspace: {
|
headspaceNormal: {
|
||||||
fill: "#9a9d9f"
|
fill: "#9a9d9f"
|
||||||
},
|
},
|
||||||
|
headspaceWarning: {
|
||||||
|
fill: "#9a9d9f",
|
||||||
|
animation: "$headspaceWarning 0.5s alternate infinite"
|
||||||
|
},
|
||||||
|
headspaceCritical: {
|
||||||
|
fill: "#9a9d9f",
|
||||||
|
animation: "$headspaceCritical 0.5s alternate infinite"
|
||||||
|
},
|
||||||
bottom: {
|
bottom: {
|
||||||
fill: "#9c9fa2"
|
fill: "#9c9fa2"
|
||||||
},
|
},
|
||||||
|
|
@ -107,6 +131,7 @@ interface Props {
|
||||||
fillPercentage: number;
|
fillPercentage: number;
|
||||||
lidarEstimate?: number;
|
lidarEstimate?: number;
|
||||||
cables?: GrainCable[];
|
cables?: GrainCable[];
|
||||||
|
co2Sensors: pond.BinCO2[];
|
||||||
hasMinHeight?: boolean;
|
hasMinHeight?: boolean;
|
||||||
highTemp: number;
|
highTemp: number;
|
||||||
lowTemp: number;
|
lowTemp: number;
|
||||||
|
|
@ -180,7 +205,8 @@ export default function BinSVGV2(props: Props) {
|
||||||
cableEstimate,
|
cableEstimate,
|
||||||
hottestNodeTemp,
|
hottestNodeTemp,
|
||||||
coldestNodeTemp,
|
coldestNodeTemp,
|
||||||
inventoryControl
|
inventoryControl,
|
||||||
|
co2Sensors
|
||||||
} = props;
|
} = props;
|
||||||
const [{ user }] = useGlobalState();
|
const [{ user }] = useGlobalState();
|
||||||
const [extraDetails, setExtraDetails] = useState<"temps" | "hums">("temps");
|
const [extraDetails, setExtraDetails] = useState<"temps" | "hums">("temps");
|
||||||
|
|
@ -310,6 +336,25 @@ export default function BinSVGV2(props: Props) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const headspaceClass = () => {
|
||||||
|
if (!co2Sensors || co2Sensors.length === 0) return classes.headspaceNormal;
|
||||||
|
// let testSensor = [pond.BinCO2.create({
|
||||||
|
// device: 4,
|
||||||
|
// key: "testSensor",
|
||||||
|
// name: "test Sensor",
|
||||||
|
// ppm: 1600
|
||||||
|
// })]
|
||||||
|
let highestReading = 0;
|
||||||
|
//testSensor.forEach(sensor => {
|
||||||
|
co2Sensors.forEach(sensor => {
|
||||||
|
//if the current sensor is greater the the currently highest reading change it to the current sensor
|
||||||
|
highestReading = sensor.ppm > highestReading ? sensor.ppm : highestReading;
|
||||||
|
});
|
||||||
|
if (highestReading > 1500) return classes.headspaceCritical;
|
||||||
|
if (highestReading > 1000) return classes.headspaceWarning;
|
||||||
|
return classes.headspaceNormal;
|
||||||
|
};
|
||||||
|
|
||||||
const borderColor = () => {
|
const borderColor = () => {
|
||||||
//determine color of border based on node status: > high or < low = red, within both = green
|
//determine color of border based on node status: > high or < low = red, within both = green
|
||||||
return !cables || cables.length === 0 ? "#000000" : nodeWarning ? "#ff0000" : "#00ff00";
|
return !cables || cables.length === 0 ? "#000000" : nodeWarning ? "#ff0000" : "#00ff00";
|
||||||
|
|
@ -946,7 +991,7 @@ export default function BinSVGV2(props: Props) {
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<path
|
<path
|
||||||
className={classes.headspace}
|
className={headspaceClass()}
|
||||||
d="m 181.82986,106.67809 -127.82986,65.18735 v 0 c 0,0 474,0 474,0 v 0 c 0,0 -127.61538,-65.41933 -127.61538,-65.41933 -69.27693,-35.261481 -149.27783,-35.261481 -218.55476,0 z"
|
d="m 181.82986,106.67809 -127.82986,65.18735 v 0 c 0,0 474,0 474,0 v 0 c 0,0 -127.61538,-65.41933 -127.61538,-65.41933 -69.27693,-35.261481 -149.27783,-35.261481 -218.55476,0 z"
|
||||||
id="headspace"
|
id="headspace"
|
||||||
/>
|
/>
|
||||||
|
|
@ -991,7 +1036,7 @@ export default function BinSVGV2(props: Props) {
|
||||||
id="bottom"
|
id="bottom"
|
||||||
/>
|
/>
|
||||||
<path
|
<path
|
||||||
className={classes.headspace}
|
className={headspaceClass()}
|
||||||
d="m 187.29264,84.203148 -133.24203,69.896852 c 0,0 319.83487,-22.49899 473.94939,0 l -133.15206,-69.996847 c -65.67637,-34.498446 -141.87893,-34.498446 -207.5553,0 z"
|
d="m 187.29264,84.203148 -133.24203,69.896852 c 0,0 319.83487,-22.49899 473.94939,0 l -133.15206,-69.996847 c -65.67637,-34.498446 -141.87893,-34.498446 -207.5553,0 z"
|
||||||
id="headspace"
|
id="headspace"
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -1400,6 +1400,7 @@ export default function BinVisualizer(props: Props) {
|
||||||
fillPercentage={fillPercentage ?? 0}
|
fillPercentage={fillPercentage ?? 0}
|
||||||
lidarEstimate={lidarPercentage}
|
lidarEstimate={lidarPercentage}
|
||||||
cables={grainCables}
|
cables={grainCables}
|
||||||
|
co2Sensors={bin.status.co2}
|
||||||
highTemp={bin.settings.highTemp}
|
highTemp={bin.settings.highTemp}
|
||||||
lowTemp={bin.settings.lowTemp}
|
lowTemp={bin.settings.lowTemp}
|
||||||
showTempHum={iOS ? nodeDetails : fullScreenHandler.active}
|
showTempHum={iOS ? nodeDetails : fullScreenHandler.active}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue