Skip to content

Commit

Permalink
fixed compare sensor label mixup
Browse files Browse the repository at this point in the history
  • Loading branch information
io53 committed Oct 2, 2024
1 parent 8aa777d commit a69dca4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 5 additions & 6 deletions src/components/CompareView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ function CompareView(props) {

const getUniqueKeys = () => {
let uniqueKeysSet = new Set();
gdata.forEach(obj => {
Object.keys(obj).forEach(key => {
if (key !== "t") uniqueKeysSet.add(key);
});
});
for (let i = 0; i < sensorData.length; i++) {
let key = sensorData[i].name || sensorData[i].mac;
uniqueKeysSet.add(key);
}
return Array.from(uniqueKeysSet);
}

Expand Down Expand Up @@ -263,7 +262,7 @@ export const useContainerDimensions = myRef => {
return dimensions;
};

export function EmtpyGraph() {
export function EmptyGraph() {
const ref = useRef(null);
const { width } = useContainerDimensions(ref)
const colorMode = useColorMode().colorMode;
Expand Down
4 changes: 2 additions & 2 deletions src/states/SensorCompare.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from "react";
import NetworkApi from "../NetworkApi";
import { Button, Flex, Box, useBreakpointValue } from "@chakra-ui/react";
import CompairView, { EmtpyGraph } from "../components/CompareView";
import CompairView, { EmptyGraph } from "../components/CompareView";
import DurationPicker from "../components/DurationPicker";
import i18next, { t } from "i18next";
import { SensorPicker } from '../components/SensorPicker';
Expand Down Expand Up @@ -224,7 +224,7 @@ function SensorCompare(props) {
</ScreenSizeWrapper>
<br />
{viewData && <CompairView key={123} {...viewData} dataKey={dataKey} isLoading={s => setLoading(s)} setData={d => data = d} />}
{!viewData && <Box height={450}><EmtpyGraph /></Box>}
{!viewData && <Box height={450}><EmptyGraph /></Box>}
<Box height={90} />
</Box >
</>
Expand Down

0 comments on commit a69dca4

Please sign in to comment.