|
|
@@ -1,41 +1,82 @@
|
|
|
import React from 'react';
|
|
|
-import { ThemeProvider } from '@mui/material/styles';
|
|
|
+import { ThemeProvider, styled } from '@mui/material/styles';
|
|
|
|
|
|
import {
|
|
|
- Menu, MenuItem, Container, Avatar, Badge, IconButton, Divider,
|
|
|
+ Container, IconButton, Divider,
|
|
|
Typography, List, Toolbar, Box, CssBaseline, useMediaQuery as Size,
|
|
|
} from '@mui/material'
|
|
|
|
|
|
import {
|
|
|
- Mail as MailIcon, Notifications as NotificationsIcon, Fullscreen as FullscreenIcon,
|
|
|
+ Fullscreen as FullscreenIcon,
|
|
|
Menu as MenuIcon,
|
|
|
} from '@mui/icons-material'
|
|
|
|
|
|
-import useAuth from '../Auth/useAuth';
|
|
|
import Logo from '../Images/logo.png';
|
|
|
-import ProfilePicture from '../Images/man.png';
|
|
|
|
|
|
-import { Outlet, useNavigate } from "react-router-dom";
|
|
|
+import { Outlet } from "react-router-dom";
|
|
|
import { MenuMovil } from '../Components/Navigation/MenuMovil';
|
|
|
import Footer from "../Components/Footer";
|
|
|
|
|
|
-import { mdTheme } from '../Utils/theme'
|
|
|
-import { Drawer, AppBar } from "../Components/Navigation/AppBar"
|
|
|
+import { psicotheme } from '../Utils/theme'
|
|
|
+import { Drawer as MuiDrawer, AppBar as MuiAppBar } from "../Components/Navigation/AppBar"
|
|
|
import { MainListItems, SecondaryListItems } from '../Components/Navigation/listItems';
|
|
|
+import { UserOptions } from '../Components/Navigation/UserOptions'
|
|
|
+
|
|
|
+const drawerWidth = 240;
|
|
|
+
|
|
|
+const AppBar = styled(MuiAppBar, {
|
|
|
+ shouldForwardProp: (prop) => prop !== 'open',
|
|
|
+})(({ theme, open }) => ({
|
|
|
+ zIndex: theme.zIndex.drawer + 1,
|
|
|
+ transition: theme.transitions.create(['width', 'margin'], {
|
|
|
+ easing: theme.transitions.easing.sharp,
|
|
|
+ duration: theme.transitions.duration.leavingScreen,
|
|
|
+ }),
|
|
|
+ ...(open && {
|
|
|
+ marginLeft: drawerWidth,
|
|
|
+ width: `calc(100% - ${drawerWidth}px)`,
|
|
|
+ transition: theme.transitions.create(['width', 'margin'], {
|
|
|
+ easing: theme.transitions.easing.sharp,
|
|
|
+ duration: theme.transitions.duration.enteringScreen,
|
|
|
+ }),
|
|
|
+ }),
|
|
|
+}));
|
|
|
+
|
|
|
+
|
|
|
+const Drawer = styled(MuiDrawer, { shouldForwardProp: (prop) => prop !== 'open' })(
|
|
|
+ ({ theme, open }) => ({
|
|
|
+ '& .MuiDrawer-paper': {
|
|
|
+ position: 'relative',
|
|
|
+ whiteSpace: 'nowrap',
|
|
|
+ width: drawerWidth,
|
|
|
+ transition: theme.transitions.create('width', {
|
|
|
+ easing: theme.transitions.easing.sharp,
|
|
|
+ duration: theme.transitions.duration.enteringScreen,
|
|
|
+ }),
|
|
|
+ boxSizing: 'border-box',
|
|
|
+ ...(!open && {
|
|
|
+ overflowX: 'hidden',
|
|
|
+ transition: theme.transitions.create('width', {
|
|
|
+ easing: theme.transitions.easing.sharp,
|
|
|
+ duration: theme.transitions.duration.leavingScreen,
|
|
|
+ }),
|
|
|
+ width: theme.spacing(7),
|
|
|
+ [theme.breakpoints.up('sm')]: {
|
|
|
+ width: theme.spacing(9),
|
|
|
+ },
|
|
|
+ }),
|
|
|
+ },
|
|
|
+ }),
|
|
|
+);
|
|
|
+
|
|
|
|
|
|
function DashboardContent() {
|
|
|
|
|
|
const [open, setOpen] = React.useState(false);
|
|
|
|
|
|
const isMovil = Size('(min-width:770px)');
|
|
|
- const auth = useAuth();
|
|
|
- const navigate = useNavigate()
|
|
|
|
|
|
const toggleDrawer = () => setOpen(!open);
|
|
|
- const [anchorEl, setAnchorEl] = React.useState(null);
|
|
|
- const open_profile = Boolean(anchorEl);
|
|
|
- const handleClick = (event) => setAnchorEl(event.currentTarget);
|
|
|
- const handleClose = () => setAnchorEl(null)
|
|
|
|
|
|
const [anchorElMovil, setAnchorElMov] = React.useState(false);
|
|
|
const MenuResponsive = () => {
|
|
|
@@ -43,14 +84,9 @@ function DashboardContent() {
|
|
|
setAnchorElMov(!anchorElMovil);
|
|
|
}
|
|
|
|
|
|
- const CerrarSession = () => {
|
|
|
- console.log('cerrando session')
|
|
|
- auth.logout();
|
|
|
- navigate('/')
|
|
|
- }
|
|
|
|
|
|
return (
|
|
|
- <ThemeProvider theme={mdTheme}>
|
|
|
+ <ThemeProvider theme={psicotheme}>
|
|
|
|
|
|
<MenuMovil
|
|
|
anchor={anchorElMovil}
|
|
|
@@ -91,45 +127,7 @@ function DashboardContent() {
|
|
|
) : undefined
|
|
|
}
|
|
|
</Typography>
|
|
|
-
|
|
|
-
|
|
|
- <Box sx={{ display: { xs: 'none', md: 'flex' } }}>
|
|
|
- <IconButton size="large" aria-label="show 4 new mails" color="inherit">
|
|
|
- <Badge badgeContent={4} color="error">
|
|
|
- <MailIcon style={{ color: '#212529' }} />
|
|
|
- </Badge>
|
|
|
- </IconButton>
|
|
|
- <IconButton
|
|
|
- size="large"
|
|
|
- aria-label="show 17 new notifications"
|
|
|
- color="inherit">
|
|
|
- <Badge badgeContent={17} color="error">
|
|
|
- <NotificationsIcon style={{ color: '#212529' }} />
|
|
|
- </Badge>
|
|
|
- </IconButton>
|
|
|
-
|
|
|
-
|
|
|
- <IconButton
|
|
|
- size="small"
|
|
|
- edge="end"
|
|
|
- aria-label="account of current user"
|
|
|
- aria-haspopup="true"
|
|
|
- aria-expanded={open_profile ? 'true' : undefined}
|
|
|
- onClick={handleClick}
|
|
|
- color="inherit" >
|
|
|
- <Avatar alt="profile picture" src={ProfilePicture} />
|
|
|
- </IconButton>
|
|
|
- <Menu
|
|
|
- id="basic-menu"
|
|
|
- anchorEl={anchorEl}
|
|
|
- open={open_profile}
|
|
|
- onClose={handleClose}
|
|
|
- MenuListProps={{ 'aria-labelledby': 'basic-button', }}>
|
|
|
- <MenuItem onClick={() => navigate('dashboard/perfil')}>Mi Cuenta</MenuItem>
|
|
|
- <MenuItem onClick={() => console.log('dashboard/perfil')}>Configuraciones</MenuItem>
|
|
|
- <MenuItem onClick={CerrarSession}>Cerrar Sesión</MenuItem>
|
|
|
- </Menu>
|
|
|
- </Box>
|
|
|
+ <UserOptions/>
|
|
|
</Toolbar>
|
|
|
</AppBar>
|
|
|
<Drawer variant="permanent" open={open}>
|