import { Menu, Dropdown } from 'antd'; import { DownOutlined } from '@ant-design/icons'; import { useRecoilState } from 'recoil'; import { ChatVisibilityState, ChatState } from '../interfaces/application-state'; import { chatVisibilityAtom as chatVisibilityAtom } from './stores/ClientConfigStore'; interface Props { username: string; chatState: ChatState; } export default function UserDropdown(props: Props) { const { username, chatState } = props; const chatEnabled = chatState !== ChatState.NotAvailable; const [chatVisibility, setChatVisibility] = useRecoilState(chatVisibilityAtom); const toggleChatVisibility = () => { if (chatVisibility === ChatVisibilityState.Hidden) { setChatVisibility(ChatVisibilityState.Visible); } else { setChatVisibility(ChatVisibilityState.Hidden); } }; const menu = ( Change name Authenticate {chatEnabled && ( toggleChatVisibility()}> Toggle chat )} ); return ( ); }