From 7d14144b81043f156e1eb2e26ce6dd04d4c6d3c5 Mon Sep 17 00:00:00 2001 From: das31 <31259710+das31@users.noreply.github.com> Date: Fri, 13 Jan 2023 16:30:20 -0500 Subject: [PATCH] CEC-1711-fix-digital-twin-ver2 (#258) * first commit * fix build error --- src/components/DigitalTwin/index.js | 19 ++++++++++++++++--- src/components/VehicleMap/index.jsx | 11 +---------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/components/DigitalTwin/index.js b/src/components/DigitalTwin/index.js index 20acbfe..82b41dd 100644 --- a/src/components/DigitalTwin/index.js +++ b/src/components/DigitalTwin/index.js @@ -14,7 +14,7 @@ const mapOpenCloseState = (value) => const DigitalTwin = (props) => { const classes = useStyles(); - const { battery, doors, location, trex_version, ip, updated, windows, sunroof, dbc, door_locks } = props; + const { battery, doors, location, trex_version, ip, updated, windows,misc_windows ,sunroof, dbc, door_locks } = props; return (
@@ -47,7 +47,21 @@ const DigitalTwin = (props) => { if (value[1] === 0) { return keyValueTemplate(value[0], "closed"); } else { - return keyValueTemplate(value[0], `${value[1]}% open`); + const percentOpen = Math.min(value[1], 100); + return keyValueTemplate(value[0], `${percentOpen}% open`); + } + })} +
+ )} + {misc_windows != null && ( +
+

Misc Windows

+ {Object.entries(misc_windows).map((value) => { + if (value[1] === 0) { + return keyValueTemplate(value[0], "closed"); + } else { + const percentOpen = Math.min(value[1], 100); + return keyValueTemplate(value[0], `${percentOpen}% open`); } })}
@@ -55,7 +69,6 @@ const DigitalTwin = (props) => { {sunroof != null && (

Sunroof

- {/* {Object.entries(sunroof).map(mapOpenCloseState)} */} {Object.entries(sunroof).map((value) => { if (value[1] === 0) { return keyValueTemplate(value[0], "closed"); diff --git a/src/components/VehicleMap/index.jsx b/src/components/VehicleMap/index.jsx index ff61861..2069e51 100644 --- a/src/components/VehicleMap/index.jsx +++ b/src/components/VehicleMap/index.jsx @@ -185,16 +185,7 @@ const Component = () => { {carState ? (