|
|
@@ -18,12 +18,17 @@ import ChevronLeftIcon from '@mui/icons-material/ChevronLeft';
|
|
|
import NotificationsIcon from '@mui/icons-material/Notifications';
|
|
|
import { mainListItems, secondaryListItems } from './listItems';
|
|
|
|
|
|
+import Menu from '@mui/material/Menu';
|
|
|
+import MenuItem from '@mui/material/MenuItem';
|
|
|
+
|
|
|
|
|
|
import MailIcon from '@mui/icons-material/Mail';
|
|
|
|
|
|
import Logo from '../Images/logo.png';
|
|
|
import ProfilePicture from '../Images/man.png';
|
|
|
|
|
|
+import useAuth from '../Auth/useAuth';
|
|
|
+
|
|
|
const drawerWidth = 240;
|
|
|
|
|
|
const AppBar = styled(MuiAppBar, {
|
|
|
@@ -78,6 +83,21 @@ function DashboardContent() {
|
|
|
setOpen(!open);
|
|
|
};
|
|
|
|
|
|
+
|
|
|
+ let auth = useAuth();
|
|
|
+
|
|
|
+ const [anchorEl, setAnchorEl] = React.useState(null);
|
|
|
+ const open_profile = Boolean(anchorEl);
|
|
|
+ const handleClick = (event) => {
|
|
|
+ console.log('show? ')
|
|
|
+ setAnchorEl(event.currentTarget);
|
|
|
+ };
|
|
|
+ const handleClose = () => {
|
|
|
+ setAnchorEl(null);
|
|
|
+ };
|
|
|
+
|
|
|
+ const CerrarSession = () => auth.logout();
|
|
|
+
|
|
|
return (
|
|
|
<ThemeProvider theme={mdTheme}>
|
|
|
<Box sx={{ display: 'flex' }}>
|
|
|
@@ -113,17 +133,35 @@ function DashboardContent() {
|
|
|
<NotificationsIcon style={{ color : '#212529' }}/>
|
|
|
</Badge>
|
|
|
</IconButton>
|
|
|
+
|
|
|
+
|
|
|
<IconButton
|
|
|
size="small"
|
|
|
edge="end"
|
|
|
aria-label="account of current user"
|
|
|
aria-haspopup="true"
|
|
|
- onClick={ () => console.log('show menu') }
|
|
|
+ aria-expanded={open_profile ? 'true' : undefined}
|
|
|
+ onClick={handleClick}
|
|
|
color="inherit"
|
|
|
>
|
|
|
<Avatar alt="Cindy Baker" src={ProfilePicture} />
|
|
|
|
|
|
</IconButton>
|
|
|
+ <Menu
|
|
|
+ id="basic-menu"
|
|
|
+ anchorEl={anchorEl}
|
|
|
+ open={open_profile}
|
|
|
+ onClose={handleClose}
|
|
|
+ MenuListProps={{
|
|
|
+ 'aria-labelledby': 'basic-button',
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <MenuItem onClick={ () => console.log('opcion 1') }>Profile</MenuItem>
|
|
|
+ <MenuItem onClick={() => console.log('opcion 2')}>My account</MenuItem>
|
|
|
+ <MenuItem onClick={CerrarSession}>Logout</MenuItem>
|
|
|
+ </Menu>
|
|
|
+
|
|
|
+
|
|
|
</Box>
|
|
|
|
|
|
|