diff options
author | Matjaž Črnko <m.crnko@txt.si> | 2023-06-16 11:24:06 +0200 |
---|---|---|
committer | Matjaž Črnko <m.crnko@txt.si> | 2023-06-16 11:24:06 +0200 |
commit | e2aeaa191688bb245113f8280e7e1edd44c08bf3 (patch) | |
tree | 116fe3466f03be97b1075c86e0e3ceaada5dc761 /modern/src/common | |
parent | cd5b1513be814f27dcb6196779af772d9fdf656f (diff) | |
download | trackermap-web-e2aeaa191688bb245113f8280e7e1edd44c08bf3.tar.gz trackermap-web-e2aeaa191688bb245113f8280e7e1edd44c08bf3.tar.bz2 trackermap-web-e2aeaa191688bb245113f8280e7e1edd44c08bf3.zip |
fix: Modern sync Speed, Distance and Voltage Position Attribute formatters
Diffstat (limited to 'modern/src/common')
-rw-r--r-- | modern/src/common/components/PositionValue.js | 9 | ||||
-rw-r--r-- | modern/src/common/util/formatter.js | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/modern/src/common/components/PositionValue.js b/modern/src/common/components/PositionValue.js index 132cd648..9711a7bb 100644 --- a/modern/src/common/components/PositionValue.js +++ b/modern/src/common/components/PositionValue.js @@ -3,7 +3,7 @@ import { useSelector } from 'react-redux'; import { Link } from '@mui/material'; import { Link as RouterLink } from 'react-router-dom'; import { - formatAlarm, formatAltitude, formatBoolean, formatCoordinate, formatCourse, formatDistance, formatNumber, formatNumericHours, formatPercentage, formatSpeed, formatTime, formatTemperature, + formatAlarm, formatAltitude, formatBoolean, formatCoordinate, formatCourse, formatDistance, formatNumber, formatNumericHours, formatPercentage, formatSpeed, formatTime, formatTemperature, formatVoltage, } from '../util/formatter'; import { useAttributePreference, usePreference } from '../util/preferences'; import { useTranslation } from './LocalizationProvider'; @@ -38,11 +38,15 @@ const PositionValue = ({ position, property, attribute }) => { case 'longitude': return formatCoordinate('longitude', value, coordinateFormat); case 'speed': + case 'obdSpeed': return formatSpeed(value, speedUnit, t); case 'course': return formatCourse(value); case 'altitude': return formatAltitude(value, altitudeUnit, t); + case 'power': + case 'battery': + return formatVoltage(value, t); case 'batteryLevel': return value != null ? formatPercentage(value, t) : ''; case 'coolantTemp': @@ -50,6 +54,9 @@ const PositionValue = ({ position, property, attribute }) => { case 'alarm': return formatAlarm(value, t); case 'odometer': + case 'serviceOdometer': + case 'tripOdometer': + case 'obdOdometer': case 'distance': case 'totalDistance': return value != null ? formatDistance(value, distanceUnit, t) : ''; diff --git a/modern/src/common/util/formatter.js b/modern/src/common/util/formatter.js index 610b8dd0..3ef83dba 100644 --- a/modern/src/common/util/formatter.js +++ b/modern/src/common/util/formatter.js @@ -19,6 +19,8 @@ export const formatPercentage = (value) => `${value}%`; export const formatTemperature = (value) => `${value}°C`; +export const formatVoltage = (value, t) => `${value} ${t('sharedVoltAbbreviation')}`; + export const formatTime = (value, format, hours12) => { if (value) { const m = moment(value); |