Browse Source

dashboard page for user start config

amenpunk 2 years ago
parent
commit
272f8d8c9b
4 changed files with 48 additions and 27 deletions
  1. 3 0
      src/Components/Routes.js
  2. 25 26
      src/Components/User.jsx
  3. 19 0
      src/Pages/HomeUser.jsx
  4. 1 1
      src/Pages/Logincs.jsx

+ 3 - 0
src/Components/Routes.js

21
 import { Profile } from '../Pages/Profile'
21
 import { Profile } from '../Pages/Profile'
22
 import { RestorePassword } from '../Pages/RestorePassword'
22
 import { RestorePassword } from '../Pages/RestorePassword'
23
 
23
 
24
+import { HomeUser } from '../Pages/HomeUser'
25
+
24
 import RequireAuth from '../Components/PrivateRoute'
26
 import RequireAuth from '../Components/PrivateRoute'
25
 
27
 
26
 export default function MyRoutes () {
28
 export default function MyRoutes () {
44
                     </RequireAuth>
46
                     </RequireAuth>
45
                 }
47
                 }
46
             >
48
             >
49
+                <Route path="home" element={<HomeUser/>} />
47
             </Route>
50
             </Route>
48
 
51
 
49
 
52
 

+ 25 - 26
src/Components/User.jsx

1
 import * as React from 'react';
1
 import * as React from 'react';
2
 
2
 
3
-import AppBar from '@mui/material/AppBar';
4
-import Box from '@mui/material/Box';
5
-import CssBaseline from '@mui/material/CssBaseline';
6
-import Divider from '@mui/material/Divider';
7
-import Drawer from '@mui/material/Drawer';
8
-import IconButton from '@mui/material/IconButton';
9
-import InboxIcon from '@mui/icons-material/MoveToInbox';
10
-import List from '@mui/material/List';
11
-import ListItem from '@mui/material/ListItem';
12
-import ListItemButton from '@mui/material/ListItemButton';
13
-import ListItemIcon from '@mui/material/ListItemIcon';
14
-import ListItemText from '@mui/material/ListItemText';
15
-import MailIcon from '@mui/icons-material/Mail';
16
-import MenuIcon from '@mui/icons-material/Menu';
17
-import Button from '@mui/material/Button';
18
-import Toolbar from '@mui/material/Toolbar';
19
-import Typography from '@mui/material/Typography';
3
+import { 
4
+    Mail as MailIcon, Menu as MenuIcon,
5
+    MoveToInbox as InboxIcon
6
+} from '@mui/icons-material'
7
+
8
+import { Outlet, useNavigate } from "react-router-dom";
9
+
10
+import { 
11
+    AppBar, Box, CssBaseline, Divider, Drawer,
12
+    IconButton,List, ListItem, ListItemButton, ListItemIcon, ListItemText,
13
+    Button,Toolbar, Typography, Container
14
+} from '@mui/material'
15
+
16
+import Footer from "../Components/Footer.js";
17
+
20
 import useAuth from '../Auth/useAuth';
18
 import useAuth from '../Auth/useAuth';
21
 
19
 
20
+
22
 const drawerWidth = 240;
21
 const drawerWidth = 240;
23
 
22
 
24
 export function User(props) {
23
 export function User(props) {
125
             </Box>
124
             </Box>
126
             <Box
125
             <Box
127
                 component="main"
126
                 component="main"
128
-                sx={{ flexGrow: 1, p: 3, width: { sm: `calc(100% - ${drawerWidth}px)` } }}
129
-            >
130
-                <Toolbar />
131
-                <Typography paragraph>
132
-                    Bienvenido User
133
-                </Typography>
134
-                <div>
135
-                    <Button onClick={auth.logout} variant="contained">Cerrar Session</Button>
136
-                </div>
127
+                sx={{ flexGrow: 1, p: 3, width: { sm: `calc(100% - ${drawerWidth}px)` } }} >
128
+
129
+                <Container maxWidth="lg" sx={{ mt: 2, mb: 2 }}>
130
+                    <Outlet />
131
+                    <Footer />
132
+                </Container>
133
+
134
+
135
+
137
             </Box>
136
             </Box>
138
         </Box>
137
         </Box>
139
     );
138
     );

+ 19 - 0
src/Pages/HomeUser.jsx

1
+import { 
2
+    Typography, Button
3
+} from '@mui/material';
4
+
5
+export function HomeUser(){
6
+    return (
7
+        <div>
8
+            <Typography paragraph>
9
+                Bienvenido User
10
+            </Typography>
11
+            <div>
12
+                <Button onClick={() => console.log("close")} 
13
+                    variant="contained">
14
+                    Cerrar Session
15
+                </Button>
16
+            </div>
17
+        </div>
18
+    )
19
+}

+ 1 - 1
src/Pages/Logincs.jsx

93
     
93
     
94
     React.useEffect(() => {
94
     React.useEffect(() => {
95
         if(auth.isLogged()){
95
         if(auth.isLogged()){
96
-            return navigate('/user')
96
+            return navigate('/user/home')
97
         }
97
         }
98
     }, [auth,navigate])
98
     }, [auth,navigate])
99
 
99