aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2023-05-17 09:19:23 -0700
committerGitHub <noreply@github.com>2023-05-17 09:19:23 -0700
commit2d1a2ae80337831ca28090c7bbdee6b47ff9de39 (patch)
tree8bb5b596941360d97dbb5335434ef094987b6eb7
parenteb364d8726f6e79cede10b168ea2ae31bbbe696e (diff)
parent10f26b04f81a3185d2886930708d441093e70839 (diff)
downloadtrackermap-web-2d1a2ae80337831ca28090c7bbdee6b47ff9de39.tar.gz
trackermap-web-2d1a2ae80337831ca28090c7bbdee6b47ff9de39.tar.bz2
trackermap-web-2d1a2ae80337831ca28090c7bbdee6b47ff9de39.zip
Merge pull request #1123 from Complexus-Limited/Teltonika-io32-coolantTemp
Teltonika io32 coolant temp
-rw-r--r--modern/src/common/attributes/usePositionAttributes.js4
-rw-r--r--modern/src/common/components/PositionValue.js4
-rw-r--r--modern/src/common/util/formatter.js2
-rw-r--r--modern/src/resources/l10n/en.json1
4 files changed, 10 insertions, 1 deletions
diff --git a/modern/src/common/attributes/usePositionAttributes.js b/modern/src/common/attributes/usePositionAttributes.js
index cc50911c..e08e91d5 100644
--- a/modern/src/common/attributes/usePositionAttributes.js
+++ b/modern/src/common/attributes/usePositionAttributes.js
@@ -104,6 +104,10 @@ export default (t) => useMemo(() => ({
name: t('positionRssi'),
type: 'number',
},
+ coolantTemp: {
+ name: t('positionCoolantTemp'),
+ 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..132cd648 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, formatTemperature,
} from '../util/formatter';
import { useAttributePreference, usePreference } from '../util/preferences';
import { useTranslation } from './LocalizationProvider';
@@ -45,6 +45,8 @@ const PositionValue = ({ position, property, attribute }) => {
return formatAltitude(value, altitudeUnit, t);
case 'batteryLevel':
return value != null ? formatPercentage(value, t) : '';
+ case 'coolantTemp':
+ return formatTemperature(value);
case 'alarm':
return formatAlarm(value, t);
case 'odometer':
diff --git a/modern/src/common/util/formatter.js b/modern/src/common/util/formatter.js
index 56c02547..610b8dd0 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 formatTemperature = (value) => `${value}°C`;
+
export const formatTime = (value, format, hours12) => {
if (value) {
const m = moment(value);
diff --git a/modern/src/resources/l10n/en.json b/modern/src/resources/l10n/en.json
index c20023a0..fa14778b 100644
--- a/modern/src/resources/l10n/en.json
+++ b/modern/src/resources/l10n/en.json
@@ -287,6 +287,7 @@
"positionAcceleration": "Acceleration",
"positionTemp": "Temperature",
"positionDeviceTemp": "Device Temperature",
+ "positionCoolantTemp": "Coolant Temperature",
"positionOperator": "Operator",
"positionCommand": "Command",
"positionBlocked": "Blocked",