aboutsummaryrefslogtreecommitdiff
path: root/modern/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-05-24 08:23:47 -0700
committerAnton Tananaev <anton@traccar.org>2022-05-24 08:23:47 -0700
commit5e039612130c3c567fb50da9ce5f2e955787ac6e (patch)
tree6eb5e7506fb3b6163916abd722b871a85788b3c2 /modern/src
parentad94dc32e90626d42b8d4baeefadefa0042824ec (diff)
downloadtrackermap-web-5e039612130c3c567fb50da9ce5f2e955787ac6e.tar.gz
trackermap-web-5e039612130c3c567fb50da9ce5f2e955787ac6e.tar.bz2
trackermap-web-5e039612130c3c567fb50da9ce5f2e955787ac6e.zip
Optimize status text
Diffstat (limited to 'modern/src')
-rw-r--r--modern/src/main/DevicesList.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/modern/src/main/DevicesList.js b/modern/src/main/DevicesList.js
index fe963124..057ae28d 100644
--- a/modern/src/main/DevicesList.js
+++ b/modern/src/main/DevicesList.js
@@ -75,12 +75,11 @@ const DeviceRow = ({ data, index, style }) => {
const position = useSelector((state) => state.positions.items[item.id]);
const secondaryText = () => {
- const status = formatStatus(item.status, t);
- if (item.lastUpdate) {
- const lastUpdate = moment(item.lastUpdate).fromNow();
- return `${status} ${lastUpdate}`;
+ if (item.status === 'online' || !item.lastUpdate) {
+ return formatStatus(item.status, t);
+ } else {
+ return moment(item.lastUpdate).fromNow();
}
- return status;
};
return (