|
|
@ -1,17 +1,16 @@ |
|
|
|
import { Menu, Dropdown } from 'antd'; |
|
|
|
import { Menu, Dropdown, Button, Space } from 'antd'; |
|
|
|
import { DownOutlined } from '@ant-design/icons'; |
|
|
|
import { DownOutlined } from '@ant-design/icons'; |
|
|
|
import { useRecoilState } from 'recoil'; |
|
|
|
import { useRecoilState } from 'recoil'; |
|
|
|
import { ChatVisibilityState, ChatState } from '../interfaces/application-state'; |
|
|
|
import { chatVisibilityAtom } from '../../stores/ClientConfigStore'; |
|
|
|
import { chatVisibilityAtom } from './stores/ClientConfigStore'; |
|
|
|
import { ChatState, ChatVisibilityState } from '../../../interfaces/application-state'; |
|
|
|
|
|
|
|
import s from './UserDropdown.module.scss'; |
|
|
|
|
|
|
|
|
|
|
|
interface Props { |
|
|
|
interface Props { |
|
|
|
username: string; |
|
|
|
username?: string; |
|
|
|
chatState: ChatState; |
|
|
|
chatState?: ChatState; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export default function UserDropdown(props: Props) { |
|
|
|
export default function UserDropdown({ username = 'test-user', chatState }: Props) { |
|
|
|
const { username, chatState } = props; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const chatEnabled = chatState !== ChatState.NotAvailable; |
|
|
|
const chatEnabled = chatState !== ChatState.NotAvailable; |
|
|
|
const [chatVisibility, setChatVisibility] = |
|
|
|
const [chatVisibility, setChatVisibility] = |
|
|
|
useRecoilState<ChatVisibilityState>(chatVisibilityAtom); |
|
|
|
useRecoilState<ChatVisibilityState>(chatVisibilityAtom); |
|
|
@ -37,10 +36,20 @@ export default function UserDropdown(props: Props) { |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<Dropdown overlay={menu} trigger={['click']}> |
|
|
|
<div className={`${s.root}`}> |
|
|
|
|
|
|
|
<Dropdown overlay={menu} trigger={['click']}> |
|
|
|
|
|
|
|
<Button> |
|
|
|
|
|
|
|
<Space> |
|
|
|
|
|
|
|
{username} |
|
|
|
|
|
|
|
<DownOutlined /> |
|
|
|
|
|
|
|
</Space> |
|
|
|
|
|
|
|
</Button> |
|
|
|
|
|
|
|
{/* |
|
|
|
<button type="button" className="ant-dropdown-link" onClick={e => e.preventDefault()}> |
|
|
|
<button type="button" className="ant-dropdown-link" onClick={e => e.preventDefault()}> |
|
|
|
{username} <DownOutlined /> |
|
|
|
{username} <DownOutlined /> |
|
|
|
</button> |
|
|
|
</button> |
|
|
|
</Dropdown> |
|
|
|
*/} |
|
|
|
|
|
|
|
</Dropdown> |
|
|
|
|
|
|
|
</div> |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |