diff options
author | Iván Ávalos <avalos@disroot.org> | 2022-05-05 00:00:31 -0500 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2022-05-05 00:00:31 -0500 |
commit | a57390425913896128b2472ae95e1504c521422f (patch) | |
tree | 6699282737e0e2db2f1517e099c080f5b096156b /modern/src/GeofencesList.js | |
parent | 7f7c56cbb4ecf1d3f3657283cbe7de2637504fff (diff) | |
download | etbsa-traccar-web-a57390425913896128b2472ae95e1504c521422f.tar.gz etbsa-traccar-web-a57390425913896128b2472ae95e1504c521422f.tar.bz2 etbsa-traccar-web-a57390425913896128b2472ae95e1504c521422f.zip |
Geofences now center when clicked in /geofences
Diffstat (limited to 'modern/src/GeofencesList.js')
-rw-r--r-- | modern/src/GeofencesList.js | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/modern/src/GeofencesList.js b/modern/src/GeofencesList.js index 572ac5b..1fab04a 100644 --- a/modern/src/GeofencesList.js +++ b/modern/src/GeofencesList.js @@ -9,7 +9,7 @@ import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction'; import ListItemText from '@material-ui/core/ListItemText'; import MoreVertIcon from '@material-ui/icons/MoreVert'; -import { devicesActions } from './store'; +import { geofencesActions, uiActions } from './store'; import EditCollectionView from './EditCollectionView'; const useStyles = makeStyles(() => ({ @@ -33,19 +33,26 @@ const GeofenceView = ({ onMenuClick }) => { return ( <List className={classes.list}> {items.map((item, index, list) => ( - <Fragment key={item.id}> - <ListItem button key={item.id} onClick={() => dispatch(devicesActions.select(item))}> - <ListItemText primary={item.name} /> - <ListItemSecondaryAction> - <IconButton onClick={(event) => onMenuClick(event.currentTarget, item.id)}> - <MoreVertIcon /> - </IconButton> - </ListItemSecondaryAction> + <Fragment key={item.id}> + <ListItem button key={item.id} onClick={() => { + dispatch(geofencesActions.select(item)); + dispatch(uiActions.setCollapsed(true)); + setTimeout(() => { + dispatch(geofencesActions.unselect()); + }, 1000); + }}> + <ListItemText primary={item.name} /> + <ListItemSecondaryAction> + <IconButton onClick={(event) => onMenuClick(event.currentTarget, item.id)}> + <MoreVertIcon /> + </IconButton> + </ListItemSecondaryAction> </ListItem> - {index < list.length - 1 ? <Divider /> : null} + { index<list.length - 1 ? <Divider /> : null } </Fragment> - ))} - </List> + )) +} + </List > ); }; |