diff --git a/src/bin/BinSVGV2.tsx b/src/bin/BinSVGV2.tsx index d53d15c..bfd18db 100644 --- a/src/bin/BinSVGV2.tsx +++ b/src/bin/BinSVGV2.tsx @@ -1,5 +1,6 @@ import { Box, Theme, ToggleButton, ToggleButtonGroup, darken } from "@mui/material"; import { makeStyles, withStyles } from "@mui/styles"; +import ButtonGroup from "common/ButtonGroup"; import { ExtractMoisture } from "grain"; import { GrainCable } from "models/GrainCable"; import { describeMeasurement } from "pbHelpers/MeasurementDescriber"; @@ -212,54 +213,54 @@ export default function BinSVGV2(props: Props) { const [extraDetails, setExtraDetails] = useState<"temps" | "hums">("temps"); const [nodeWarning, setNodeWarning] = useState(false); - const StyledToggleButtonGroup = withStyles(theme => ({ - grouped: { - margin: theme.spacing(-0.5), - border: "none", - padding: theme.spacing(1), - "&:not(:first-child):not(:last-child)": { - borderRadius: 24, - marginRight: theme.spacing(0.5), - marginLeft: theme.spacing(0.5) - }, - "&:first-child": { - borderRadius: 24, - marginLeft: theme.spacing(0.25) - }, - "&:last-child": { - borderRadius: 24, - marginRight: theme.spacing(0.25) - } - }, - root: { - backgroundColor: darken( - theme.palette.background.paper, - getThemeType() === "light" ? 0.05 : 0.25 - ), - borderRadius: 24, - content: "border-box" - } - }))(ToggleButtonGroup); + // const StyledToggleButtonGroup = withStyles(theme => ({ + // grouped: { + // margin: theme.spacing(-0.5), + // border: "none", + // padding: theme.spacing(1), + // "&:not(:first-child):not(:last-child)": { + // borderRadius: 24, + // marginRight: theme.spacing(0.5), + // marginLeft: theme.spacing(0.5) + // }, + // "&:first-child": { + // borderRadius: 24, + // marginLeft: theme.spacing(0.25) + // }, + // "&:last-child": { + // borderRadius: 24, + // marginRight: theme.spacing(0.25) + // } + // }, + // root: { + // backgroundColor: darken( + // theme.palette.background.paper, + // getThemeType() === "light" ? 0.05 : 0.25 + // ), + // borderRadius: 24, + // content: "border-box" + // } + // }))(ToggleButtonGroup); - const StyledToggle = withStyles({ - root: { - backgroundColor: "transparent", - overflow: "visible", - content: "content-box", - "&$selected": { - backgroundColor: "gold", - color: "black", - borderRadius: 24, - fontWeight: "bold" - }, - "&$selected:hover": { - backgroundColor: "rgb(255, 255, 0)", - color: "black", - borderRadius: 24 - } - }, - selected: {} - })(ToggleButton); + // const StyledToggle = withStyles({ + // root: { + // backgroundColor: "transparent", + // overflow: "visible", + // content: "content-box", + // "&$selected": { + // backgroundColor: "gold", + // color: "black", + // borderRadius: 24, + // fontWeight: "bold" + // }, + // "&$selected:hover": { + // backgroundColor: "rgb(255, 255, 0)", + // color: "black", + // borderRadius: 24 + // } + // }, + // selected: {} + // })(ToggleButton); const gradients = () => { const burning = "#8a1f0d"; @@ -1047,10 +1048,26 @@ export default function BinSVGV2(props: Props) { {showTempHum && ( - setExtraDetails("temps") + }, + { + title: grainType ? (isFullScreen ? "Moisture" : "EMC") : isFullScreen ? "Humidity" : "Hum", + function: () => setExtraDetails("hums") + } + ]} + toggle + /> + {/* {grainType ? (isFullScreen ? "Moisture" : "EMC") : isFullScreen ? "Humidity" : "Hum"} - + */} )} {device.name()} - + setDetail("analytics") + }, + { + title: "Sensors", + function: () => setDetail("sensors") + } + ]} + /> + {/* setDetail("analytics")} value={"analytics"} @@ -357,7 +371,7 @@ export default function GateDevice(props: Props) { aria-label="Sensor Graphs"> Sensors - + */} ({ - root: { - backgroundColor: "transparent", - overflow: "visible", - content: "content-box", - "&$selected": { - backgroundColor: "gold", - color: "black", - borderRadius: 24, - fontWeight: "bold" - }, - "&$selected:hover": { - backgroundColor: "rgb(255, 255, 0)", - color: "black", - borderRadius: 24 - } - }, - selected: {} - })) + // const StyledToggle = styled(ToggleButton)(() => ({ + // root: { + // backgroundColor: "transparent", + // overflow: "visible", + // content: "content-box", + // "&$selected": { + // backgroundColor: "gold", + // color: "black", + // borderRadius: 24, + // fontWeight: "bold" + // }, + // "&$selected:hover": { + // backgroundColor: "rgb(255, 255, 0)", + // color: "black", + // borderRadius: 24 + // } + // }, + // selected: {} + // })) - const StyledToggleButtonGroup = styled(ToggleButtonGroup)(({ theme }: { theme: Theme }) => ({ - grouped: { - margin: theme.spacing(-0.5), - border: "none", - padding: theme.spacing(1), - "&:not(:first-child):not(:last-child)": { - borderRadius: 24, - marginRight: theme.spacing(0.5), - marginLeft: theme.spacing(0.5) - }, - "&:first-child": { - borderRadius: 24, - marginLeft: theme.spacing(0.25) - }, - "&:last-child": { - borderRadius: 24, - marginRight: theme.spacing(0.25) - } - }, - root: { - backgroundColor: darken( - theme.palette.background.paper, - getThemeType() === "light" ? 0.05 : 0.25 - ), - borderRadius: 24, - content: "border-box" - } - })) + // const StyledToggleButtonGroup = styled(ToggleButtonGroup)(({ theme }: { theme: Theme }) => ({ + // grouped: { + // margin: theme.spacing(-0.5), + // border: "none", + // padding: theme.spacing(1), + // "&:not(:first-child):not(:last-child)": { + // borderRadius: 24, + // marginRight: theme.spacing(0.5), + // marginLeft: theme.spacing(0.5) + // }, + // "&:first-child": { + // borderRadius: 24, + // marginLeft: theme.spacing(0.25) + // }, + // "&:last-child": { + // borderRadius: 24, + // marginRight: theme.spacing(0.25) + // } + // }, + // root: { + // backgroundColor: darken( + // theme.palette.background.paper, + // getThemeType() === "light" ? 0.05 : 0.25 + // ), + // borderRadius: 24, + // content: "border-box" + // } + // })) const load = useCallback(() => { if (loadRef.current || user.id() === "") return; @@ -862,8 +863,33 @@ export default function Bin(props: Props) { - - + setDetail("inventory") + }, + { + title: "Sensors", + function: () => setDetail("sensors") + }, + { + title: "Analysis", + function: () => setDetail("analytics") + }, + { + title: "Alerts", + function: () => setDetail("alerts") + }, + { + title: "Presets", + function: () => setDetail("presets") + } + ]} + /> + {/* Presets - + */} {detail === "alerts" && ( diff --git a/src/pages/Bins.tsx b/src/pages/Bins.tsx index 5043b96..ae8f6b5 100644 --- a/src/pages/Bins.tsx +++ b/src/pages/Bins.tsx @@ -81,6 +81,7 @@ import { getThemeType } from "theme/themeType"; import GrainBagSettings from "grainBag/grainBagSettings"; import GrainBagList from "grainBag/grainBagList"; import BinYards from "bin/BinYards"; +import ButtonGroup from "common/ButtonGroup"; // import { useHistory } from "react-router"; const useStyles = makeStyles((theme: Theme) => { @@ -200,56 +201,56 @@ export default function Bins(props: Props) { // fertilizer: 0 // }); - const StyledToggleButtonGroup = styled(ToggleButtonGroup)(({ theme }: { theme: Theme }) => ({ - '& .MuiToggleButtonGroup-grouped': { - // border: 'none' replaces the old 'grouped' border: "none" - border: 'none', - padding: theme.spacing(1), - // Middle buttons - '&:not(:first-child):not(:last-child)': { - borderRadius: 24, - marginRight: theme.spacing(0.5), - marginLeft: theme.spacing(0.5), - }, - // First button - '&:first-child': { - borderRadius: 24, - marginLeft: theme.spacing(0.25), - }, - // Last button - '&:last-child': { - borderRadius: 24, - marginRight: theme.spacing(0.25), - }, - }, - // Root styles - backgroundColor: darken( - theme.palette.background.paper, - getThemeType() === 'light' ? 0.05 : 0.25 - ), - borderRadius: 24, - boxSizing: 'content-box', // Fixed 'content: "border-box"' typo from original - })); + // const StyledToggleButtonGroup = styled(ToggleButtonGroup)(({ theme }: { theme: Theme }) => ({ + // '& .MuiToggleButtonGroup-grouped': { + // // border: 'none' replaces the old 'grouped' border: "none" + // border: 'none', + // padding: theme.spacing(1), + // // Middle buttons + // '&:not(:first-child):not(:last-child)': { + // borderRadius: 24, + // marginRight: theme.spacing(0.5), + // marginLeft: theme.spacing(0.5), + // }, + // // First button + // '&:first-child': { + // borderRadius: 24, + // marginLeft: theme.spacing(0.25), + // }, + // // Last button + // '&:last-child': { + // borderRadius: 24, + // marginRight: theme.spacing(0.25), + // }, + // }, + // // Root styles + // backgroundColor: darken( + // theme.palette.background.paper, + // getThemeType() === 'light' ? 0.05 : 0.25 + // ), + // borderRadius: 24, + // boxSizing: 'content-box', // Fixed 'content: "border-box"' typo from original + // })); - const StyledToggle = styled(ToggleButton)(({ theme }: { theme: Theme }) => ({ - root: { - backgroundColor: "transparent", - overflow: "visible", - content: "content-box", - "&$selected": { - backgroundColor: "gold", - color: "black", - borderRadius: 24, - fontWeight: "bold" - }, - "&$selected:hover": { - backgroundColor: "rgb(255, 255, 0)", - color: "black", - borderRadius: 24 - } - }, - selected: {} - })); + // const StyledToggle = styled(ToggleButton)(({ theme }: { theme: Theme }) => ({ + // root: { + // backgroundColor: "transparent", + // overflow: "visible", + // content: "content-box", + // "&$selected": { + // backgroundColor: "gold", + // color: "black", + // borderRadius: 24, + // fontWeight: "bold" + // }, + // "&$selected:hover": { + // backgroundColor: "rgb(255, 255, 0)", + // color: "black", + // borderRadius: 24 + // } + // }, + // selected: {} + // })); useEffect(() => { let ebt = sessionStorage.getItem("expandBinTotal"); @@ -502,6 +503,17 @@ export default function Bins(props: Props) { } }, [loadBins, props.insert, contentFilter]); + const determineNodeToggle = () => { + switch(cardValDisplay) { + case "low": + return [0] + case "high": + return [2] + default: + return [1] + } + } + const duplicateBin = (bin: Bin) => { binAPI.addBin(bin.settings, as).then(resp => { loadBins(); @@ -1154,7 +1166,25 @@ export default function Bins(props: Props) { Load All )} - {setCardValDisplay("low")} + }, + { + title: "Average", + function: () => {setCardValDisplay("average")} + }, + { + title: "High", + function: () => {setCardValDisplay("high")} + } + ]} + /> + {/* High - + */} - , + function: () => { + setBinView("grid"); + sessionStorage.setItem("binsView", "grid"); + } + }, + { + title: "List", + icon: , + function: () => { + setBinView("list"); + sessionStorage.setItem("binsView", "list"); + } + } + ]} + /> + {/* - + */} {/* hidden at dustins request so that grid view and list are the only two */} {/* */} - { @@ -1223,7 +1274,7 @@ export default function Bins(props: Props) { }}> - + */} { @@ -1261,7 +1312,28 @@ export default function Bins(props: Props) { - , + function: () => { + setBagView("grid"); + sessionStorage.setItem("bagsView", "grid"); + } + }, + { + title: "List", + icon: , + function: () => { + setBagView("list"); + sessionStorage.setItem("bagsView", "list"); + } + } + ]} + /> + {/* - + */} {/* hidden at dustins request so that grid view and list are the only two */} {/* */} - { @@ -1295,7 +1367,7 @@ export default function Bins(props: Props) { }}> - + */} { diff --git a/src/tasks/TaskList.tsx b/src/tasks/TaskList.tsx index 9844f68..6803831 100644 --- a/src/tasks/TaskList.tsx +++ b/src/tasks/TaskList.tsx @@ -8,6 +8,7 @@ import { Task } from "models"; //import { ToggleButton, ToggleButtonGroup } from "@material-ui/lab"; import TasksIcon from "products/Construction/TasksIcon"; import moment from "moment"; +import ButtonGroup from "common/ButtonGroup"; interface Props { tasks: Task[]; @@ -147,8 +148,21 @@ export default function TaskList(props: Props) { return ( {label ? label : ""} - - + + setViewing("upcoming") + }, + { + title: "Complete", + function: () => setViewing("complete") + } + ]} + /> + {/* Complete - + */} {location !== "/tasks" && (