amenpunk 3 anni fa
parent
commit
a0a9ee5f93

+ 3 - 2
psicoadmin/src/App.css

@@ -70,10 +70,11 @@
70 70
 
71 71
 .panel_card{
72 72
     display: flex;
73
-    flex-wrap: nowrap;
73
+    flex-wrap: wrap;
74 74
     align-content: center;
75 75
     justify-content: space-around;
76 76
     align-items: center;
77 77
     flex-direction: row;
78
-    padding : 70px;
78
+    padding : 90px;
79
+    max-height : 175px;
79 80
 }

+ 2 - 2
psicoadmin/src/Components/Card.js

@@ -1,13 +1,13 @@
1 1
 export function Card( props ){
2 2
     return(
3 3
         <div className="panel" >
4
-            <a href="#">
4
+            <a href="/">
5 5
                 <div className="panel_card">
6 6
                     <div>
7 7
                         <h1>{ props.title }</h1>
8 8
                     </div>
9 9
                     <div>
10
-                        <props.icon style={{ color :'#fd4b4b', fontSize : 45 }}/>
10
+                        <props.icon style={{ color :'#fd4b4b', fontSize : 45, margin : 5}}/>
11 11
                     </div>
12 12
                     <div className="content_info">
13 13
                         <p>432</p>

+ 41 - 10
psicoadmin/src/Components/Dashboard.js

@@ -1,4 +1,4 @@
1
-import * as React from 'react';
1
+import React, { useEffect, useState, useMemo } from 'react';
2 2
 import { styled, createTheme, ThemeProvider } from '@mui/material/styles';
3 3
 import CssBaseline from '@mui/material/CssBaseline';
4 4
 import MuiDrawer from '@mui/material/Drawer';
@@ -52,6 +52,26 @@ const AppBar = styled(MuiAppBar, {
52 52
     }),
53 53
 }));
54 54
 
