aboutsummaryrefslogtreecommitdiff
path: root/modern/src/EditCollectionView.js
diff options
context:
space:
mode:
authorDesmond Kyeremeh <elDekyfin@gmail.com>2021-07-11 22:14:39 +0000
committerDesmond Kyeremeh <elDekyfin@gmail.com>2021-07-11 22:14:39 +0000
commit1b93de84e2bf6a6532bdb03e1ae75e47061a4dca (patch)
tree8989ce8c6c5bb1d2a748ffe91895fe929c99dd5e /modern/src/EditCollectionView.js
parentefe18c504a834760242937572b369530c552e589 (diff)
downloadetbsa-traccar-web-1b93de84e2bf6a6532bdb03e1ae75e47061a4dca.tar.gz
etbsa-traccar-web-1b93de84e2bf6a6532bdb03e1ae75e47061a4dca.tar.bz2
etbsa-traccar-web-1b93de84e2bf6a6532bdb03e1ae75e47061a4dca.zip
Fixed linting
Diffstat (limited to 'modern/src/EditCollectionView.js')
-rw-r--r--modern/src/EditCollectionView.js27
1 files changed, 15 insertions, 12 deletions
diff --git a/modern/src/EditCollectionView.js b/modern/src/EditCollectionView.js
index 572a1d1..7d5e4b2 100644
--- a/modern/src/EditCollectionView.js
+++ b/modern/src/EditCollectionView.js
@@ -10,7 +10,7 @@ import { useSelector } from 'react-redux';
import t from './common/localization';
import RemoveDialog from './RemoveDialog';
-const useStyles = makeStyles(theme => ({
+const useStyles = makeStyles((theme) => ({
fab: {
position: 'absolute',
bottom: theme.spacing(2),
@@ -18,7 +18,9 @@ const useStyles = makeStyles(theme => ({
},
}));
-const EditCollectionView = ({ content, editPath, endpoint, disableAdd }) => {
+const EditCollectionView = ({
+ content, editPath, endpoint, disableAdd,
+}) => {
const classes = useStyles();
const history = useHistory();
@@ -26,47 +28,48 @@ const EditCollectionView = ({ content, editPath, endpoint, disableAdd }) => {
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 adminEnabled = useSelector((state) => state.session.user && state.session.user.administrator);
const menuShow = (anchorId, itemId) => {
setSelectedAnchorEl(anchorId);
setSelectedId(itemId);
- }
+ };
const menuHide = () => {
setSelectedAnchorEl(null);
- }
+ };
const handleAdd = () => {
history.push(editPath);
menuHide();
- }
+ };
const handleEdit = () => {
history.push(`${editPath}/${selectedId}`);
menuHide();
- }
+ };
const handleRemove = () => {
setRemoveDialogShown(true);
menuHide();
- }
+ };
const handleRemoveResult = () => {
setRemoveDialogShown(false);
setUpdateTimestamp(Date.now());
- }
+ };
const Content = content;
return (
<>
<Content updateTimestamp={updateTimestamp} onMenuClick={menuShow} />
- {adminEnabled && !disableAdd &&
+ {adminEnabled && !disableAdd
+ && (
<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>
@@ -74,6 +77,6 @@ const EditCollectionView = ({ content, editPath, endpoint, disableAdd }) => {
<RemoveDialog open={removeDialogShown} endpoint={endpoint} itemId={selectedId} onResult={handleRemoveResult} />
</>
);
-}
+};
export default EditCollectionView;