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.settings": "Settings", | ||||||
|   "Sidebar.spanish": "Spanish", |   "Sidebar.spanish": "Spanish", | ||||||
|   "Sidebar.template-from-board": "New template from board", |   "Sidebar.template-from-board": "New template from board", | ||||||
|  |   "Sidebar.title": "Boards", | ||||||
|   "Sidebar.untitled": "Untitled", |   "Sidebar.untitled": "Untitled", | ||||||
|   "Sidebar.untitled-board": "(Untitled Board)", |   "Sidebar.untitled-board": "(Untitled Board)", | ||||||
|   "Sidebar.untitled-view": "(Untitled View)", |   "Sidebar.untitled-view": "(Untitled View)", | ||||||
|   | |||||||
| @@ -44,8 +44,9 @@ | |||||||
|         padding: 3px 20px; |         padding: 3px 20px; | ||||||
|         margin-bottom: 5px; |         margin-bottom: 5px; | ||||||
|  |  | ||||||
|         >.username { |         >.heading { | ||||||
|             line-height: 30px; |             line-height: 30px; | ||||||
|  |             cursor: default; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         >.IconButton { |         >.IconButton { | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ import {BoardView, MutableBoardView} from '../blocks/boardView' | |||||||
| import mutator from '../mutator' | import mutator from '../mutator' | ||||||
| import octoClient from '../octoClient' | import octoClient from '../octoClient' | ||||||
| import {darkTheme, defaultTheme, lightTheme, setTheme} from '../theme' | import {darkTheme, defaultTheme, lightTheme, setTheme} from '../theme' | ||||||
| import {UserContext} from '../user' | import {IUser, UserContext} from '../user' | ||||||
| import {WorkspaceTree} from '../viewModel/workspaceTree' | import {WorkspaceTree} from '../viewModel/workspaceTree' | ||||||
| import Button from '../widgets/buttons/button' | import Button from '../widgets/buttons/button' | ||||||
| import IconButton from '../widgets/buttons/iconButton' | import IconButton from '../widgets/buttons/iconButton' | ||||||
| @@ -87,35 +87,21 @@ class Sidebar extends React.Component<Props, State> { | |||||||
|         return ( |         return ( | ||||||
|             <div className='Sidebar octo-sidebar'> |             <div className='Sidebar octo-sidebar'> | ||||||
|                 <div className='octo-sidebar-header'> |                 <div className='octo-sidebar-header'> | ||||||
|                     <UserContext.Consumer> |                     <div className='heading'> | ||||||
|                         {(user) => ( |                         <UserContext.Consumer> | ||||||
|                             <div className='username'> |                             {(user) => { | ||||||
|                                 <MenuWrapper> |                                 if (user) { | ||||||
|                                     <Button> |                                     if (user.id === 'single-user') { | ||||||
|                                         {user?.username} |                                         return ( | ||||||
|                                     </Button> |                                             <div>{intl.formatMessage({id: 'Sidebar.title', defaultMessage: 'Boards'})}</div> | ||||||
|                                     <Menu> |                                         ) | ||||||
|                                         <Menu.Text |                                     } | ||||||
|                                             id='logout' |                                     return this.renderUserMenu(user) | ||||||
|                                             name={intl.formatMessage({id: 'Sidebar.logout', defaultMessage: 'Log out'})} |                                 } | ||||||
|                                             onClick={async () => { |                                 return <div/> | ||||||
|                                                 octoClient.logout() |                             }} | ||||||
|                                                 window.location.href = '/login' |                         </UserContext.Consumer> | ||||||
|                                             }} |                     </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 className='octo-spacer'/> |                     <div className='octo-spacer'/> | ||||||
|                     <IconButton |                     <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 { |     private boardClicked(board: Board): void { | ||||||
|         this.props.showBoard(board.id) |         this.props.showBoard(board.id) | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user