diff options
Diffstat (limited to 'modern/src/settings/components')
-rw-r--r-- | modern/src/settings/components/CollectionActions.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/modern/src/settings/components/CollectionActions.js b/modern/src/settings/components/CollectionActions.js index e69553bd..e40b3eaa 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, + itemId, editPath, endpoint, setTimestamp, customAction, }) => { const theme = useTheme(); const classes = useStyles(); @@ -39,6 +39,11 @@ const CollectionActions = ({ setMenuAnchorEl(null); }; + const handleCustom = () => { + customAction.handler(itemId); + setMenuAnchorEl(null); + }; + const handleRemoveResult = (removed) => { setRemoving(false); if (removed) { @@ -54,12 +59,20 @@ const CollectionActions = ({ <MoreVertIcon fontSize="small" /> </IconButton> <Menu open={!!menuAnchorEl} anchorEl={menuAnchorEl} onClose={() => setMenuAnchorEl(null)}> + {customAction && ( + <MenuItem onClick={handleCustom}>{customAction.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} + </IconButton> + )} <IconButton size="small" onClick={handleEdit}> <EditIcon fontSize="small" /> </IconButton> |