// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React, {useState} from 'react' import {useIntl} from 'react-intl' import {useHistory} from 'react-router-dom' import {Constants} from '../../constants' import octoClient from '../../octoClient' import {IUser} from '../../user' import FocalboardLogoIcon from '../../widgets/icons/focalboard_logo' import Menu from '../../widgets/menu' import MenuWrapper from '../../widgets/menuWrapper' import {getMe, setMe} from '../../store/users' import {useAppSelector, useAppDispatch} from '../../store/hooks' import ModalWrapper from '../modalWrapper' import {IAppWindow} from '../../types' import RegistrationLink from './registrationLink' import './sidebarUserMenu.scss' declare let window: IAppWindow const SidebarUserMenu = () => { const dispatch = useAppDispatch() const history = useHistory() const [showRegistrationLinkDialog, setShowRegistrationLinkDialog] = useState(false) const user = useAppSelector(getMe) const intl = useIntl() return (
{'Focalboard'}
{`v${Constants.versionString}`}
{user && user.username !== 'single-user' && <> {user.username} { await octoClient.logout() dispatch(setMe(null)) history.push('/login') }} /> { history.push('/change_password') }} /> { setShowRegistrationLinkDialog(true) }} /> } { window.open('https://www.focalboard.com?utm_source=webapp', '_blank') // TODO: Review if this is needed in the future, this is to fix the problem with linux webview links if (window.openInNewBrowser) { window.openInNewBrowser('https://www.focalboard.com?utm_source=webapp') } }} />
{showRegistrationLinkDialog && { setShowRegistrationLinkDialog(false) }} /> }
) } export default React.memo(SidebarUserMenu)