From f31fe1395f778a3b61c783b7834b67bc2f26851c Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 17 Apr 2022 17:56:11 -0700 Subject: Improve device list icons --- modern/src/common/formatter.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'modern/src/common') diff --git a/modern/src/common/formatter.js b/modern/src/common/formatter.js index 1d4806e8..2a7c9095 100644 --- a/modern/src/common/formatter.js +++ b/modern/src/common/formatter.js @@ -4,6 +4,8 @@ export const formatBoolean = (value, t) => (value ? t('sharedYes') : t('sharedNo export const formatNumber = (value, precision = 1) => Number(value.toFixed(precision)); +export const formatPercentage = (value) => `${value}%`; + export const formatDate = (value, format = 'YYYY-MM-DD HH:mm') => moment(value).format(format); export const formatTime = (value, format = 'YYYY-MM-DD HH:mm:ss') => moment(value).format(format); @@ -24,7 +26,7 @@ export const formatPosition = (value, key, t) => { case 'course': return value.toFixed(1); case 'batteryLevel': - return `${value}%`; + return formatPercentage(value); default: if (typeof value === 'number') { return formatNumber(value); @@ -119,7 +121,7 @@ export const getBatteryStatus = (batteryLevel) => { return 'positive'; } if (batteryLevel > 30) { - return 'neutral'; + return 'medium'; } return 'negative'; }; -- cgit v1.2.3