aboutsummaryrefslogtreecommitdiff
path: root/modern/src/EditCollectionView.js
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/EditCollectionView.js')
-rw-r--r--modern/src/EditCollectionView.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/modern/src/EditCollectionView.js b/modern/src/EditCollectionView.js
index bec10562..d3d0af17 100644
--- a/modern/src/EditCollectionView.js
+++ b/modern/src/EditCollectionView.js
@@ -5,6 +5,7 @@ import Menu from '@material-ui/core/Menu';
import MenuItem from '@material-ui/core/MenuItem';
import Fab from '@material-ui/core/Fab';
import AddIcon from '@material-ui/icons/Add';
+import { useSelector } from 'react-redux';
import t from './common/localization';
import RemoveDialog from './RemoveDialog';
@@ -25,6 +26,7 @@ const EditCollectionView = ({ content, editPath, endpoint }) => {
const [selectedAnchorEl, setSelectedAnchorEl] = useState(null);
const [removeDialogShown, setRemoveDialogShown] = useState(false);
const [updateTimestamp, setUpdateTimestamp] = useState(Date.now());
+ const adminEnabled = useSelector(state => state.session.user && state.session.user.administrator);
const menuShow = (anchorId, itemId) => {
setSelectedAnchorEl(anchorId);
@@ -60,9 +62,11 @@ const EditCollectionView = ({ content, editPath, endpoint }) => {
return (
<>
<Content updateTimestamp={updateTimestamp} onMenuClick={menuShow} />
- <Fab size="medium" color="primary" className={classes.fab} onClick={handleAdd}>
- <AddIcon />
- </Fab>
+ {adminEnabled &&
+ <Fab size="medium" color="primary" className={classes.fab} onClick={handleAdd}>
+ <AddIcon />
+ </Fab>
+ }
<Menu open={!!selectedAnchorEl} anchorEl={selectedAnchorEl} onClose={menuHide}>
<MenuItem onClick={handleEdit}>{t('sharedEdit')}</MenuItem>
<MenuItem onClick={handleRemove}>{t('sharedRemove')}</MenuItem>