diff options
author | Anton Tananaev <anton@traccar.org> | 2023-02-23 11:48:06 -0800 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-02-23 11:48:06 -0800 |
commit | 5f65762c67aacc9a621983fcb06107b982792c3f (patch) | |
tree | b4c29451fbfb2fc0e090671efc76188725ac4d59 /modern/src/settings/components | |
parent | d64115f88d84c85b149063cf8929d1f57c66935f (diff) | |
download | trackermap-web-5f65762c67aacc9a621983fcb06107b982792c3f.tar.gz trackermap-web-5f65762c67aacc9a621983fcb06107b982792c3f.tar.bz2 trackermap-web-5f65762c67aacc9a621983fcb06107b982792c3f.zip |
Separate connections from edit
Diffstat (limited to 'modern/src/settings/components')
-rw-r--r-- | modern/src/settings/components/CollectionActions.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/modern/src/settings/components/CollectionActions.js b/modern/src/settings/components/CollectionActions.js index e40b3eaa..b84d8f0f 100644 --- a/modern/src/settings/components/CollectionActions.js +++ b/modern/src/settings/components/CollectionActions.js @@ -17,7 +17,7 @@ const useStyles = makeStyles(() => ({ })); const CollectionActions = ({ - itemId, editPath, endpoint, setTimestamp, customAction, + itemId, editPath, endpoint, setTimestamp, customActions, }) => { const theme = useTheme(); const classes = useStyles(); @@ -39,8 +39,8 @@ const CollectionActions = ({ setMenuAnchorEl(null); }; - const handleCustom = () => { - customAction.handler(itemId); + const handleCustom = (action) => { + action.handler(itemId); setMenuAnchorEl(null); }; @@ -59,20 +59,20 @@ const CollectionActions = ({ <MoreVertIcon fontSize="small" /> </IconButton> <Menu open={!!menuAnchorEl} anchorEl={menuAnchorEl} onClose={() => setMenuAnchorEl(null)}> - {customAction && ( - <MenuItem onClick={handleCustom}>{customAction.title}</MenuItem> - )} + {customActions && customActions.map((action) => ( + <MenuItem onClick={() => handleCustom(action)} key={action.key}>{action.title}</MenuItem> + ))} <MenuItem onClick={handleEdit}>{t('sharedEdit')}</MenuItem> <MenuItem onClick={handleRemove}>{t('sharedRemove')}</MenuItem> </Menu> </> ) : ( <div className={classes.row}> - {customAction && ( - <IconButton size="small" onClick={handleCustom}> - {customAction.icon} + {customActions && customActions.map((action) => ( + <IconButton size="small" onClick={() => handleCustom(action)} key={action.key}> + {action.icon} </IconButton> - )} + ))} <IconButton size="small" onClick={handleEdit}> <EditIcon fontSize="small" /> </IconButton> |