diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-09-14 22:37:38 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-09-14 22:37:38 -0700 |
commit | fc990dcc50650862c4f12a1a530b98bbd36ea4b8 (patch) | |
tree | 8bd7446da64bc906657a28a72f7fae183f01513a | |
parent | 5b1d69ef52e9200c35bf8986c265a42be7cf23cf (diff) | |
download | trackermap-web-fc990dcc50650862c4f12a1a530b98bbd36ea4b8.tar.gz trackermap-web-fc990dcc50650862c4f12a1a530b98bbd36ea4b8.tar.bz2 trackermap-web-fc990dcc50650862c4f12a1a530b98bbd36ea4b8.zip |
Add location and battery level
-rw-r--r-- | modern/src/StatusView.js | 4 | ||||
-rw-r--r-- | modern/src/common/formatter.js | 2 | ||||
-rw-r--r-- | web/l10n/en.json | 1 |
3 files changed, 7 insertions, 0 deletions
diff --git a/modern/src/StatusView.js b/modern/src/StatusView.js index ed0149ef..756a95a5 100644 --- a/modern/src/StatusView.js +++ b/modern/src/StatusView.js @@ -10,9 +10,13 @@ const StatusView = (props) => { return ( <> <b>{t('deviceStatus')}:</b> {formatter(device.status, 'status')}<br /> + <b>{t('sharedLocation')}:</b> {formatter(position, 'latitude')} {formatter(position, 'longitude')}<br /> <b>{t('positionSpeed')}:</b> {formatter(position.speed, 'speed')}<br /> <b>{t('positionCourse')}:</b> {formatter(position.course, 'course')}<br /> <b>{t('positionDistance')}:</b> {formatter(position.attributes.totalDistance, 'distance')}<br /> + {position.attributes.batteryLevel && + <><b>{t('positionBattery')}:</b> {formatter(position.attributes.batteryLevel, 'batteryLevel')}<br /></> + } </> ); }; diff --git a/modern/src/common/formatter.js b/modern/src/common/formatter.js index 50841e15..9a61b178 100644 --- a/modern/src/common/formatter.js +++ b/modern/src/common/formatter.js @@ -10,6 +10,8 @@ const formatValue = (key, value) => { case 'speed': case 'course': return value.toFixed(1); + case 'batteryLevel': + return value + '%'; default: return value; } diff --git a/web/l10n/en.json b/web/l10n/en.json index 000325dd..627edece 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -77,6 +77,7 @@ "sharedMaintenance": "Maintenance", "sharedDeviceAccumulators": "Accumulators", "sharedAlarms": "Alarms", + "sharedLocation": "Location", "attributeSpeedLimit": "Speed Limit", "attributePolylineDistance": "Polyline Distance", "attributeReportIgnoreOdometer": "Report: Ignore Odometer", |