mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-14 15:14:56 -04:00

organized repository Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de> Co-authored-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de> Co-authored-by: Philip Molares <git@molar.es>
47 lines
1.7 KiB
TypeScript
47 lines
1.7 KiB
TypeScript
import React from 'react'
|
|
import { Dropdown } from 'react-bootstrap'
|
|
import { Trans, useTranslation } from 'react-i18next'
|
|
import { useSelector } from 'react-redux'
|
|
import { LinkContainer } from 'react-router-bootstrap'
|
|
import { ApplicationState } from '../../../redux'
|
|
import { clearUser } from '../../../redux/user/methods'
|
|
import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon'
|
|
import { UserAvatar } from '../../common/user-avatar/user-avatar'
|
|
|
|
export const UserDropdown: React.FC = () => {
|
|
useTranslation()
|
|
const user = useSelector((state: ApplicationState) => state.user)
|
|
|
|
if (!user) {
|
|
return null
|
|
}
|
|
|
|
return (
|
|
<Dropdown alignRight>
|
|
<Dropdown.Toggle size="sm" variant="dark" id="dropdown-user" className={'d-flex align-items-center'}>
|
|
<UserAvatar name={user.name} photo={user.photo}/>
|
|
</Dropdown.Toggle>
|
|
|
|
<Dropdown.Menu className='text-start'>
|
|
<LinkContainer to={'/n/features'}>
|
|
<Dropdown.Item dir='auto'>
|
|
<ForkAwesomeIcon icon="bolt" fixedWidth={true} className="mx-2"/>
|
|
<Trans i18nKey="editor.help.documents.features"/>
|
|
</Dropdown.Item>
|
|
</LinkContainer>
|
|
<LinkContainer to={'/profile'}>
|
|
<Dropdown.Item dir='auto'>
|
|
<ForkAwesomeIcon icon="user" fixedWidth={true} className="mx-2"/>
|
|
<Trans i18nKey="profile.userProfile"/>
|
|
</Dropdown.Item>
|
|
</LinkContainer>
|
|
<Dropdown.Item dir='auto'
|
|
onClick={() => {
|
|
clearUser()
|
|
}}>
|
|
<ForkAwesomeIcon icon="sign-out" fixedWidth={true} className="mx-2"/>
|
|
<Trans i18nKey="login.signOut"/>
|
|
</Dropdown.Item>
|
|
</Dropdown.Menu>
|
|
</Dropdown>)
|
|
}
|