CEC-1711-fix-digital-twin-ver3 (#259)
This commit is contained in:
@@ -14,7 +14,7 @@ const mapOpenCloseState = (value) =>
|
||||
|
||||
const DigitalTwin = (props) => {
|
||||
const classes = useStyles();
|
||||
const { battery, doors, location, trex_version, ip, updated, windows,misc_windows ,sunroof, dbc, door_locks } = props;
|
||||
const { battery, doors, location, trex_version, ip, updated, windows, misc_windows, sunroof, dbc, door_locks } = props;
|
||||
|
||||
return (
|
||||
<div>
|
||||
@@ -35,7 +35,7 @@ const DigitalTwin = (props) => {
|
||||
if (value[0] === "driver") {
|
||||
return keyValueTemplate(value[0], value[1] ? "Open" : "Closed");
|
||||
} else {
|
||||
return keyValueTemplate(value[0], value[1] ?"Unlocked" : "Locked" );
|
||||
return keyValueTemplate(value[0], value[1] ? "Unlocked" : "Locked");
|
||||
}
|
||||
})}
|
||||
</div>
|
||||
@@ -73,7 +73,8 @@ 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`);
|
||||
}
|
||||
})}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user