Browse Source

pre is movil validation

amenpunk 2 years ago
parent
commit
164c4a8a0a
2 changed files with 70 additions and 14 deletions
  1. 66 10
      src/Components/Dashboard.js
  2. 4 4
      src/Components/Navigation/UserOptions.jsx

+ 66 - 10
src/Components/Dashboard.js

@@ -3,25 +3,27 @@ import { ThemeProvider, styled, createTheme } from '@mui/material/styles';
3 3
 
4 4
 import {
5 5
     Container, IconButton, Divider,
6
-    Typography, List, Toolbar, Box, CssBaseline, useMediaQuery as Size,
6
+    Typography, List, Toolbar,useMediaQuery as Size,
7
+    Box, Badge, Menu, Avatar, MenuItem
7 8
 } from '@mui/material'
8 9
 
9 10
 import {
10 11
     Fullscreen as FullscreenIcon,
11 12
     Menu as MenuIcon,
13
+    KeyboardDoubleArrowLeft as LeftKey,
14
+    Mail as MailIcon, Notifications as NotificationsIcon,
12 15
 } from '@mui/icons-material'
13 16
 
14
-// import Logo from '../Images/logo.png';
15 17
 import Logo from '../Images/evaluacion.jpeg';
16 18
 
17
-import { Outlet } from "react-router-dom";
19
+import { Outlet, useNavigate } from "react-router-dom";
18 20
 import { MenuMovil } from '../Components/Navigation/MenuMovil';
19 21
 import Footer from "../Components/Footer";
20 22
 
21
-// import { psicotheme } from '../Utils/theme'
22 23
 import { Drawer as MuiDrawer, AppBar as MuiAppBar } from "../Components/Navigation/AppBar"
23 24
 import { MainListItems, SecondaryListItems } from '../Components/Navigation/listItems';
24
-import { UserOptions } from '../Components/Navigation/UserOptions'
25
+import useAuth from '../Auth/useAuth.js'
26
+import ProfilePicture from '../Images/man.png';
25 27
 
26 28
 const drawerWidth = 240;
27 29
 const mdTheme = createTheme();
@@ -78,7 +80,22 @@ function DashboardContent() {
78 80
     const [open, setOpen] = React.useState(false);
79 81
 
80 82
     const isMovil = Size('(min-width:770px)');
81
-    const navbar = React.useRef(null);
83
+    const auth = useAuth();
84
+    const navigate = useNavigate()
85
+
86
+    const CerrarSession = () => {
87
+        auth.logout();
88
+        navigate('/')
89
+    }
90
+
91
+    const [anchorEl, setAnchorEl] = React.useState(null);
92
+    const open_profile = Boolean(anchorEl);
93
+    const handleClick = (event) => {
94
+        console.log('handle click')
95
+        console.log(event)
96
+        setAnchorEl(event.currentTarget);
97
+    }
98
+    const handleClose = () => setAnchorEl(null)
82 99
 
83 100
     const toggleDrawer = () => {
84 101
         setOpen(!open);
@@ -99,7 +116,6 @@ function DashboardContent() {
99 116
             <Box sx={{ display: 'flex' }}>
100 117
                 <AppBar style={{ backgroundColor: '#fff', boxShadow: 'None' }} position="absolute" open={open}>
101 118
                     <Toolbar sx={{ pr: '24px', borderBottom: "1px solid #ec5e69" }} >
102
-
103 119
                         <IconButton
104 120
                             edge="start"
105 121
                             color="inherit"
@@ -112,14 +128,13 @@ function DashboardContent() {
112 128
                                 color: "#fff"
113 129
                             }} />
114 130
                         </IconButton>
115
-
116 131
                         <Typography component="h1" variant="h6" color="inherit" noWrap sx={{ flexGrow: 1 }} >
117 132
                             {
118 133
                                 open ? (
119 134
                                     <React.Fragment>
120 135
 
121 136
                                         <IconButton onClick={toggleDrawer}>
122
-                                            <MenuIcon />
137
+                                            <LeftKey/>
123 138
                                         </IconButton>
124 139
 
125 140
                                         <IconButton onClick={(event) => event.target.requestFullscreen()}>
@@ -129,7 +144,48 @@ function DashboardContent() {
129 144
                                 ) : undefined
130 145
                             }
131 146
                         </Typography>
132
-                        <UserOptions/>
147
+
148
+                        <Box sx={{ display: { xs: 'none', md: 'flex' } }}>
149
+                            <IconButton size="large" aria-label="show 4 new mails" color="inherit">
150
+                                <Badge badgeContent={4} color="error">
151
+                                    <MailIcon style={{ color : '#212529' }} />
152
+                                </Badge>
153
+                            </IconButton>
154
+                            <IconButton
155
+                                size="large"
156
+                                aria-label="show 17 new notifications"
157
+                                color="inherit">
158
+                                <Badge badgeContent={17} color="error">
159
+                                    <NotificationsIcon style={{ color : '#212529' }}/>
160
+                                </Badge>
161
+                            </IconButton>
162
+
163
+
164
+                            <IconButton
165
+                                size="small"
166
+                                edge="end"
167
+                                aria-label="account of current user"
168
+                                aria-haspopup="true"
169
+                                aria-expanded={open_profile ? 'true' : undefined}
170
+                                onClick={handleClick}
171
+                                color="inherit"
172
+                            >
173
+                                <Avatar alt="Cindy Baker" src={ProfilePicture} />
174
+
175
+                            </IconButton>
176
+                            <Menu
177
+                                id="basic-menu"
178
+                                anchorEl={anchorEl}
179
+                                open={open_profile}
180
+                                onClose={handleClose}
181
+                                MenuListProps={{ 'aria-labelledby': 'basic-button', }}>
182
+                                <MenuItem onClick={() => navigate('dashboard/perfil') }>Profile</MenuItem>
183
+                                <MenuItem onClick={() => console.log('opcion 2')}>My account</MenuItem>
184
+                                <MenuItem onClick={CerrarSession}>Logout</MenuItem>
185
+                            </Menu>
186
+                        </Box>
187
+
188
+
133 189
                     </Toolbar>
134 190
                 </AppBar>
135 191
                 <Drawer variant="permanent" open={open} >

+ 4 - 4
src/Components/Navigation/UserOptions.jsx

@@ -21,10 +21,12 @@ export function UserOptions(){
21 21
         navigate('/')
22 22
     }
23 23
 
24
-
25 24
     const [anchorEl, setAnchorEl] = React.useState(null);
26 25
     const open_profile = Boolean(anchorEl);
27
-    const handleClick = (event) => setAnchorEl(event.currentTarget);
26
+    const handleClick = (event) => {
27
+        console.log('handle click')
28
+        setAnchorEl(event.currentTarget);
29
+    }
28 30
     const handleClose = () => setAnchorEl(null)
29 31
 
30 32
     return(
@@ -42,8 +44,6 @@ export function UserOptions(){
42 44
                     <NotificationsIcon style={{ color: '#212529' }} />
43 45
                 </Badge>
44 46
             </IconButton>
45
-
46
-
47 47
             <IconButton
48 48
                 size="small"
49 49
                 edge="end"