import LockIcon from '@mui/icons-material/Lock'; import { Button, ClickAwayListener, Grow, Link, MenuItem, MenuList, Paper, Popper, } from '@mui/material'; import Avatar from '@mui/material/Avatar'; import makeStyles from '@mui/styles/makeStyles'; import { useState, useRef } from 'react'; import { Link as RouterLink } from 'react-router-dom'; import { useCurrentIdentityQuery } from './CurrentIdentity.generated'; const useStyles = makeStyles((theme) => ({ displayName: { marginLeft: theme.spacing(2), }, hidden: { display: 'none', }, profileLink: { ...theme.typography.button, }, popupButton: { textTransform: 'none', color: theme.palette.primary.contrastText, }, })); const CurrentIdentity = () => { const classes = useStyles(); const { loading, error, data } = useCurrentIdentityQuery(); const [open, setOpen] = useState(false); const anchorRef = useRef(null); if (error || loading || !data?.repository?.userIdentity) return null; const user = data.repository.userIdentity; const handleToggle = () => { setOpen((prevOpen) => !prevOpen); }; const handleClose = (event: any) => { if (anchorRef.current && anchorRef.current.contains(event.target)) { return; } setOpen(false); }; return ( <> {({ TransitionProps, placement }) => ( Open profile )} ); }; export default CurrentIdentity;