From 82269da96e42b1d0c3a8844a1363ec548fcc296f Mon Sep 17 00:00:00 2001 From: Chen-I Lim Date: Thu, 28 Jan 2021 14:15:03 -0800 Subject: [PATCH] Handle single-user app (user) menu --- webapp/src/components/sidebar.tsx | 62 ++++++++++++++----------------- 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/webapp/src/components/sidebar.tsx b/webapp/src/components/sidebar.tsx index b2b488b67..c4894ccb1 100644 --- a/webapp/src/components/sidebar.tsx +++ b/webapp/src/components/sidebar.tsx @@ -105,15 +105,7 @@ class Sidebar extends React.Component {
{(user) => { - if (user) { - if (user.id === 'single-user') { - return ( -
{intl.formatMessage({id: 'Sidebar.title', defaultMessage: 'Boards'})}
- ) - } - return this.renderUserMenu(user) - } - return
+ return this.renderUserMenu(user) }}
@@ -366,7 +358,7 @@ class Sidebar extends React.Component { this.setState({whiteLogo}) } - private renderUserMenu(user: IUser): JSX.Element { + private renderUserMenu(user?: IUser): JSX.Element { const {intl} = this.props return ( @@ -374,31 +366,33 @@ class Sidebar extends React.Component { {this.state.whiteLogo ? : } - {user.username} - { - octoClient.logout() - window.location.href = '/login' - }} - /> - { - window.location.href = '/change_password' - }} - /> - { - this.setState({showRegistrationLinkDialog: true}) - }} - /> + {user && user.username !== 'single-user' && <> + {user.username} + { + octoClient.logout() + window.location.href = '/login' + }} + /> + { + window.location.href = '/change_password' + }} + /> + { + this.setState({showRegistrationLinkDialog: true}) + }} + /> - + + }