|
@@ -1,41 +1,82 @@
|
1
|
1
|
import React from 'react';
|
2
|
|
-import { ThemeProvider } from '@mui/material/styles';
|
|
2
|
+import { ThemeProvider, styled } from '@mui/material/styles';
|
3
|
3
|
|
4
|
4
|
import {
|
5
|
|
- Menu, MenuItem, Container, Avatar, Badge, IconButton, Divider,
|
|
5
|
+ Container, IconButton, Divider,
|
6
|
6
|
Typography, List, Toolbar, Box, CssBaseline, useMediaQuery as Size,
|
7
|
7
|
} from '@mui/material'
|
8
|
8
|
|
9
|
9
|
import {
|
10
|
|
- Mail as MailIcon, Notifications as NotificationsIcon, Fullscreen as FullscreenIcon,
|
|
10
|
+ Fullscreen as FullscreenIcon,
|
11
|
11
|
Menu as MenuIcon,
|
12
|
12
|
} from '@mui/icons-material'
|
13
|
13
|
|
14
|
|
-import useAuth from '../Auth/useAuth';
|
15
|
14
|
import Logo from '../Images/logo.png';
|
16
|
|
-import ProfilePicture from '../Images/man.png';
|
17
|
15
|
|
18
|
|
-import { Outlet, useNavigate } from "react-router-dom";
|
|
16
|
+import { Outlet } from "react-router-dom";
|
19
|
17
|
import { MenuMovil } from '../Components/Navigation/MenuMovil';
|
20
|
18
|
import Footer from "../Components/Footer";
|
21
|
19
|
|
22
|
|
-import { mdTheme } from '../Utils/theme'
|
23
|
|
-import { Drawer, AppBar } from "../Components/Navigation/AppBar"
|
|
20
|
+import { psicotheme } from '../Utils/theme'
|
|
21
|
+import { Drawer as MuiDrawer, AppBar as MuiAppBar } from "../Components/Navigation/AppBar"
|
24
|
22
|
import { MainListItems, SecondaryListItems } from '../Components/Navigation/listItems';
|
|
23
|
+import { UserOptions } from '../Components/Navigation/UserOptions'
|
|
24
|
+
|
|
25
|
+const drawerWidth = 240;
|
|
26
|
+
|
|
27
|
+const AppBar = styled(MuiAppBar, {
|
|
28
|
+ shouldForwardProp: (prop) => prop !== 'open',
|
|
29
|
+})(({ theme, open }) => ({
|
|
30
|
+ zIndex: theme.zIndex.drawer + 1,
|
|
31
|
+ transition: theme.transitions.create(['width', 'margin'], {
|
|
32
|
+ easing: theme.transitions.easing.sharp,
|
|
33
|
+ duration: theme.transitions.duration.leavingScreen,
|
|
34
|
+ }),
|
|
35
|
+ ...(open && {
|
|
36
|
+ marginLeft: drawerWidth,
|
|
37
|
+ width: `calc(100% - ${drawerWidth}px)`,
|
|
38
|
+ transition: theme.transitions.create(['width', 'margin'], {
|
|
39
|
+ easing: theme.transitions.easing.sharp,
|
|
40
|
+ duration: theme.transitions.duration.enteringScreen,
|
|
41
|
+ }),
|
|
42
|
+ }),
|
|
43
|
+}));
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+const Drawer = styled(MuiDrawer, { shouldForwardProp: (prop) => prop !== 'open' })(
|
|
47
|
+ ({ theme, open }) => ({
|
|
48
|
+ '& .MuiDrawer-paper': {
|
|
49
|
+ position: 'relative',
|
|
50
|
+ whiteSpace: 'nowrap',
|
|
51
|
+ width: drawerWidth,
|
|
52
|
+ transition: theme.transitions.create('width', {
|
|
53
|
+ easing: theme.transitions.easing.sharp,
|
|
54
|
+ duration: theme.transitions.duration.enteringScreen,
|
|
55
|
+ }),
|
|
56
|
+ boxSizing: 'border-box',
|
|
57
|
+ ...(!open && {
|
|
58
|
+ overflowX: 'hidden',
|
|
59
|
+ transition: theme.transitions.create('width', {
|
|
60
|
+ easing: theme.transitions.easing.sharp,
|
|
61
|
+ duration: theme.transitions.duration.leavingScreen,
|
|
62
|
+ }),
|
|
63
|
+ width: theme.spacing(7),
|
|
64
|
+ [theme.breakpoints.up('sm')]: {
|
|
65
|
+ width: theme.spacing(9),
|
|
66
|
+ },
|
|
67
|
+ }),
|
|
68
|
+ },
|
|
69
|
+ }),
|
|
70
|
+);
|
|
71
|
+
|
25
|
72
|
|
26
|
73
|
function DashboardContent() {
|
27
|
74
|
|
28
|
75
|
const [open, setOpen] = React.useState(false);
|
29
|
76
|
|
30
|
77
|
const isMovil = Size('(min-width:770px)');
|
31
|
|
- const auth = useAuth();
|
32
|
|
- const navigate = useNavigate()
|
33
|
78
|
|
34
|
79
|
const toggleDrawer = () => setOpen(!open);
|
35
|
|
- const [anchorEl, setAnchorEl] = React.useState(null);
|
36
|
|
- const open_profile = Boolean(anchorEl);
|
37
|
|
- const handleClick = (event) => setAnchorEl(event.currentTarget);
|
38
|
|
- const handleClose = () => setAnchorEl(null)
|
39
|
80
|
|
40
|
81
|
const [anchorElMovil, setAnchorElMov] = React.useState(false);
|
41
|
82
|
const MenuResponsive = () => {
|
|
@@ -43,14 +84,9 @@ function DashboardContent() {
|
43
|
84
|
setAnchorElMov(!anchorElMovil);
|
44
|
85
|
}
|
45
|
86
|
|
46
|
|
- const CerrarSession = () => {
|
47
|
|
- console.log('cerrando session')
|
48
|
|
- auth.logout();
|
49
|
|
- navigate('/')
|
50
|
|
- }
|
51
|
87
|
|
52
|
88
|
return (
|
53
|
|
- <ThemeProvider theme={mdTheme}>
|
|
89
|
+ <ThemeProvider theme={psicotheme}>
|
54
|
90
|
|
55
|
91
|
<MenuMovil
|
56
|
92
|
anchor={anchorElMovil}
|
|
@@ -91,45 +127,7 @@ function DashboardContent() {
|
91
|
127
|
) : undefined
|
92
|
128
|
}
|
93
|
129
|
</Typography>
|
94
|
|
-
|
95
|
|
-
|
96
|
|
- <Box sx={{ display: { xs: 'none', md: 'flex' } }}>
|
97
|
|
- <IconButton size="large" aria-label="show 4 new mails" color="inherit">
|
98
|
|
- <Badge badgeContent={4} color="error">
|
99
|
|
- <MailIcon style={{ color: '#212529' }} />
|
100
|
|
- </Badge>
|
101
|
|
- </IconButton>
|
102
|
|
- <IconButton
|
103
|
|
- size="large"
|
104
|
|
- aria-label="show 17 new notifications"
|
105
|
|
- color="inherit">
|
106
|
|
- <Badge badgeContent={17} color="error">
|
107
|
|
- <NotificationsIcon style={{ color: '#212529' }} />
|
108
|
|
- </Badge>
|
109
|
|
- </IconButton>
|
110
|
|
-
|
111
|
|
-
|
112
|
|
- <IconButton
|
113
|
|
- size="small"
|
114
|
|
- edge="end"
|
115
|
|
- aria-label="account of current user"
|
116
|
|
- aria-haspopup="true"
|
117
|
|
- aria-expanded={open_profile ? 'true' : undefined}
|
118
|
|
- onClick={handleClick}
|
119
|
|
- color="inherit" >
|
120
|
|
- <Avatar alt="profile picture" src={ProfilePicture} />
|
121
|
|
- </IconButton>
|
122
|
|
- <Menu
|
123
|
|
- id="basic-menu"
|
124
|
|
- anchorEl={anchorEl}
|
125
|
|
- open={open_profile}
|
126
|
|
- onClose={handleClose}
|
127
|
|
- MenuListProps={{ 'aria-labelledby': 'basic-button', }}>
|
128
|
|
- <MenuItem onClick={() => navigate('dashboard/perfil')}>Mi Cuenta</MenuItem>
|
129
|
|
- <MenuItem onClick={() => console.log('dashboard/perfil')}>Configuraciones</MenuItem>
|
130
|
|
- <MenuItem onClick={CerrarSession}>Cerrar Sesión</MenuItem>
|
131
|
|
- </Menu>
|
132
|
|
- </Box>
|
|
130
|
+ <UserOptions/>
|
133
|
131
|
</Toolbar>
|
134
|
132
|
</AppBar>
|
135
|
133
|
<Drawer variant="permanent" open={open}>
|