diff --git a/webapp/src/components/sidebar.scss b/webapp/src/components/sidebar/sidebar.scss similarity index 100% rename from webapp/src/components/sidebar.scss rename to webapp/src/components/sidebar/sidebar.scss diff --git a/webapp/src/components/sidebar.tsx b/webapp/src/components/sidebar/sidebar.tsx similarity index 74% rename from webapp/src/components/sidebar.tsx rename to webapp/src/components/sidebar/sidebar.tsx index d404797a3..0fe744dd6 100644 --- a/webapp/src/components/sidebar.tsx +++ b/webapp/src/components/sidebar/sidebar.tsx @@ -3,34 +3,36 @@ import React from 'react' import {FormattedMessage, injectIntl, IntlShape} from 'react-intl' -import {Archiver} from '../archiver' -import {Board, MutableBoard} from '../blocks/board' -import {BoardView, IViewType, MutableBoardView} from '../blocks/boardView' -import {Constants} from '../constants' -import mutator from '../mutator' -import octoClient from '../octoClient' -import {darkTheme, defaultTheme, lightTheme, loadTheme, setTheme, Theme} from '../theme' -import {IUser, UserContext} from '../user' -import {WorkspaceTree} from '../viewModel/workspaceTree' -import Button from '../widgets/buttons/button' -import IconButton from '../widgets/buttons/iconButton' -import BoardIcon from '../widgets/icons/board' -import DeleteIcon from '../widgets/icons/delete' -import EditIcon from '../widgets/icons/edit' -import DisclosureTriangle from '../widgets/icons/disclosureTriangle' -import DuplicateIcon from '../widgets/icons/duplicate' -import HamburgerIcon from '../widgets/icons/hamburger' -import HideSidebarIcon from '../widgets/icons/hideSidebar' -import LogoWithNameIcon from '../widgets/icons/logoWithName' -import LogoWithNameWhiteIcon from '../widgets/icons/logoWithNameWhite' -import OptionsIcon from '../widgets/icons/options' -import ShowSidebarIcon from '../widgets/icons/showSidebar' -import TableIcon from '../widgets/icons/table' -import Menu from '../widgets/menu' -import MenuWrapper from '../widgets/menuWrapper' +import {Archiver} from '../../archiver' +import {Board, MutableBoard} from '../../blocks/board' +import {BoardView, IViewType, MutableBoardView} from '../../blocks/boardView' +import {Constants} from '../../constants' +import mutator from '../../mutator' +import octoClient from '../../octoClient' +import {darkTheme, defaultTheme, lightTheme, loadTheme, setTheme, Theme} from '../../theme' +import {IUser, UserContext} from '../../user' +import {WorkspaceTree} from '../../viewModel/workspaceTree' +import Button from '../../widgets/buttons/button' +import IconButton from '../../widgets/buttons/iconButton' +import BoardIcon from '../../widgets/icons/board' +import DeleteIcon from '../../widgets/icons/delete' +import EditIcon from '../../widgets/icons/edit' +import DisclosureTriangle from '../../widgets/icons/disclosureTriangle' +import DuplicateIcon from '../../widgets/icons/duplicate' +import HamburgerIcon from '../../widgets/icons/hamburger' +import HideSidebarIcon from '../../widgets/icons/hideSidebar' +import LogoWithNameIcon from '../../widgets/icons/logoWithName' +import LogoWithNameWhiteIcon from '../../widgets/icons/logoWithNameWhite' +import OptionsIcon from '../../widgets/icons/options' +import ShowSidebarIcon from '../../widgets/icons/showSidebar' +import TableIcon from '../../widgets/icons/table' +import Menu from '../../widgets/menu' +import MenuWrapper from '../../widgets/menuWrapper' -import ModalWrapper from './modalWrapper' -import RegistrationLink from './registrationLink' +import ModalWrapper from '../modalWrapper' +import RegistrationLink from '../registrationLink' + +import SidebarSettingsMenu from './sidebarSettingsMenu' import './sidebar.scss' type Props = { @@ -294,103 +296,10 @@ class Sidebar extends React.Component { - -
- -
- - Archiver.importFullArchive()} - /> - Archiver.exportFullArchive()} - /> - - this.props.setLanguage('en')} - /> - this.props.setLanguage('es')} - /> - this.props.setLanguage('de')} - /> - this.props.setLanguage('ja')} - /> - this.props.setLanguage('fr')} - /> - this.props.setLanguage('nl')} - /> - this.props.setLanguage('ru')} - /> - this.props.setLanguage('zh')} - /> - this.props.setLanguage('tr')} - /> - this.props.setLanguage('oc')} - /> - - - this.updateTheme(defaultTheme)} - /> - this.updateTheme(darkTheme)} - /> - this.updateTheme(lightTheme)} - /> - - -
+ this.setState({whiteLogo})} + /> ) } diff --git a/webapp/src/components/sidebar/sidebarSettingsMenu.tsx b/webapp/src/components/sidebar/sidebarSettingsMenu.tsx new file mode 100644 index 000000000..6e2999fce --- /dev/null +++ b/webapp/src/components/sidebar/sidebarSettingsMenu.tsx @@ -0,0 +1,128 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. +import React from 'react' +import {FormattedMessage, injectIntl, IntlShape} from 'react-intl' + +import {Archiver} from '../../archiver' +import {darkTheme, defaultTheme, lightTheme, setTheme, Theme} from '../../theme' +import Menu from '../../widgets/menu' +import MenuWrapper from '../../widgets/menuWrapper' + +import './sidebar.scss' + +type Props = { + setLanguage: (lang: string) => void + intl: IntlShape + setWhiteLogo: (whiteLogo: boolean) => void +} + +const SidebarSettingsMenu = React.memo((props: Props) => { + const {intl} = props + + const updateTheme = (theme: Theme) => { + setTheme(theme) + const whiteLogo = (theme.sidebarWhiteLogo === 'true') + props.setWhiteLogo(whiteLogo) + } + return ( + +
+ +
+ + Archiver.importFullArchive()} + /> + Archiver.exportFullArchive()} + /> + + props.setLanguage('en')} + /> + props.setLanguage('es')} + /> + props.setLanguage('de')} + /> + props.setLanguage('ja')} + /> + props.setLanguage('fr')} + /> + props.setLanguage('nl')} + /> + props.setLanguage('ru')} + /> + props.setLanguage('zh')} + /> + props.setLanguage('tr')} + /> + props.setLanguage('oc')} + /> + + + updateTheme(defaultTheme)} + /> + updateTheme(darkTheme)} + /> + updateTheme(lightTheme)} + /> + + +
+ ) +}) + +export default injectIntl(SidebarSettingsMenu) diff --git a/webapp/src/components/workspace.tsx b/webapp/src/components/workspace.tsx index 9cc7f5c47..9cbe782de 100644 --- a/webapp/src/components/workspace.tsx +++ b/webapp/src/components/workspace.tsx @@ -7,7 +7,7 @@ import {Utils} from '../utils' import {BoardTree} from '../viewModel/boardTree' import {WorkspaceTree} from '../viewModel/workspaceTree' -import Sidebar from './sidebar' +import Sidebar from './sidebar/sidebar' import CenterPanel from './centerPanel' import './workspace.scss'