some missing newlines and add signout to the menu

This commit is contained in:
Rick Watson 2019-05-19 18:56:57 +01:00
parent 396d0333b6
commit adeb9d27ed
3 changed files with 13 additions and 4 deletions

View File

@ -20,9 +20,11 @@ import MenuIcon from '@material-ui/icons/Menu';
import WifiIcon from '@material-ui/icons/Wifi'; import WifiIcon from '@material-ui/icons/Wifi';
import SystemUpdateIcon from '@material-ui/icons/SystemUpdate'; import SystemUpdateIcon from '@material-ui/icons/SystemUpdate';
import AccessTimeIcon from '@material-ui/icons/AccessTime'; import AccessTimeIcon from '@material-ui/icons/AccessTime';
import AccountCircleIcon from '@material-ui/icons/AccountCircle';
import SettingsInputAntennaIcon from '@material-ui/icons/SettingsInputAntenna'; import SettingsInputAntennaIcon from '@material-ui/icons/SettingsInputAntenna';
import { APP_NAME } from '../constants/App'; import { APP_NAME } from '../constants/App';
import { withAuthenticationContext } from '../authentication/Context.js';
const drawerWidth = 290; const drawerWidth = 290;
@ -93,7 +95,7 @@ class MenuAppBar extends React.Component {
}; };
render() { render() {
const { classes, theme, children, sectionTitle } = this.props; const { classes, theme, children, sectionTitle, authenticationContext } = this.props;
const drawer = ( const drawer = (
<div> <div>
@ -129,6 +131,13 @@ class MenuAppBar extends React.Component {
</ListItemIcon> </ListItemIcon>
<ListItemText primary="OTA Configuration" /> <ListItemText primary="OTA Configuration" />
</ListItem> </ListItem>
<Divider />
<ListItem button onClick={authenticationContext.signOut}>
<ListItemIcon>
<AccountCircleIcon />
</ListItemIcon>
<ListItemText primary="Sign Out" secondary={"Signed in as: "+ authenticationContext.jwt.username} />
</ListItem>
</List> </List>
</div> </div>
); );
@ -193,4 +202,4 @@ MenuAppBar.propTypes = {
sectionTitle: PropTypes.string.isRequired, sectionTitle: PropTypes.string.isRequired,
}; };
export default withStyles(styles, { withTheme: true })(MenuAppBar); export default withAuthenticationContext(withStyles(styles, { withTheme: true })(MenuAppBar));

View File

@ -23,4 +23,4 @@ export const networkSecurityMode = selectedNetwork => {
default: default:
return "Unknown"; return "Unknown";
} }
} }

View File

@ -1 +1 @@
export default validator => value => !value || validator(value); export default validator => value => !value || validator(value);