aboutsummaryrefslogtreecommitdiff
path: root/modern/src/DevicesList.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-04-16 16:08:03 -0700
committerAnton Tananaev <anton@traccar.org>2022-04-16 16:08:03 -0700
commit838e1b969162b73b1bbafab75203998e7bf60979 (patch)
treebf99356e4040fd836c4775777f170c06e3460136 /modern/src/DevicesList.js
parentdaacba8e25f5c60c77fab15e9392f43be3fa7a67 (diff)
downloadtrackermap-web-838e1b969162b73b1bbafab75203998e7bf60979.tar.gz
trackermap-web-838e1b969162b73b1bbafab75203998e7bf60979.tar.bz2
trackermap-web-838e1b969162b73b1bbafab75203998e7bf60979.zip
Clean up palette and colors
Diffstat (limited to 'modern/src/DevicesList.js')
-rw-r--r--modern/src/DevicesList.js36
1 files changed, 7 insertions, 29 deletions
diff --git a/modern/src/DevicesList.js b/modern/src/DevicesList.js
index 10ac4fc7..a2495f9d 100644
--- a/modern/src/DevicesList.js
+++ b/modern/src/DevicesList.js
@@ -17,7 +17,7 @@ import { ReactComponent as IgnitionIcon } from '../public/images/ignition.svg';
import { devicesActions } from './store';
import EditCollectionView from './EditCollectionView';
import { useEffectAsync } from './reactHelper';
-import { formatPosition } from './common/formatter';
+import { formatPosition, getBatteryStatus, getStatusColor } from './common/formatter';
import { getDevices, getPosition } from './common/selectors';
import { useTranslation } from './LocalizationProvider';
@@ -45,42 +45,20 @@ const useStyles = makeStyles((theme) => ({
fontWeight: 'normal',
lineHeight: '0.875rem',
},
- green: {
- color: theme.palette.common.green,
+ positive: {
+ color: theme.palette.colors.positive,
},
- red: {
- color: theme.palette.common.red,
+ negative: {
+ color: theme.palette.colors.negative,
},
- gray: {
- color: theme.palette.common.gray,
+ neutral: {
+ color: theme.palette.colors.neutral,
},
indicators: {
lineHeight: 1,
},
}));
-const getStatusColor = (status) => {
- switch (status) {
- case 'online':
- return 'green';
- case 'offline':
- return 'red';
- case 'unknown':
- default:
- return 'gray';
- }
-};
-
-const getBatteryStatus = (batteryLevel) => {
- if (batteryLevel >= 70) {
- return 'green';
- }
- if (batteryLevel > 30) {
- return 'gray';
- }
- return 'red';
-};
-
const DeviceRow = ({ data, index, style }) => {
const classes = useStyles();
const dispatch = useDispatch();