aboutsummaryrefslogtreecommitdiff
path: root/modern/src/DevicesList.js
diff options
context:
space:
mode:
authorAshutosh Bishnoi <mail2bishnoi@gmail.com>2021-07-19 13:22:11 +0530
committerAshutosh Bishnoi <mail2bishnoi@gmail.com>2021-07-19 13:22:11 +0530
commit4a6ed2462ed5ed2960fc8245ac3c5bae967e685b (patch)
treee266c5255389b78553b52f3c10fe75512576bbf7 /modern/src/DevicesList.js
parentcddbb69b40883155ded4679f6a8f7b25b09882ca (diff)
downloadtrackermap-web-4a6ed2462ed5ed2960fc8245ac3c5bae967e685b.tar.gz
trackermap-web-4a6ed2462ed5ed2960fc8245ac3c5bae967e685b.tar.bz2
trackermap-web-4a6ed2462ed5ed2960fc8245ac3c5bae967e685b.zip
Minor code improvement
Diffstat (limited to 'modern/src/DevicesList.js')
-rw-r--r--modern/src/DevicesList.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/modern/src/DevicesList.js b/modern/src/DevicesList.js
index 6f0b7639..b06f7f76 100644
--- a/modern/src/DevicesList.js
+++ b/modern/src/DevicesList.js
@@ -28,6 +28,12 @@ const useStyles = makeStyles((theme) => ({
height: '25px',
filter: 'brightness(0) invert(1)',
},
+ listItem: {
+ backgroundColor: 'white',
+ '&:hover': {
+ backgroundColor: 'white',
+ },
+ },
batteryText: {
fontSize: '0.75rem',
fontWeight: 'normal',
@@ -44,7 +50,7 @@ const useStyles = makeStyles((theme) => ({
},
}));
-const getOnlineStatus = (status) => {
+const getStatusColor = (status) => {
switch (status) {
case 'online':
return 'green';
@@ -77,13 +83,13 @@ const DeviceRow = ({ data, index, style }) => {
return (
<div style={style}>
<Fragment key={index}>
- <ListItem button key={item.id} onClick={() => dispatch(devicesActions.select(item))}>
+ <ListItem button key={item.id} className={classes.listItem} onClick={() => dispatch(devicesActions.select(item))}>
<ListItemAvatar>
<Avatar>
<img className={classes.icon} src={`images/icon/${item.category || 'default'}.svg`} alt="" />
</Avatar>
</ListItemAvatar>
- <ListItemText primary={item.name} secondary={item.status} classes={{ secondary: classes[getOnlineStatus(item.status)] }} />
+ <ListItemText primary={item.name} secondary={item.status} classes={{ secondary: classes[getStatusColor(item.status)] }} />
<ListItemSecondaryAction>
{position && (
<Grid container direction="row" alignItems="center" alignContent="center" spacing={1}>
@@ -145,7 +151,7 @@ const DeviceView = ({ updateTimestamp, onMenuClick }) => {
};
const DevicesList = () => (
- <EditCollectionView content={DeviceView} editPath="/device" endpoint="devices" />
+ <EditCollectionView content={DeviceView} editPath="/device" endpoint="devices" disableAdd />
);
export default DevicesList;