aboutsummaryrefslogtreecommitdiff
path: root/modern/src/common/util
diff options
context:
space:
mode:
authorMatjaž Črnko <m.crnko@txt.si>2023-06-16 12:29:22 +0200
committerMatjaž Črnko <m.crnko@txt.si>2023-06-16 12:29:22 +0200
commit16e5e019089ea03df4562551043e37130db314c6 (patch)
tree45df0c1774f2c9476d9771fd11adff9eb2e188a1 /modern/src/common/util
parentb77d0f87b24d90d5e0d8da43aa11d08690880755 (diff)
downloadtrackermap-web-16e5e019089ea03df4562551043e37130db314c6.tar.gz
trackermap-web-16e5e019089ea03df4562551043e37130db314c6.tar.bz2
trackermap-web-16e5e019089ea03df4562551043e37130db314c6.zip
fix: Modern sync Driver Unique ID Position Attribute formatter
Diffstat (limited to 'modern/src/common/util')
-rw-r--r--modern/src/common/util/formatter.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/modern/src/common/util/formatter.js b/modern/src/common/util/formatter.js
index 0f7d2cc8..792a4ef0 100644
--- a/modern/src/common/util/formatter.js
+++ b/modern/src/common/util/formatter.js
@@ -1,3 +1,4 @@
+import { useSelector } from 'react-redux';
import moment from 'moment';
import {
altitudeFromMeters,
@@ -68,6 +69,16 @@ export const formatNumericHours = (value, t) => {
return `${hours} ${t('sharedHourAbbreviation')} ${minutes} ${t('sharedMinuteAbbreviation')}`;
};
+export const formatDriverUniqueId = (value) => {
+ const drivers = useSelector((state) => state.drivers.items);
+ let driverId = `${value}`;
+ const storedDriver = Object.values(drivers).find((d) => d.uniqueId === driverId);
+ if (storedDriver) {
+ driverId += ` (${storedDriver.name})`;
+ }
+ return driverId;
+};
+
export const formatCoordinate = (key, value, unit) => {
let hemisphere;
let degrees;