|
@@ -1,180 +1,241 @@
|
1
|
|
-import * as React from 'react';
|
|
1
|
+// import * as React from 'react';
|
|
2
|
+//
|
|
3
|
+// import {
|
|
4
|
+// Outlet,
|
|
5
|
+// } from "react-router-dom";
|
|
6
|
+//
|
|
7
|
+// import {
|
|
8
|
+// AppBar, Box, CssBaseline, Divider, Drawer,
|
|
9
|
+// IconButton, List, ListItem, ListItemButton, ListItemIcon, ListItemText,
|
|
10
|
+// Toolbar, Typography, Container, Badge,
|
|
11
|
+// MenuItem, Avatar,Menu
|
|
12
|
+// } from '@mui/material'
|
|
13
|
+//
|
|
14
|
+// import {
|
|
15
|
+// Mail as MailIcon, Notifications as NotificationsIcon,
|
|
16
|
+// Menu as MenuIcon,
|
|
17
|
+// } from '@mui/icons-material'
|
|
18
|
+//
|
|
19
|
+//
|
|
20
|
+// import Footer from "../Components/Footer.js";
|
|
21
|
+// import ProfilePicture from '../Images/man.png';
|
|
22
|
+// import useAuth from '../Auth/useAuth';
|
2
|
23
|
|
3
|
|
-import {
|
4
|
|
- Outlet,
|
5
|
|
- // useNavigate
|
6
|
|
-} from "react-router-dom";
|
|
24
|
+import React from 'react';
|
|
25
|
+import { ThemeProvider, styled, createTheme } from '@mui/material/styles';
|
|
26
|
+import '../Css/user.css'
|
7
|
27
|
|
8
|
28
|
import {
|
9
|
|
- AppBar, Box, CssBaseline, Divider, Drawer,
|
10
|
|
- IconButton, List, ListItem, ListItemButton, ListItemIcon, ListItemText,
|
11
|
|
- Toolbar, Typography, Container, Badge,
|
12
|
|
- MenuItem, Avatar,Menu
|
|
29
|
+ Container, IconButton, Divider,
|
|
30
|
+ Typography, List, Toolbar,useMediaQuery as Size,
|
|
31
|
+ Box, Badge, Menu, Avatar, MenuItem
|
13
|
32
|
} from '@mui/material'
|
14
|
33
|
|
15
|
34
|
import {
|
16
|
|
- Mail as MailIcon, Notifications as NotificationsIcon,
|
|
35
|
+ Fullscreen as FullscreenIcon,
|
17
|
36
|
Menu as MenuIcon,
|
|
37
|
+ KeyboardDoubleArrowLeft as LeftKey,
|
|
38
|
+ Mail as MailIcon, Notifications as NotificationsIcon,
|
18
|
39
|
} from '@mui/icons-material'
|
19
|
40
|
|
|
41
|
+import Logo from '../Images/evaluacion.jpeg';
|
20
|
42
|
|
21
|
|
-import Footer from "../Components/Footer.js";
|
22
|
|
-import ProfilePicture from '../Images/man.png';
|
23
|
|
-// import useAuth from '../Auth/useAuth';
|
|
43
|
+import { Outlet, useNavigate } from "react-router-dom";
|
|
44
|
+import { MenuMovil } from '../Components/Navigation/MenuMovil';
|
|
45
|
+import Footer from "../Components/Footer";
|
24
|
46
|
|
|
47
|
+import { Drawer as MuiDrawer, AppBar as MuiAppBar } from "../Components/Navigation/AppBar"
|
|
48
|
+import { UserListItems, SecondaryListItems } from '../Components/Navigation/listItems';
|
|
49
|
+import useAuth from '../Auth/useAuth.js'
|
|
50
|
+import ProfilePicture from '../Images/man.png';
|
25
|
51
|
|
26
|
52
|
const drawerWidth = 240;
|
27
|
|
-
|
28
|
|
-export function User(props) {
|
29
|
|
-
|
30
|
|
- const { window } = props;
|
31
|
|
- const [mobileOpen, setMobileOpen] = React.useState(false);
|
32
|
|
-
|
33
|
|
- const handleDrawerToggle = () => {
|
34
|
|
- setMobileOpen(!mobileOpen);
|
35
|
|
- };
|
36
|
|
-
|
37
|
|
- // const auth = useAuth();
|
38
|
|
-
|
39
|
|
- const drawer = (
|
40
|
|
- <div>
|
41
|
|
- <Toolbar />
|
42
|
|
- <Divider />
|
43
|
|
- <List>
|
44
|
|
- {['Mi perfil', 'Pruebas', 'Configuracion', 'Ayuda'].map((text, index) => (
|
45
|
|
- <ListItem key={text} disablePadding>
|
46
|
|
- <ListItemButton>
|
47
|
|
- <ListItemIcon>
|
48
|
|
- {index % 2 === 0 ? <MailIcon /> : <NotificationsIcon />}
|
49
|
|
- </ListItemIcon>
|
50
|
|
- <ListItemText primary={text} />
|
51
|
|
- </ListItemButton>
|
52
|
|
- </ListItem>
|
53
|
|
- ))}
|
54
|
|
- </List>
|
55
|
|
- <Divider />
|
56
|
|
- <List>
|
57
|
|
- {['All mail', 'Trash', 'Spam'].map((text, index) => (
|
58
|
|
- <ListItem key={text} disablePadding>
|
59
|
|
- <ListItemButton>
|
60
|
|
- <ListItemIcon>
|
61
|
|
- {index % 2 === 0 ? <MailIcon /> : <NotificationsIcon />}
|
62
|
|
- </ListItemIcon>
|
63
|
|
- <ListItemText primary={text} />
|
64
|
|
- </ListItemButton>
|
65
|
|
- </ListItem>
|
66
|
|
- ))}
|
67
|
|
- </List>
|
68
|
|
- </div>
|
69
|
|
- );
|
70
|
|
-
|
71
|
|
- const container = window !== undefined ? () => window().document.body : undefined;
|
|
53
|
+const mdTheme = createTheme();
|
|
54
|
+
|
|
55
|
+const AppBar = styled(MuiAppBar, {
|
|
56
|
+ shouldForwardProp: (prop) => prop !== 'open',
|
|
57
|
+})(({ theme, open }) => ({
|
|
58
|
+ zIndex: theme.zIndex.drawer + 1,
|
|
59
|
+ transition: theme.transitions.create(['width', 'margin'], {
|
|
60
|
+ easing: theme.transitions.easing.sharp,
|
|
61
|
+ duration: theme.transitions.duration.leavingScreen,
|
|
62
|
+ }),
|
|
63
|
+ ...(open && {
|
|
64
|
+ marginLeft: drawerWidth,
|
|
65
|
+ width: `calc(100% - ${drawerWidth}px)`,
|
|
66
|
+ transition: theme.transitions.create(['width', 'margin'], {
|
|
67
|
+ easing: theme.transitions.easing.sharp,
|
|
68
|
+ duration: theme.transitions.duration.enteringScreen,
|
|
69
|
+ }),
|
|
70
|
+ }),
|
|
71
|
+}));
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+const Drawer = styled(MuiDrawer,
|
|
75
|
+ { shouldForwardProp: (prop) => prop !== 'open' })(
|
|
76
|
+ ({ theme, open }) => ({
|
|
77
|
+ '& .MuiDrawer-paper': {
|
|
78
|
+ position: 'relative',
|
|
79
|
+ whiteSpace: 'nowrap',
|
|
80
|
+ width: drawerWidth,
|
|
81
|
+ transition: theme.transitions.create('width', {
|
|
82
|
+ easing: theme.transitions.easing.sharp,
|
|
83
|
+ duration: theme.transitions.duration.enteringScreen,
|
|
84
|
+ }),
|
|
85
|
+ boxSizing: 'border-box',
|
|
86
|
+ ...(!open && {
|
|
87
|
+ overflowX: 'hidden',
|
|
88
|
+ transition: theme.transitions.create('width', {
|
|
89
|
+ easing: theme.transitions.easing.sharp,
|
|
90
|
+ duration: theme.transitions.duration.leavingScreen,
|
|
91
|
+ }),
|
|
92
|
+ width: theme.spacing(7),
|
|
93
|
+ [theme.breakpoints.up('sm')]: {
|
|
94
|
+ width: theme.spacing(9),
|
|
95
|
+ },
|
|
96
|
+ }),
|
|
97
|
+ },
|
|
98
|
+ }),
|
|
99
|
+);
|
|
100
|
+
|
|
101
|
+export function User() {
|
|
102
|
+
|
|
103
|
+ const [open, setOpen] = React.useState(false);
|
|
104
|
+
|
|
105
|
+ const isMovil = Size('(max-width:770px)');
|
|
106
|
+ const auth = useAuth();
|
|
107
|
+ const navigate = useNavigate()
|
|
108
|
+
|
|
109
|
+ const CerrarSession = () => {
|
|
110
|
+ auth.logout();
|
|
111
|
+ navigate('/')
|
|
112
|
+ }
|
|
113
|
+
|
|
114
|
+ const [anchorEl, setAnchorEl] = React.useState(null);
|
|
115
|
+ const open_profile = Boolean(anchorEl);
|
|
116
|
+ const handleClick = (event) => setAnchorEl(event.currentTarget);
|
|
117
|
+ const handleClose = () => setAnchorEl(null)
|
|
118
|
+ const toggleDrawer = () => {
|
|
119
|
+ if(isMovil){
|
|
120
|
+ setAnchorElMov(!anchorElMovil)
|
|
121
|
+ }else{
|
|
122
|
+ setOpen(!open);
|
|
123
|
+ }
|
|
124
|
+ }
|
|
125
|
+ const [anchorElMovil, setAnchorElMov] = React.useState(false);
|
72
|
126
|
|
73
|
127
|
return (
|
74
|
|
- <Box sx={{ display: 'flex' }}>
|
75
|
|
- <CssBaseline />
|
76
|
|
- <AppBar
|
77
|
|
- position="fixed"
|
78
|
|
- sx={{
|
79
|
|
- width: { sm: `calc(100% - ${drawerWidth}px)` },
|
80
|
|
- ml: { sm: `${drawerWidth}px` },
|
81
|
|
- }}
|
82
|
|
- >
|
83
|
|
- <Toolbar>
|
84
|
|
- <IconButton
|
85
|
|
- color="inherit"
|
86
|
|
- aria-label="open drawer"
|
87
|
|
- edge="start"
|
88
|
|
- onClick={handleDrawerToggle}
|
89
|
|
- sx={{ mr: 2, display: { sm: 'none' } }}
|
90
|
|
- >
|
91
|
|
- <MenuIcon />
|
92
|
|
- </IconButton>
|
93
|
|
- <Typography variant="h6" noWrap component="div">
|
94
|
|
- Pruebas Asignadas
|
95
|
|
- </Typography>
|
96
|
|
- </Toolbar>
|
97
|
|
-
|
98
|
|
- <Box sx={{ display: { xs: 'none', md: 'flex' } }}>
|
99
|
|
- <IconButton size="large" aria-label="show 4 new mails" color="inherit">
|
100
|
|
- <Badge badgeContent={4} color="error">
|
101
|
|
- <MailIcon style={{ color: '#212529' }} />
|
102
|
|
- </Badge>
|
103
|
|
- </IconButton>
|
104
|
|
- <IconButton
|
105
|
|
- size="large"
|
106
|
|
- aria-label="show 17 new notifications"
|
107
|
|
- color="inherit">
|
108
|
|
- <Badge badgeContent={17} color="error">
|
109
|
|
- <NotificationsIcon style={{ color: '#212529' }} />
|
110
|
|
- </Badge>
|
111
|
|
- </IconButton>
|
112
|
|
-
|
113
|
|
-
|
114
|
|
- <IconButton
|
115
|
|
- size="small"
|
116
|
|
- edge="end"
|
117
|
|
- aria-label="account of current user"
|
118
|
|
- aria-haspopup="true"
|
119
|
|
- aria-expanded={'true'}
|
120
|
|
- color="inherit" >
|
121
|
|
- <Avatar alt="profile picture" src={ProfilePicture} />
|
122
|
|
- </IconButton>
|
123
|
|
- <Menu
|
124
|
|
- id="basic-menu"
|
125
|
|
- MenuListProps={{ 'aria-labelledby': 'basic-button', }}>
|
126
|
|
- <MenuItem >Mi Cuenta</MenuItem>
|
127
|
|
- <MenuItem >Configuraciones</MenuItem>
|
128
|
|
- <MenuItem >Cerrar Sesión</MenuItem>
|
129
|
|
- </Menu>
|
130
|
|
- </Box>
|
131
|
|
-
|
132
|
|
-
|
133
|
|
- </AppBar>
|
134
|
|
- <Box
|
135
|
|
- component="nav"
|
136
|
|
- sx={{ width: { sm: drawerWidth }, flexShrink: { sm: 0 } }}
|
137
|
|
- aria-label="mailbox folders"
|
138
|
|
- >
|
139
|
|
- {/* The implementation can be swapped with js to avoid SEO duplication of links. */}
|
140
|
|
- <Drawer
|
141
|
|
- container={container}
|
142
|
|
- variant="temporary"
|
143
|
|
- open={mobileOpen}
|
144
|
|
- onClose={handleDrawerToggle}
|
145
|
|
- ModalProps={{
|
146
|
|
- keepMounted: true, // Better open performance on mobile.
|
147
|
|
- }}
|
148
|
|
- sx={{
|
149
|
|
- display: { xs: 'block', sm: 'none' },
|
150
|
|
- '& .MuiDrawer-paper': { boxSizing: 'border-box', width: drawerWidth },
|
151
|
|
- }}
|
152
|
|
- >
|
153
|
|
- {drawer}
|
|
128
|
+ <ThemeProvider theme={mdTheme}>
|
|
129
|
+
|
|
130
|
+ <MenuMovil anchor={anchorElMovil} control={setAnchorElMov} />
|
|
131
|
+
|
|
132
|
+ <Box sx={{ display: 'flex' }}>
|
|
133
|
+ <AppBar style={{ backgroundColor: '#fff', boxShadow: 'None' }} position="absolute" open={open}>
|
|
134
|
+ <Toolbar sx={{ pr: '24px', borderBottom: "1px solid var(--second)" }} >
|
|
135
|
+ <IconButton
|
|
136
|
+ name="navigation_icon_button"
|
|
137
|
+ edge="start"
|
|
138
|
+ color="inherit"
|
|
139
|
+ aria-label="open drawer"
|
|
140
|
+ // onClick={isMovil ? MenuResponsive : toggleDrawer}
|
|
141
|
+ onClick={toggleDrawer}
|
|
142
|
+ sx={{ marginRight: '36px', ...( open && { display: 'none' }), }} >
|
|
143
|
+ <MenuIcon style={{
|
|
144
|
+ background: 'var(--second)',
|
|
145
|
+ fontSize: "40",
|
|
146
|
+ color: "#fff"
|
|
147
|
+ }} />
|
|
148
|
+ </IconButton>
|
|
149
|
+ <Typography component="h1" variant="h6" color="inherit" noWrap sx={{ flexGrow: 1 }} >
|
|
150
|
+ {
|
|
151
|
+ open ? (
|
|
152
|
+ <React.Fragment>
|
|
153
|
+
|
|
154
|
+ <IconButton onClick={toggleDrawer}>
|
|
155
|
+ <LeftKey/>
|
|
156
|
+ </IconButton>
|
|
157
|
+
|
|
158
|
+ <IconButton onClick={(event) => event.target.requestFullscreen()}>
|
|
159
|
+ <FullscreenIcon style={{ paddinLeft: 15 }} />
|
|
160
|
+ </IconButton>
|
|
161
|
+ </React.Fragment>
|
|
162
|
+ ) : undefined
|
|
163
|
+ }
|
|
164
|
+ </Typography>
|
|
165
|
+
|
|
166
|
+ <Box sx={{ display: { xs: 'none', md: 'flex' } }}>
|
|
167
|
+ <IconButton size="large" aria-label="show 4 new mails" color="inherit">
|
|
168
|
+ <Badge badgeContent={4} color="error">
|
|
169
|
+ <MailIcon style={{ color : '#212529' }} />
|
|
170
|
+ </Badge>
|
|
171
|
+ </IconButton>
|
|
172
|
+ <IconButton
|
|
173
|
+ size="large"
|
|
174
|
+ aria-label="show 17 new notifications"
|
|
175
|
+ color="inherit">
|
|
176
|
+ <Badge badgeContent={17} color="error">
|
|
177
|
+ <NotificationsIcon style={{ color : '#212529' }}/>
|
|
178
|
+ </Badge>
|
|
179
|
+ </IconButton>
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+ <IconButton
|
|
183
|
+ size="small"
|
|
184
|
+ edge="end"
|
|
185
|
+ aria-label="account of current user"
|
|
186
|
+ aria-haspopup="true"
|
|
187
|
+ aria-expanded={open_profile ? 'true' : undefined}
|
|
188
|
+ onClick={handleClick}
|
|
189
|
+ color="inherit"
|
|
190
|
+ >
|
|
191
|
+ <Avatar alt="Cindy Baker" src={ProfilePicture} />
|
|
192
|
+
|
|
193
|
+ </IconButton>
|
|
194
|
+ <Menu
|
|
195
|
+ id="basic-menu"
|
|
196
|
+ anchorEl={anchorEl}
|
|
197
|
+ open={open_profile}
|
|
198
|
+ onClose={handleClose}
|
|
199
|
+ MenuListProps={{ 'aria-labelledby': 'basic-button', }}>
|
|
200
|
+ <MenuItem onClick={() => navigate('dashboard/perfil') }>Profile</MenuItem>
|
|
201
|
+ <MenuItem onClick={() => console.log('opcion 2')}>My account</MenuItem>
|
|
202
|
+ <MenuItem onClick={CerrarSession}>Logout</MenuItem>
|
|
203
|
+ </Menu>
|
|
204
|
+ </Box>
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+ </Toolbar>
|
|
208
|
+ </AppBar>
|
|
209
|
+ <Drawer variant="permanent" open={open} >
|
|
210
|
+ <Toolbar
|
|
211
|
+ sx={{
|
|
212
|
+ display: 'flex',
|
|
213
|
+ alignItems: 'center',
|
|
214
|
+ justifyContent: 'flex-start',
|
|
215
|
+ px: [1]
|
|
216
|
+ }} >
|
|
217
|
+ <div style={{ flat: 'righ' }} className="sidebar-header">
|
|
218
|
+ <div className="width_img">
|
|
219
|
+ <img src={Logo} alt="pruebas psicometricas" />
|
|
220
|
+ </div>
|
|
221
|
+ </div>
|
|
222
|
+ </Toolbar>
|
|
223
|
+ <Divider />
|
|
224
|
+ <List>
|
|
225
|
+ <UserListItems AppBarVisible={open} setAppBarVisible={setOpen} />
|
|
226
|
+ </List>
|
|
227
|
+ <Divider />
|
|
228
|
+ <List>
|
|
229
|
+ {SecondaryListItems}
|
|
230
|
+ </List>
|
154
|
231
|
</Drawer>
|
155
|
|
- <Drawer
|
156
|
|
- variant="permanent"
|
157
|
|
- sx={{
|
158
|
|
- display: { xs: 'none', sm: 'block' },
|
159
|
|
- '& .MuiDrawer-paper': { boxSizing: 'border-box', width: drawerWidth },
|
160
|
|
- }}
|
161
|
|
- open
|
162
|
|
- >
|
163
|
|
- {drawer}
|
164
|
|
- </Drawer>
|
165
|
|
- </Box>
|
166
|
|
- <Box
|
167
|
|
- component="main"
|
168
|
|
- sx={{ flexGrow: 1, p: 3, width: { sm: `calc(100% - ${drawerWidth}px)` } }} >
|
169
|
|
-
|
170
|
232
|
<Container maxWidth="lg" sx={{ mt: 2, mb: 2 }}>
|
171
|
233
|
<Outlet />
|
172
|
234
|
<Footer />
|
173
|
235
|
</Container>
|
174
|
|
-
|
175
|
|
-
|
176
|
236
|
</Box>
|
177
|
|
- </Box>
|
|
237
|
+ </ThemeProvider>
|
178
|
238
|
);
|
|
239
|
+
|
179
|
240
|
}
|
180
|
241
|
|