55
+const useCheckMobileScreen = () => {
56
+    const [width, setWidth] = useState(window.innerWidth);
57
+    const handleWindowSizeChange = () => {
58
+        let size = window.innerWidth;
59
+        console.log('SIZE >', size)
60
+        setWidth(size);
61
+    }
62
+
63
+    useEffect(() => {
64
+        window.addEventListener('resize', handleWindowSizeChange);
65
+        return () => {
66
+            window.removeEventListener('resize', handleWindowSizeChange);
67
+        }
68
+    }, []);
69
+
70
+    let isMobile = width <= 1000
71
+
72
+    return (isMobile);
73
+}
74
+
55 75
 const Drawer = styled(MuiDrawer, { shouldForwardProp: (prop) => prop !== 'open' })(
56 76
     ({ theme, open }) => ({
57 77
         '& .MuiDrawer-paper': {
@@ -82,7 +102,8 @@ const mdTheme = createTheme();
82 102
 
83 103
 function DashboardContent() {
84 104
 
85
-    const [open, setOpen] = React.useState(true);
105
+    const [open, setOpen] = React.useState(false);
106
+
86 107
     const toggleDrawer = () => setOpen(!open);
87 108
     const auth = useAuth();
88 109
     const navigate = useNavigate()
@@ -91,24 +112,34 @@ function DashboardContent() {
91 112
     const open_profile = Boolean(anchorEl);
92 113
     const handleClick = (event) => setAnchorEl(event.currentTarget);
93 114
     const handleClose = () => setAnchorEl(null);
115
+
116
+    const MenuResponsive = ()  => {
117
+        console.log('show menu responsive')
118
+    } 
119
+
94 120
     const CerrarSession = () => {
95 121
         console.log('cerrando session')
96 122
         auth.logout();
97 123
         navigate('/')
98 124
     } 
99 125
 
126
+
100 127
     return (
101 128
         <ThemeProvider theme={mdTheme}>
102 129
             <Box sx={{ display: 'flex' }}>
103 130
                 <CssBaseline />
104
-                <AppBar style={{ backgroundColor : '#fff', boxShadow : 'None' }} position="absolute" open={open}>
131
+                <AppBar style={{ backgroundColor : '#fff', boxShadow : 'None' }} position="absolute" open={useCheckMobileScreen() ? false : open}>
132
+
105 133
                     <Toolbar sx={{ pr: '24px' ,  borderBottom : "1px solid #ec5e69"}} >
106 134
 
107
-                        <IconButton style={{ 
108
-                                // color : '#212529',
109
-                        }} edge="start" color="inherit" aria-label="open drawer" onClick={toggleDrawer} sx={{ 
110
-                                marginRight: '36px', ...(open && { display: 'none' }), 
111
-                        }} >
135
+                        <IconButton 
136
+                            edge="start" 
137
+                            color="inherit" 
138
+                            aria-label="open drawer" 
139
+                            onClick={ useCheckMobileScreen() ? MenuResponsive : toggleDrawer } 
140
+                            // onClick={ () => console.log('que estoy haciendo con mi vida') } 
141
+                            sx={{ marginRight: '36px', ...( !useCheckMobileScreen() && open && { display: 'none' }), }} >
142
+
112 143
                             <MenuIcon  style={{
113 144
                                 background: '#ec5e69',
114 145
                                 fontSize: "40",
@@ -119,7 +150,7 @@ function DashboardContent() {
119 150
                         <Typography component="h1" variant="h6" color="inherit" noWrap sx={{ flexGrow: 1 }} >
120 151
 
121 152
                             {
122
-                                open ? (
153
+                                !useCheckMobileScreen() && open ? (
123 154
                                     <React.Fragment>
124 155
 
125 156
                                         <IconButton onClick={toggleDrawer}>
@@ -201,7 +232,7 @@ function DashboardContent() {
201 232
 
202 233
                         <div style={{ flat : 'righ' }} className="sidebar-header">
203 234
                             <div className="width_img">
204
-                                <img src={Logo} alt=""/>
235
+                                <img src={Logo} alt="pruebas psicometricas"/>
205 236
                             </div>
206 237
                         </div>
207 238
 

+ 0 - 40
psicoadmin/src/Components/NavStyle.js

@@ -1,40 +0,0 @@
1
-import Color from 'color';
2
-
3
-const NavStyle = () => ({
4
-    root: ({ collapsed }) => ({
5
-        borderTopRightRadius: 20,
6
-        borderBottomRightRadius: 20,
7
-        minHeight: 32,
8
-        '-webkit-font-smoothing': 'antialiased',
9
-        padding: collapsed ? '0px 6px' : '0 12px 0 26px',
10
-        width: collapsed ? 32 : 'auto',
11
-        borderRadius: collapsed ? 20 : 0,
12
-        overflow: collapsed ? 'hidden' : 'visible',
13
-        marginLeft: collapsed ? 20 : '',
14
-        fontSize: 14,
15
-        '& > svg:first-child': {
16
-            marginRight: 18,
17
-            fontSize: 20,
18
-            opacity: 0.54,
19
-        },
20
-        '& .MuiLabel-amount': {
21
-            fontSize: '0.75rem',
22
-            letterSpacing: 0.3,
23
-            marginLeft: 'auto',
24
-            paddingLeft: 16,
25
-        },
26
-    }),
27
-    selected: ({ color = '#202124' }) => ({
28
-        fontWeight: 'bold',
29
-        color,
30
-        backgroundColor: `${Color(color)
31
-      .saturate(0.5)
32
-      .lighten(0.9)
33
-      .toString()} !important`,
34
-        '& > svg:first-child': {
35
-            opacity: 1,
36
-        }
37
-    }),
38
-});
39
-
40
-export default NavStyle

+ 3 - 2
psicoadmin/src/Components/Routes.js

@@ -26,13 +26,13 @@ export default function MyRoutes () {
26 26
         if(!auth.isLogged(0)){
27 27
             return navigate('/')
28 28
         }
29
-    },[])
29
+    },[auth, ])
30 30
     
31 31
 
32 32
     return(
33 33
         <Routes>
34 34
 
35
-            <Route path="/" element={<Login/>}/>
35
+            <Route path="/" element={auth.isLogged() ? <Navigate to='dashboard/home'/> : <Login/>}/>
36 36
 
37 37
             {
38 38
                 auth.isLogged() ? 
@@ -54,6 +54,7 @@ export default function MyRoutes () {
54 54
             }
55 55
 
56 56
 
57
+
57 58
             <Route path="*" element={<NotFound/>}/>
58 59
 
59 60
         </Routes>

+ 4 - 2
psicoadmin/src/Components/listItems.js

@@ -114,8 +114,10 @@ export const MainListItems = () =>  {
114 114
     };
115 115
 
116 116
     const [open, setOpen] = React.useState(false);
117
+    const [submenu, isSub] = React.useState(false);
117 118
 
118 119
     const showPruebas = () => {
120
+        handleListItemClick(-1)
119 121
         setOpen(!open);
120 122
     };
121 123
 
@@ -131,7 +133,7 @@ export const MainListItems = () =>  {
131 133
             {/* <Item icon={<FingerprintIcon/>} selected={selectedIndex}  change={handleListItemClick} index={5} title="Pruebas" route="/pruebas" /> */}
132 134
 
133 135
 
134
-            <ListItem onClick={showPruebas}>
136
+            <ListItem selected={open}  onClick={showPruebas}>
135 137
                 <ListItemIcon>
136 138
                     <FingerprintIcon />
137 139
                 </ListItemIcon>
@@ -153,7 +155,7 @@ export const MainListItems = () =>  {
153 155
                 <List component="div" disablePadding>
154 156
                         
155 157
                     <SubMenuItem route="pruebas/crear" selected={selectedIndex} index={5} change={handleListItemClick} title="Crear Prueba" />
156
-                    <SubMenuItem route="pruebas/listar" change={handleListItemClick} selected={selectedIndex} index={6} change={handleListItemClick} title="Listado de pruebas" />
158
+                    <SubMenuItem route="pruebas/listar" change={handleListItemClick} selected={selectedIndex} index={6} title="Listado de pruebas" />
157 159
                     <SubMenuItem route="pruebas/aplicar"  selected={selectedIndex} index={7} change={handleListItemClick} title="Aplicar" />
158 160
                     <SubMenuItem selected={selectedIndex} index={8} change={handleListItemClick} title="Respuestas" />
159 161
                     <SubMenuItem selected={selectedIndex} index={9} change={handleListItemClick} title="Calificaciones" />

+ 9 - 1
psicoadmin/src/Css/all.css

@@ -2018,7 +2018,7 @@ label {
2018 2018
 }
2019 2019
 .content-section .main p {
2020 2020
     color: #878787;
2021
-    padding: 0 15px;
2021
+    /* padding: 0 15px; */
2022 2022
     /* margin-bottom: 40px; */
2023 2023
 }
2024 2024
 .datos_candidato {
@@ -3940,3 +3940,11 @@ All this is done for any sub-level being entered.
3940 3940
     margin: 0!important;
3941 3941
     text-align: center;
3942 3942
 }
3943
+@media (max-width: 1000px){
3944
+    .MuiDrawer-paper{
3945
+        display: none !important;
3946
+    }
3947
+}
3948
+
3949
+
3950
+

+ 2 - 2
psicoadmin/src/Pages/Configuracion.js

@@ -13,7 +13,7 @@ export function Configuracion() {
13 13
                                 <div class="row">
14 14
                                     <div class="col-md-4">
15 15
                                         <div class="img-container">
16
-                                            <img src={ProfilePicture} alt='profile picture' />
16
+                                            <img src={ProfilePicture} alt='profile ' />
17 17
                                         </div>
18 18
                                     </div>
19 19
                                     <div class="col-md-8">
@@ -52,7 +52,7 @@ export function Configuracion() {
52 52
                                 </div>
53 53
                                 <div class="boton_guardar_info">
54 54
                                     <div class="success_btn">
55
-                                        <a href="#">Guardar</a>
55
+                                        <a href="/">Guardar</a>
56 56
                                     </div>
57 57
                                 </div>
58 58
                             </div>

+ 2 - 2
psicoadmin/src/Pages/Historial.js

@@ -4,7 +4,7 @@ import Skeleton from '@mui/material/Skeleton';
4 4
 import Stack from '@mui/material/Stack';
5 5
 
6 6
 function CardChar (props){
7
-    let { image, name, species } = props.proto
7
+    let { image, name } = props.proto
8 8
     return(
9 9
         <Card onClick={ () => props.remove(props.id) } style={{ width: '18rem' }}>
10 10
             <Card.Img variant="top" src={image} />
@@ -59,7 +59,7 @@ export function Historial () {
59 59
 
60 60
         console.log('Render', character, elements)
61 61
 
62
-    }, [elements])
62
+    }, [elements, character])
63 63
 
64 64
 
65 65
     const Remove = (index) =>{