import { MouseEventHandler, useState } from 'react' import { Link, useHistory } from 'react-router-dom' import { Button, Dropdown, Menu } from 'antd' import { UserOutlined } from '@ant-design/icons' import { getUserLogin, removeUser } from '../utils/storage' import { PrivateMenuItem } from './Private' import { ChangePassword } from './ChangePassword' type UserMenuProps = { isAdmin?: boolean } export const UserMenu: React.FC = ({ isAdmin }) => { const [isModalVisible, setIsModalVisible] = useState(false) const history = useHistory() const onChangePasswordClick: MouseEventHandler = (e) => { setIsModalVisible(true) e.preventDefault() } const onChangePasswordOk = () => { setIsModalVisible(false) history.push('/login') } return ( <> {isAdmin ? ( Вернуться на сайт ) : ( Панель администратора )} Сменить пароль Выход )} > setIsModalVisible(false)} /> ) }