diff options
author | K-J-Dod24 <kieran.dodson@complexus.uk> | 2023-05-05 14:30:21 +0100 |
---|---|---|
committer | K-J-Dod24 <kieran.dodson@complexus.uk> | 2023-05-05 14:30:21 +0100 |
commit | 024e3a7633feec4e55da8b41b9f67d3155a0b991 (patch) | |
tree | 49c5540bdb7b66e6fc969d9a248d1f92a4070578 /modern/src/common | |
parent | e16f7353e850f69b29f285c80e1a0f200e5992be (diff) | |
download | trackermap-web-024e3a7633feec4e55da8b41b9f67d3155a0b991.tar.gz trackermap-web-024e3a7633feec4e55da8b41b9f67d3155a0b991.tar.bz2 trackermap-web-024e3a7633feec4e55da8b41b9f67d3155a0b991.zip |
language and position attributes io32/115
Diffstat (limited to 'modern/src/common')
-rw-r--r-- | modern/src/common/attributes/usePositionAttributes.js | 8 | ||||
-rw-r--r-- | modern/src/common/components/PositionValue.js | 6 | ||||
-rw-r--r-- | modern/src/common/util/formatter.js | 2 |
3 files changed, 15 insertions, 1 deletions
diff --git a/modern/src/common/attributes/usePositionAttributes.js b/modern/src/common/attributes/usePositionAttributes.js index 90905395..a2fab896 100644 --- a/modern/src/common/attributes/usePositionAttributes.js +++ b/modern/src/common/attributes/usePositionAttributes.js @@ -104,6 +104,14 @@ export default (t) => useMemo(() => ({ name: t('positionRssi'), type: 'number', }, + coolantTemp: { + name: t('positionCoolantTemp'), + type: 'number', + }, + engineTemp: { + name: t('positionEngineTemp'), + type: 'number', + }, gps: { name: t('positionGps'), type: 'number', diff --git a/modern/src/common/components/PositionValue.js b/modern/src/common/components/PositionValue.js index a6b38e31..2f996960 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, + formatAlarm, formatAltitude, formatBoolean, formatCoordinate, formatCourse, formatDistance, formatNumber, formatNumericHours, formatPercentage, formatSpeed, formatTime, formatCelsius, } from '../util/formatter'; import { useAttributePreference, usePreference } from '../util/preferences'; import { useTranslation } from './LocalizationProvider'; @@ -53,6 +53,10 @@ const PositionValue = ({ position, property, attribute }) => { return value != null ? formatDistance(value, distanceUnit, t) : ''; case 'hours': return value != null ? formatNumericHours(value, t) : ''; + case 'coolantTemp': + return formatCelsius(value); + case 'engineTemp': + return formatCelsius(value); default: if (typeof value === 'number') { return formatNumber(value); diff --git a/modern/src/common/util/formatter.js b/modern/src/common/util/formatter.js index 56c02547..7f08ddcb 100644 --- a/modern/src/common/util/formatter.js +++ b/modern/src/common/util/formatter.js @@ -17,6 +17,8 @@ export const formatNumber = (value, precision = 1) => Number(value.toFixed(preci export const formatPercentage = (value) => `${value}%`; +export const formatCelsius = (value) => `${value}°C`; + export const formatTime = (value, format, hours12) => { if (value) { const m = moment(value); |