diff --git a/package-lock.json b/package-lock.json index 1eda9b0..2e3b20c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10770,7 +10770,7 @@ }, "node_modules/protobuf-ts": { "version": "1.0.0", - "resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#6cbc16a8de336d72e2e65619327e4462d26ce05d", + "resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#9074fe327f799b1faef10374bd7ede55f3eb6a17", "dependencies": { "protobufjs": "^6.8.8" } @@ -13551,9 +13551,9 @@ } }, "node_modules/vite": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.2.0.tgz", - "integrity": "sha512-7dPxoo+WsT/64rDcwoOjk76XHj+TqNTIvHKcuMQ1k4/SeHDaQt5GFAeLYzrimZrMpn/O6DtdI03WUjdxuPM0oQ==", + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.2.3.tgz", + "integrity": "sha512-IzwM54g4y9JA/xAeBPNaDXiBF8Jsgl3VBQ2YQ/wOY6fyW3xMdSoltIV3Bo59DErdqdE6RxUfv8W69DvUorE4Eg==", "dev": true, "license": "MIT", "dependencies": { diff --git a/src/common/DraggableTabs.tsx b/src/common/DraggableTabs.tsx index b89db30..dae48c2 100644 --- a/src/common/DraggableTabs.tsx +++ b/src/common/DraggableTabs.tsx @@ -1,4 +1,4 @@ -import { darken, Tabs, TabsProps } from "@mui/material"; +import { Tabs, TabsProps } from "@mui/material"; import React, { useEffect, useState, useRef } from "react"; // import AnimatedTabs from "./AnimatedTabs"; diff --git a/src/common/PulseBox.tsx b/src/common/PulseBox.tsx new file mode 100644 index 0000000..ecdef3f --- /dev/null +++ b/src/common/PulseBox.tsx @@ -0,0 +1,56 @@ +import { Box, BoxProps, Theme } from "@mui/material"; +import { makeStyles } from "@mui/styles"; +import classNames from "classnames"; +import { ReactNode } from "react"; + +const useStyles = makeStyles((_theme: Theme) => ({ + pulseWrapper: { + position: 'relative', + display: 'block', // Changed to block to respect Box margins + width: 'fit-content', // Shrinks to child width + '&::after': { + content: '""', + position: 'absolute', + top: 0, + left: 0, + width: '100%', + height: '100%', + border: '2px solid var(--pulse-color)', + borderRadius: 'inherit', // Should inherit from Box + animation: '$pulse 1.5s infinite ease-in-out', + pointerEvents: 'none', + boxSizing: 'border-box', + }, + }, + '@keyframes pulse': { + from: { + transform: "scale(1)", + opacity: 1 + }, + to: { + transform: "scale(1.25)", + opacity: 0 + } + }, +})); + +interface Props extends BoxProps { + color: string; + children: ReactNode; + className?: string; +} + +export default function PulseBox(props: Props) { + const { color, children, className, ...boxProps } = props; + const classes = useStyles() + + return ( + + {children} + + ); +}; diff --git a/src/common/ResponsiveTable.tsx b/src/common/ResponsiveTable.tsx index 6124e55..7d2e9f5 100644 --- a/src/common/ResponsiveTable.tsx +++ b/src/common/ResponsiveTable.tsx @@ -10,7 +10,7 @@ const useStyles = makeStyles((theme: Theme) => { // const isMobile = useMobile() return ({ gutter: { - backgroundColor: darken(theme.palette.background.paper, 0.03), + backgroundColor: darken(theme.palette.background.paper, 0.05), border: "none" }, tableContainer: { @@ -55,7 +55,7 @@ const useStyles = makeStyles((theme: Theme) => { rowHover: { cursor: "pointer", "&:hover": { - backgroundColor: "rgba(150, 150, 150, 0.05)" + backgroundColor: "rgba(150, 150, 150, 0.15)" } } })}, @@ -323,7 +323,7 @@ export default function ResponsiveTable(props: Props) { sx={{ width: "100%", display: "flex", - justifyContent: "center" + justifyContent: "center", }} onClick={(event) => handleCollapse(index, event)} // style={{pre}} diff --git a/src/common/StatusPlenum.tsx b/src/common/StatusPlenum.tsx new file mode 100644 index 0000000..d0d185e --- /dev/null +++ b/src/common/StatusPlenum.tsx @@ -0,0 +1,51 @@ +import { Grid2, Theme, Typography } from "@mui/material"; +import { blue, orange } from "@mui/material/colors"; +import { makeStyles } from "@mui/styles"; +import { Device } from "models"; +import PulseBox from "./PulseBox"; + +interface Props { + device: Device +} + +const useStyles = makeStyles((theme: Theme) => { + const lightMode = theme.palette?.mode === "light"; + return ({ + box: { + display: "inline-block", + borderRadius: "6px", + backgroundColor: lightMode ? "rgb(170, 170, 170)" : "rgb(34, 34, 34)", + padding: theme.spacing(0.5), + marginRight: "auto", + margin: theme.spacing(1), + }, + pulse: { + // padding: theme.spacing(2) + paddingLeft: theme.spacing(-6) + } + }) +}) + +export default function StatusPlenum(props: Props) { + const { device } = props; + const classes = useStyles() + + return ( + + {/* */} + + + + {device.status.plenum?.temperature.toFixed(1)}°C + + + + + {device.status.plenum?.humidity.toFixed(1)}% + + + + {/* */} + + ) +} \ No newline at end of file diff --git a/src/pages/Devices.tsx b/src/pages/Devices.tsx index f8a5ea1..a7939d8 100644 --- a/src/pages/Devices.tsx +++ b/src/pages/Devices.tsx @@ -22,6 +22,7 @@ import BindaptIcon from "products/Bindapt/BindaptIcon"; import { describePower } from "pbHelpers/Power"; import { Tag as TagUI } from "common/Tag"; import moment from "moment"; +import StatusPlenum from "common/StatusPlenum"; const useStyles = makeStyles((theme: Theme) => { return ({ @@ -214,6 +215,8 @@ export default function Devices() { ).then(resp => { let newDevices: Device[] = [] resp.data.devices.forEach(device => { + console.log(device.status) + console.log(device.status?.plenum?.overlays) if (device.status?.plenum?.temperature) { setHasPlenums(true) } @@ -325,18 +328,9 @@ export default function Devices() { render: (device: Device) => { if (device.status.plenum?.temperature) { return ( - - - - {device.status.plenum.temperature.toFixed(1)}°C - - - - - {device.status.plenum.humidity.toFixed(1)}% - - - + + + ) } else { return (