1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-12-24 13:43:12 +02:00

Improving sidebar menu

This commit is contained in:
Jesús Espino 2020-10-27 22:18:06 +01:00
parent c333c25bd5
commit 598625b313
4 changed files with 80 additions and 121 deletions

View File

@ -28,15 +28,17 @@
"FilterComponent.add-filter": "+ Add Filter",
"FilterComponent.delete": "Delete",
"Sidebar.add-board": "+ Add Board",
"Sidebar.dark-theme": "Dark Theme",
"Sidebar.delete-board": "Delete Board",
"Sidebar.english": "English",
"Sidebar.export-archive": "Export Archive",
"Sidebar.import-archive": "Import Archive",
"Sidebar.set-dark-theme": "Set Dark Theme",
"Sidebar.set-english-language": "Set English Language",
"Sidebar.set-light-theme": "Set Light Theme",
"Sidebar.set-mattermost-theme": "Set Mattermost Theme",
"Sidebar.set-spanish-language": "Set Spanish Language",
"Sidebar.light-theme": "Light Theme",
"Sidebar.mattermost-theme": "Mattermost Theme",
"Sidebar.set-language": "Set Language",
"Sidebar.set-theme": "Set Theme",
"Sidebar.settings": "Settings",
"Sidebar.spanish": "Spanish",
"Sidebar.untitled-board": "(Untitled Board)",
"Sidebar.untitled-view": "(Untitled View)",
"TableComponent.add-icon": "Add Icon",
@ -66,4 +68,4 @@
"ViewTitle.random-icon": "Random",
"ViewTitle.remove-icon": "Remove Icon",
"ViewTitle.untitled-board": "Untitled Board"
}
}

View File

@ -28,15 +28,17 @@
"FilterComponent.add-filter": "+ Añadir filtro",
"FilterComponent.delete": "Borrar",
"Sidebar.add-board": "+ Añadir Panel",
"Sidebar.dark-theme": "Apariencia Oscura",
"Sidebar.delete-board": "Borrar Panel",
"Sidebar.english": "Inglés",
"Sidebar.export-archive": "Exportar Archivo",
"Sidebar.import-archive": "Importar Archivo",
"Sidebar.set-dark-theme": "Usar Apariencia Oscura",
"Sidebar.set-english-language": "Usar idioma Inglés",
"Sidebar.set-light-theme": "Usar Apariencia Clara",
"Sidebar.set-mattermost-theme": "Usar Aparencia Mattermost",
"Sidebar.set-spanish-language": "Usar idioma Español",
"Sidebar.light-theme": "Apariencia Clara",
"Sidebar.mattermost-theme": "Aparencia Mattermost",
"Sidebar.set-language": "Establecer idioma",
"Sidebar.set-theme": "Establecer apariencia",
"Sidebar.settings": "Configuración",
"Sidebar.spanish": "Español",
"Sidebar.untitled-board": "(Panel sin titulo)",
"Sidebar.untitled-view": "(Vista sin titulo)",
"TableComponent.add-icon": "Añadir Icono",

View File

