Skip to content

Commit

Permalink
🐛 fix(accounts): Improve disconnected user uix
Browse files Browse the repository at this point in the history
fixes #36
  • Loading branch information
make-github-pseudonymous-again committed Nov 25, 2018
1 parent 2caa31e commit e17da92
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion imports/ui/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class App extends React.Component {
<WholeWindowDropZone callback={handleDrop(history)}/>
<div className={classes.appFrame}>
<Header patients={patients} currentUser={currentUser}/>
<NavigationDrawer/>
<NavigationDrawer currentUser={currentUser}/>
<Router currentUser={currentUser} patients={patients}/>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions imports/ui/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ class Header extends React.Component {
<Toolbar>
<Typography variant="h6" color="inherit" className={classes.title}>{location.pathname}</Typography>
<div style={{flex:'1 1 auto'}}></div>
<SearchBox
{ currentUser && <SearchBox
filter={getSuggestions}
suggestions={suggestions}
itemToString={item => item ? item.label : ''}
onChange={this.handleChange}
stateReducer={this.reduceState}
/>
/> }
<AccountsUI currentUser={currentUser}/>
</Toolbar>
</AppBar>
Expand Down
4 changes: 2 additions & 2 deletions imports/ui/NavigationDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const styles = theme => ({
drawerHeader: theme.mixins.toolbar,
});

function NavigationDrawer ( { classes } ) {
function NavigationDrawer ( { classes, currentUser } ) {

const blocks = [

Expand Down Expand Up @@ -219,7 +219,7 @@ function NavigationDrawer ( { classes } ) {
<List>
{
links.map( link => (
<ListItem key={link.to} disabled={link.disabled} button component={Link} to={link.to}>
<ListItem key={link.to} disabled={!currentUser || link.disabled} button component={Link} to={link.to}>
<ListItemIcon>{link.icon}</ListItemIcon>
<ListItemText primary={link.title}/>
</ListItem>
Expand Down
6 changes: 6 additions & 0 deletions imports/ui/Router.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ class Main extends React.Component {

const { classes, patients, currentUser } = this.props;

if (!currentUser) return (
<main className={classes.main}>
<Typography variant="h5">Please sign in</Typography>
</main>
) ;

return (
<main className={classes.main}>
<Switch>
Expand Down

0 comments on commit e17da92

Please sign in to comment.