diff options
author | Ashutosh Bishnoi <mail2bishnoi@gmail.com> | 2021-07-26 16:47:10 +0530 |
---|---|---|
committer | Ashutosh Bishnoi <mail2bishnoi@gmail.com> | 2021-08-06 14:55:03 +0530 |
commit | e20e1adae62caf1a0aa0a8f25c8994fcd8cf8c8c (patch) | |
tree | e1f337404b7aef5f1716e77c1c5667ffbd44a31f /modern/src/common | |
parent | 59c60f8fcfabe855231e3dfecf9b363b7488024f (diff) | |
download | trackermap-web-e20e1adae62caf1a0aa0a8f25c8994fcd8cf8c8c.tar.gz trackermap-web-e20e1adae62caf1a0aa0a8f25c8994fcd8cf8c8c.tar.bz2 trackermap-web-e20e1adae62caf1a0aa0a8f25c8994fcd8cf8c8c.zip |
Rebases the pull request
Initial Draft of Device Quick Menu
Initial Draft
Diffstat (limited to 'modern/src/common')
-rw-r--r-- | modern/src/common/formatter.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/modern/src/common/formatter.js b/modern/src/common/formatter.js index 3c0341b7..f0bb2e11 100644 --- a/modern/src/common/formatter.js +++ b/modern/src/common/formatter.js @@ -98,3 +98,25 @@ export const formatCoordinate = (key, value, unit) => { return `${value.toFixed(6)}°`; } }; + +export const getStatusColor = (status) => { + switch (status) { + case 'online': + return 'green'; + case 'offline': + return 'red'; + case 'unknown': + default: + return 'gray'; + } +}; + +export const getBatteryStatus = (batteryLevel) => { + if (batteryLevel >= 70) { + return 'green'; + } + if (batteryLevel > 30) { + return 'gray'; + } + return 'red'; +}; |