@ -1,7 +1,7 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react'
import {FormattedMessage} from 'react-intl'
import {injectIntl, IntlShape, FormattedMessage} from 'react-intl'
import {Archiver} from '../archiver'
import {mattermostTheme, darkTheme, lightTheme, setTheme} from '../theme'
@ -25,6 +25,7 @@ type Props = {
workspaceTree: WorkspaceTree,
boardTree?: BoardTree,
setLanguage: (lang: string) => void,
intl: IntlShape
}
type State = {
@ -42,7 +43,7 @@ class Sidebar extends React.Component<Props, State> {
}
render(): JSX.Element {
const {workspaceTree} = this.props
const {workspaceTree, intl} = this.props
if (!workspaceTree) {
return <div/>
}
@ -98,30 +99,23 @@ class Sidebar extends React.Component<Props, State> {
<MenuWrapper>
<div className='octo-button square octo-hover-item'><OptionsIcon/></div>
<Menu>
<FormattedMessage
id='Sidebar.delete-board'
defaultMessage='Delete Board'
>
{(text: string) => (
<Menu.Text
id='delete'
name={text}
onClick={async () => {
const nextBoardId = boards.length > 1 ? boards.find((o) => o.id !== board.id).id : undefined
mutator.deleteBlock(
board,
'delete block',
async () => {
nextBoardId && this.props.showBoard(nextBoardId!)
},
async () => {
this.props.showBoard(board.id)
},
)
}}
/>
)}
</FormattedMessage>
<Menu.Text
id='delete'
name={intl.formatMessage({id: 'Sidebar.delete-board', defaultMessage: 'Delete Board'})}
onClick={async () => {
const nextBoardId = boards.length > 1 ? boards.find((o) => o.id !== board.id).id : undefined
mutator.deleteBlock(
board,
'delete block',
async () => {
nextBoardId && this.props.showBoard(nextBoardId!)
},
async () => {
this.props.showBoard(board.id)
},
)
}}
/>
</Menu>
</MenuWrapper>
</div>
@ -174,90 +168,51 @@ class Sidebar extends React.Component<Props, State> {
/>
</div>
<Menu position='top'>
<FormattedMessage
id='Sidebar.import-archive'
defaultMessage='Import Archive'
<Menu.Text
id='import'
name={intl.formatMessage({id: 'Sidebar.import-archive', defaultMessage: 'Import Archive'})}
onClick={async () => Archiver.importFullArchive()}
/>
<Menu.Text
id='export'
name={intl.formatMessage({id: 'Sidebar.export-archive', defaultMessage: 'Export Archive'})}
onClick={async () => Archiver.exportFullArchive()}
/>
<Menu.SubMenu
id='lang'
name={intl.formatMessage({id: 'Sidebar.set-language', defaultMessage: 'Set Language'})}
>
{(text: string) => (
<Menu.Text
id='import'
name={text}
onClick={async () => Archiver.importFullArchive()}
/>
)}
</FormattedMessage>
<FormattedMessage
id='Sidebar.export-archive'
defaultMessage='Export Archive'
<Menu.Text
id='english-lang'
name={intl.formatMessage({id: 'Sidebar.english', defaultMessage: 'English'})}
onClick={async () => this.props.setLanguage('en')}
/>
<Menu.Text
id='spanish-lang'
name={intl.formatMessage({id: 'Sidebar.spanish', defaultMessage: 'Spanish'})}
onClick={async () => this.props.setLanguage('es')}
/>
</Menu.SubMenu>
<Menu.SubMenu
id='theme'
name={intl.formatMessage({id: 'Sidebar.set-theme', defaultMessage: 'Set Theme'})}
>
{(text: string) => (
<Menu.Text
id='export'
name={text}
onClick={async () => Archiver.exportFullArchive()}
/>
)}
</FormattedMessage>
<FormattedMessage
id='Sidebar.set-english-language'
defaultMessage='Set English Language'
>
{(text: string) => (
<Menu.Text
id='english-lang'
name={text}
onClick={async () => this.props.setLanguage('en')}
/>
)}
</FormattedMessage>
<FormattedMessage
id='Sidebar.set-spanish-language'
defaultMessage='Set Spanish Language'
>
{(text: string) => (
<Menu.Text
id='spanish-lang'
name={text}
onClick={async () => this.props.setLanguage('es')}
/>
)}
</FormattedMessage>
<FormattedMessage
id='Sidebar.set-dark-theme'
defaultMessage='Set Dark Theme'
>
{(text: string) => (
<Menu.Text
id='dark-theme'
name={text}
onClick={async () => setTheme(darkTheme)}
/>
)}
</FormattedMessage>
<FormattedMessage
id='Sidebar.set-light-theme'
defaultMessage='Set Light Theme'
>
{(text: string) => (
<Menu.Text
id='light-theme'
name={text}
onClick={async () => setTheme(lightTheme)}
/>
)}
</FormattedMessage>
<FormattedMessage
id='Sidebar.set-mattermost-theme'
defaultMessage='Set Mattermost Theme'
>
{(text: string) => (
<Menu.Text
id='mattermost-theme'
name={text}
onClick={async () => setTheme(mattermostTheme)}
/>
)}
</FormattedMessage>
<Menu.Text
id='dark-theme'
name={intl.formatMessage({id: 'Sidebar.dark-theme', defaultMessage: 'Dark Theme'})}
onClick={async () => setTheme(darkTheme)}
/>
<Menu.Text
id='light-theme'
name={intl.formatMessage({id: 'Sidebar.light-theme', defaultMessage: 'Light Theme'})}
onClick={async () => setTheme(lightTheme)}
/>
<Menu.Text
id='mattermost-theme'
name={intl.formatMessage({id: 'Sidebar.mattermost-theme', defaultMessage: 'Mattermost Theme'})}
onClick={async () => setTheme(mattermostTheme)}
/>
</Menu.SubMenu>
</Menu>
</MenuWrapper>
</div>
@ -301,4 +256,4 @@ class Sidebar extends React.Component<Props, State> {
}
}
export {Sidebar}
export default injectIntl(Sidebar)

View File

@ -7,7 +7,7 @@ import {Utils} from '../utils'
import {WorkspaceTree} from '../viewModel/workspaceTree'
import BoardComponent from './boardComponent'
import {Sidebar} from './sidebar'
import Sidebar from './sidebar'
import {TableComponent} from './tableComponent'
import './workspaceComponent.scss'