// @ts-nocheck import React from 'react'; import { useHistory } from 'react-router-dom'; import { Menu, MenuItem, MenuDivider, Button, Popover, Position, } from '@blueprintjs/core'; import { FormattedMessage as T } from '@/components'; import { useAuthActions } from '@/hooks/state'; import withDialogActions from '@/containers/Dialog/withDialogActions'; import { useAuthenticatedAccount } from '@/hooks/query'; import { firstLettersArgs, compose } from '@/utils'; /** * Dashboard topbar user. */ function DashboardTopbarUser({ // #withDialogActions openDialog, }) { const history = useHistory(); const { setLogout } = useAuthActions(); // Retrieve authenticated user information. const { data: user } = useAuthenticatedAccount(); const onClickLogout = () => { setLogout(); }; const onKeyboardShortcut = () => { openDialog('keyboard-shortcuts'); }; return (
{user.first_name} {user.last_name}
: {user.tenant_id}
} /> } onClick={onKeyboardShortcut} /> } onClick={() => history.push('/preferences')} /> } onClick={onClickLogout} /> } position={Position.BOTTOM} >
); } export default compose( withDialogActions, )(DashboardTopbarUser);