You've already forked focalboard
							
							
				mirror of
				https://github.com/mattermost/focalboard.git
				synced 2025-10-31 00:17:42 +02:00 
			
		
		
		
	Remove user menu for single-user
This commit is contained in:
		| @@ -97,6 +97,7 @@ | ||||
|   "Sidebar.settings": "Settings", | ||||
|   "Sidebar.spanish": "Spanish", | ||||
|   "Sidebar.template-from-board": "New template from board", | ||||
|   "Sidebar.title": "Boards", | ||||
|   "Sidebar.untitled": "Untitled", | ||||
|   "Sidebar.untitled-board": "(Untitled Board)", | ||||
|   "Sidebar.untitled-view": "(Untitled View)", | ||||
|   | ||||
| @@ -44,8 +44,9 @@ | ||||
|         padding: 3px 20px; | ||||
|         margin-bottom: 5px; | ||||
|  | ||||
|         >.username { | ||||
|         >.heading { | ||||
|             line-height: 30px; | ||||
|             cursor: default; | ||||
|         } | ||||
|  | ||||
|         >.IconButton { | ||||
|   | ||||
| @@ -9,7 +9,7 @@ import {BoardView, MutableBoardView} from '../blocks/boardView' | ||||
| import mutator from '../mutator' | ||||
| import octoClient from '../octoClient' | ||||
| import {darkTheme, defaultTheme, lightTheme, setTheme} from '../theme' | ||||
| import {UserContext} from '../user' | ||||
| import {IUser, UserContext} from '../user' | ||||
| import {WorkspaceTree} from '../viewModel/workspaceTree' | ||||
| import Button from '../widgets/buttons/button' | ||||
| import IconButton from '../widgets/buttons/iconButton' | ||||
| @@ -87,35 +87,21 @@ class Sidebar extends React.Component<Props, State> { | ||||
|         return ( | ||||
|             <div className='Sidebar octo-sidebar'> | ||||
|                 <div className='octo-sidebar-header'> | ||||
|                     <div className='heading'> | ||||
|                         <UserContext.Consumer> | ||||
|                         {(user) => ( | ||||
|                             <div className='username'> | ||||
|                                 <MenuWrapper> | ||||
|                                     <Button> | ||||
|                                         {user?.username} | ||||
|                                     </Button> | ||||
|                                     <Menu> | ||||
|                                         <Menu.Text | ||||
|                                             id='logout' | ||||
|                                             name={intl.formatMessage({id: 'Sidebar.logout', defaultMessage: 'Log out'})} | ||||
|                                             onClick={async () => { | ||||
|                                                 octoClient.logout() | ||||
|                                                 window.location.href = '/login' | ||||
|                             {(user) => { | ||||
|                                 if (user) { | ||||
|                                     if (user.id === 'single-user') { | ||||
|                                         return ( | ||||
|                                             <div>{intl.formatMessage({id: 'Sidebar.title', defaultMessage: 'Boards'})}</div> | ||||
|                                         ) | ||||
|                                     } | ||||
|                                     return this.renderUserMenu(user) | ||||
|                                 } | ||||
|                                 return <div/> | ||||
|                             }} | ||||
|                                         /> | ||||
|                                         <Menu.Text | ||||
|                                             id='changePassword' | ||||
|                                             name={intl.formatMessage({id: 'Sidebar.changePassword', defaultMessage: 'Change password'})} | ||||
|                                             onClick={async () => { | ||||
|                                                 window.location.href = '/change_password' | ||||
|                                             }} | ||||
|                                         /> | ||||
|                                     </Menu> | ||||
|                                 </MenuWrapper> | ||||
|  | ||||
|                             </div> | ||||
|                         )} | ||||
|                         </UserContext.Consumer> | ||||
|                     </div> | ||||
|  | ||||
|                     <div className='octo-spacer'/> | ||||
|                     <IconButton | ||||
| @@ -375,6 +361,35 @@ class Sidebar extends React.Component<Props, State> { | ||||
|         ) | ||||
|     } | ||||
|  | ||||
|     private renderUserMenu(user: IUser): JSX.Element { | ||||
|         const {intl} = this.props | ||||
|  | ||||
|         return ( | ||||
|             <MenuWrapper> | ||||
|                 <Button> | ||||
|                     {user.username} | ||||
|                 </Button> | ||||
|                 <Menu> | ||||
|                     <Menu.Text | ||||
|                         id='logout' | ||||
|                         name={intl.formatMessage({id: 'Sidebar.logout', defaultMessage: 'Log out'})} | ||||
|                         onClick={async () => { | ||||
|                             octoClient.logout() | ||||
|                             window.location.href = '/login' | ||||
|                         }} | ||||
|                     /> | ||||
|                     <Menu.Text | ||||
|                         id='changePassword' | ||||
|                         name={intl.formatMessage({id: 'Sidebar.changePassword', defaultMessage: 'Change password'})} | ||||
|                         onClick={async () => { | ||||
|                             window.location.href = '/change_password' | ||||
|                         }} | ||||
|                     /> | ||||
|                 </Menu> | ||||
|             </MenuWrapper> | ||||
|         ) | ||||
|     } | ||||
|  | ||||
|     private boardClicked(board: Board): void { | ||||
|         this.props.showBoard(board.id) | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user