added optional timestamp
This commit is contained in:
parent
b96787698b
commit
1e2003a541
7 changed files with 240 additions and 17 deletions
|
|
@ -190,6 +190,15 @@ export default function Devices() {
|
|||
localStorage.setItem('groupGas', groupGas.toString());
|
||||
}, [groupGas]);
|
||||
|
||||
const [showTimestamp, setShowTimestamp] = useState(() => {
|
||||
const stored = localStorage.getItem('showTimestamp');
|
||||
return stored !== null ? stored === 'true' : false;
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
localStorage.setItem('showTimestamp', showTimestamp.toString());
|
||||
}, [showTimestamp]);
|
||||
|
||||
const [preferencesAnchor, setPreferencesAnchor] = useState<any>(null)
|
||||
|
||||
const [{ as, team }] = useGlobalState()
|
||||
|
|
@ -646,7 +655,7 @@ export default function Devices() {
|
|||
if (device.status.plenum?.temperature) {
|
||||
return (
|
||||
<Box sx={{ marginLeft: 1 }}>
|
||||
<StatusPlenum device={device} />
|
||||
<StatusPlenum device={device} showTimestamp={showTimestamp} />
|
||||
</Box>
|
||||
)
|
||||
} else {
|
||||
|
|
@ -666,7 +675,7 @@ export default function Devices() {
|
|||
if (device.status.sen5x?.temperature) {
|
||||
return (
|
||||
<Box sx={{ marginLeft: 1 }}>
|
||||
<StatusSen5x device={device} noDust={separateDust} />
|
||||
<StatusSen5x device={device} noDust={separateDust} showTimestamp={showTimestamp} />
|
||||
</Box>
|
||||
)
|
||||
} else {
|
||||
|
|
@ -682,7 +691,7 @@ export default function Devices() {
|
|||
if (device.status.sen5x?.temperature) {
|
||||
return (
|
||||
<Box sx={{ marginLeft: 1 }}>
|
||||
<StatusDust device={device} />
|
||||
<StatusDust device={device} showTimestamp={showTimestamp} />
|
||||
</Box>
|
||||
)
|
||||
} else {
|
||||
|
|
@ -700,7 +709,7 @@ export default function Devices() {
|
|||
if (device.status.co) {
|
||||
return (
|
||||
<Box sx={{ marginLeft: 1 }}>
|
||||
<StatusGas device={device} gasType={groupGas ? "all" : "co"}/>
|
||||
<StatusGas device={device} gasType={groupGas ? "all" : "co"} showTimestamp={showTimestamp} />
|
||||
</Box>
|
||||
)
|
||||
} else {
|
||||
|
|
@ -718,7 +727,7 @@ export default function Devices() {
|
|||
if (device.status.co2) {
|
||||
return (
|
||||
<Box sx={{ marginLeft: 1 }}>
|
||||
<StatusGas device={device} gasType={"co2"}/>
|
||||
<StatusGas device={device} gasType={"co2"} showTimestamp={showTimestamp} />
|
||||
</Box>
|
||||
)
|
||||
} else {
|
||||
|
|
@ -736,7 +745,7 @@ export default function Devices() {
|
|||
if (device.status.no2) {
|
||||
return (
|
||||
<Box sx={{ marginLeft: 1 }}>
|
||||
<StatusGas device={device} gasType={"no2"}/>
|
||||
<StatusGas device={device} gasType={"no2"} showTimestamp={showTimestamp} />
|
||||
</Box>
|
||||
)
|
||||
} else {
|
||||
|
|
@ -754,7 +763,7 @@ export default function Devices() {
|
|||
if (device.status.o2) {
|
||||
return (
|
||||
<Box sx={{ marginLeft: 1 }}>
|
||||
<StatusGas device={device} gasType={"o2"}/>
|
||||
<StatusGas device={device} gasType={"o2"} showTimestamp={showTimestamp} />
|
||||
</Box>
|
||||
)
|
||||
} else {
|
||||
|
|
@ -894,6 +903,16 @@ export default function Devices() {
|
|||
</ListItemIcon>
|
||||
<ListItemText primary={"Group Gas"} />
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
onClick={() => setShowTimestamp(!showTimestamp)}
|
||||
sx={{ marginLeft: -0.75 }}
|
||||
dense
|
||||
>
|
||||
<ListItemIcon>
|
||||
<Checkbox checked={showTimestamp} />
|
||||
</ListItemIcon>
|
||||
<ListItemText primary={"Show Timestamp"} />
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue