diff --git a/src/common/SmartBreadcrumb.tsx b/src/common/SmartBreadcrumb.tsx index c931b79..be1d0fe 100644 --- a/src/common/SmartBreadcrumb.tsx +++ b/src/common/SmartBreadcrumb.tsx @@ -12,7 +12,7 @@ import { } from "@mui/material"; import { Replay } from "@mui/icons-material"; import { useMobile } from "hooks"; -import { ReactNode, useEffect, useRef } from "react"; +import { ReactNode } from "react"; import { useLocation } from "react-router"; import { Link as RouterLink } from "react-router-dom"; import { or } from "utils/types"; @@ -58,12 +58,13 @@ interface Props { paddingTop?: number; paddingBottom?: number; prependPaths?: string[]; - + state?: any; } interface LinkRouterProps extends LinkProps { to: string; replace?: boolean; + state?: any; } const LinkRouter = (props: LinkRouterProps) => ; @@ -74,7 +75,7 @@ export default function SmartBreadcrumb(props: Props) { const location = useLocation(); const isMobile = useMobile(); const classes = useStyles(); - const { loading, reload } = props; + const { loading, reload, state } = props; const groupID = (): string => { let index = prependPaths?.indexOf("groups") @@ -316,7 +317,7 @@ export default function SmartBreadcrumb(props: Props) { links.push( Support @@ -341,6 +342,7 @@ export default function SmartBreadcrumb(props: Props) { color={lastPath ? "textPrimary" : "textSecondary"} variant="subtitle1" to={to} + state={state} sx={{ '&:hover': { color: getThemeType() === "dark" ? 'white' : "black" }}} className={classes.textOverflow}> {label} diff --git a/src/common/StatusSen5x.tsx b/src/common/StatusSen5x.tsx index 262f595..912f128 100644 --- a/src/common/StatusSen5x.tsx +++ b/src/common/StatusSen5x.tsx @@ -176,12 +176,12 @@ export default function StatusPlenum(props: Props) { > - {device.status.sen5x?.voc.toFixed(1)}% + V: {device.status.sen5x?.voc.toFixed(1)}% - {device.status.sen5x?.nox.toFixed(1)}% + N: {device.status.sen5x?.nox.toFixed(1)}% diff --git a/src/pages/Device.tsx b/src/pages/Device.tsx index 702285e..9282a50 100644 --- a/src/pages/Device.tsx +++ b/src/pages/Device.tsx @@ -30,6 +30,7 @@ export default function DevicePage() { const groupID = useParams<{ groupID: string }>()?.groupID ?? ""; const { state } = useLocation(); const [{ as, team, user }] = useGlobalState() + // console.log(state) const [device, setDevice] = useState(state?.device ? Device.create(state.device) : Device.create()) const [loading, setLoading] = useState(false) const [permissions, setPermissions] = useState([]) @@ -54,6 +55,11 @@ export default function DevicePage() { const loadDevice = () => { // console.log("load device page data") if (loading) return + console.log(state) + if (state?.device) { + console.log(Device.create(state.device)) + return + } setLoading(true) deviceAPI.getPageData(deviceID, getContextKeys(), getContextTypes(), as).then(resp => { let device = Device.any(resp.data.device) @@ -418,7 +424,7 @@ export default function DevicePage() { - + - +