diff options
author | Anton Tananaev <anton@traccar.org> | 2022-05-24 08:23:47 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-05-24 08:23:47 -0700 |
commit | 5e039612130c3c567fb50da9ce5f2e955787ac6e (patch) | |
tree | 6eb5e7506fb3b6163916abd722b871a85788b3c2 | |
parent | ad94dc32e90626d42b8d4baeefadefa0042824ec (diff) | |
download | trackermap-web-5e039612130c3c567fb50da9ce5f2e955787ac6e.tar.gz trackermap-web-5e039612130c3c567fb50da9ce5f2e955787ac6e.tar.bz2 trackermap-web-5e039612130c3c567fb50da9ce5f2e955787ac6e.zip |
Optimize status text
-rw-r--r-- | modern/src/main/DevicesList.js | 9 |
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 ( |