aboutsummaryrefslogtreecommitdiff
path: root/modern/src/MainToolbar.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-09-20 18:22:36 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-09-20 18:22:36 -0700
commitb124908d9f9f2a24963871cac982cc5b5e172ba5 (patch)
tree87ccaa2cbb104af3547dab06703821fe48c4bc00 /modern/src/MainToolbar.js
parentb2cd88bbbad82654057cec8aec7415a8caca667e (diff)
downloadtrackermap-web-b124908d9f9f2a24963871cac982cc5b5e172ba5.tar.gz
trackermap-web-b124908d9f9f2a24963871cac982cc5b5e172ba5.tar.bz2
trackermap-web-b124908d9f9f2a24963871cac982cc5b5e172ba5.zip
Implement simple users screen
Diffstat (limited to 'modern/src/MainToolbar.js')
-rw-r--r--modern/src/MainToolbar.js28
1 files changed, 27 insertions, 1 deletions
diff --git a/modern/src/MainToolbar.js b/modern/src/MainToolbar.js
index e627f52c..338e961b 100644
--- a/modern/src/MainToolbar.js
+++ b/modern/src/MainToolbar.js
@@ -1,7 +1,7 @@
import React, { useState } from 'react';
import { useHistory } from 'react-router-dom';
import { makeStyles } from '@material-ui/core/styles';
-import { useDispatch } from 'react-redux';
+import { useDispatch, useSelector } from 'react-redux';
import { sessionActions } from './store';
import AppBar from '@material-ui/core/AppBar';
import Toolbar from '@material-ui/core/Toolbar';
@@ -19,6 +19,7 @@ import ListItemText from '@material-ui/core/ListItemText';
import DashboardIcon from '@material-ui/icons/Dashboard';
import BarChartIcon from '@material-ui/icons/BarChart';
import SettingsIcon from '@material-ui/icons/Settings';
+import PeopleIcon from '@material-ui/icons/People';
import t from './common/localization';
const useStyles = makeStyles(theme => ({
@@ -42,6 +43,7 @@ const MainToolbar = () => {
const [drawer, setDrawer] = useState(false);
const classes = useStyles();
const history = useHistory();
+ const adminEnabled = useSelector(state => state.session.user && state.session.user.administrator);
const openDrawer = () => { setDrawer(true) }
const closeDrawer = () => { setDrawer(false) }
@@ -155,6 +157,30 @@ const MainToolbar = () => {
<ListItemText primary={t('sharedNotifications')} />
</ListItem>
</List>
+ {adminEnabled && (
+ <>
+ <Divider />
+ <List
+ subheader={
+ <ListSubheader>
+ {t('userAdmin')}
+ </ListSubheader>
+ }>
+ <ListItem button onClick={() => { history.push('/admin/users') }}>
+ <ListItemIcon>
+ <PeopleIcon />
+ </ListItemIcon>
+ <ListItemText primary={t('settingsUsers')} />
+ </ListItem>
+ <ListItem button disabled>
+ <ListItemIcon>
+ <BarChartIcon />
+ </ListItemIcon>
+ <ListItemText primary={t('statisticsTitle')} />
+ </ListItem>
+ </List>
+ </>
+ )}
</div>
</Drawer>
</>