diff options
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); |