From fc990dcc50650862c4f12a1a530b98bbd36ea4b8 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 14 Sep 2020 22:37:38 -0700 Subject: Add location and battery level --- modern/src/StatusView.js | 4 ++++ modern/src/common/formatter.js | 2 ++ 2 files changed, 6 insertions(+) (limited to 'modern/src') 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 ( <> {t('deviceStatus')}: {formatter(device.status, 'status')}
+ {t('sharedLocation')}: {formatter(position, 'latitude')} {formatter(position, 'longitude')}
{t('positionSpeed')}: {formatter(position.speed, 'speed')}
{t('positionCourse')}: {formatter(position.course, 'course')}
{t('positionDistance')}: {formatter(position.attributes.totalDistance, 'distance')}
+ {position.attributes.batteryLevel && + <>{t('positionBattery')}: {formatter(position.attributes.batteryLevel, 'batteryLevel')}
+ } ); }; 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; } -- cgit v1.2.3