import * as React from 'react' import { Children, cloneElement, isValidElement, useState } from 'react' import PropTypes from 'prop-types' import { useTranslate, useGetIdentity } from 'react-admin' import { Tooltip, IconButton, Popover, MenuList, Button, Avatar, Card, CardContent, Divider, Typography, } from '@material-ui/core' import { makeStyles } from '@material-ui/core/styles' import AccountCircle from '@material-ui/icons/AccountCircle' const useStyles = makeStyles((theme) => ({ user: {}, userButton: { textTransform: 'none', }, avatar: { width: theme.spacing(4), height: theme.spacing(4), }, username: { marginTop: '-0.5em', }, })) const UserMenu = (props) => { const [anchorEl, setAnchorEl] = useState(null) const translate = useTranslate() const { loaded, identity } = useGetIdentity() const classes = useStyles(props) const { children, label, icon, logout } = props if (!logout && !children) return null const open = Boolean(anchorEl) const handleMenu = (event) => setAnchorEl(event.currentTarget) const handleClose = () => setAnchorEl(null) return (