Browse Source

moving forward

amenpunk 3 years ago
parent
commit
a0a9ee5f93

+ 3 - 2
psicoadmin/src/App.css

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

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

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

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

1
-import * as React from 'react';
1
+import React, { useEffect, useState, useMemo } from 'react';
2
 import { styled, createTheme, ThemeProvider } from '@mui/material/styles';
2
 import { styled, createTheme, ThemeProvider } from '@mui/material/styles';
3
 import CssBaseline from '@mui/material/CssBaseline';
3
 import CssBaseline from '@mui/material/CssBaseline';
4
 import MuiDrawer from '@mui/material/Drawer';
4
 import MuiDrawer from '@mui/material/Drawer';
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
 const Drawer = styled(MuiDrawer, { shouldForwardProp: (prop) => prop !== 'open' })(
75
 const Drawer = styled(MuiDrawer, { shouldForwardProp: (prop) => prop !== 'open' })(
56
     ({ theme, open }) => ({
76
     ({ theme, open }) => ({
57
         '& .MuiDrawer-paper': {
77
         '& .MuiDrawer-paper': {
82
 
102
 
83
 function DashboardContent() {
103
 function DashboardContent() {
84
 
104
 
85
-    const [open, setOpen] = React.useState(true);
105
+    const [open, setOpen] = React.useState(false);
106
+
86
     const toggleDrawer = () => setOpen(!open);
107
     const toggleDrawer = () => setOpen(!open);
87
     const auth = useAuth();
108
     const auth = useAuth();
88
     const navigate = useNavigate()
109
     const navigate = useNavigate()
91
     const open_profile = Boolean(anchorEl);
112
     const open_profile = Boolean(anchorEl);
92
     const handleClick = (event) => setAnchorEl(event.currentTarget);
113
     const handleClick = (event) => setAnchorEl(event.currentTarget);
93
     const handleClose = () => setAnchorEl(null);
114
     const handleClose = () => setAnchorEl(null);
115
+
116
+    const MenuResponsive = ()  => {
117
+        console.log('show menu responsive')
118
+    } 
119
+
94
     const CerrarSession = () => {
120
     const CerrarSession = () => {
95
         console.log('cerrando session')
121
         console.log('cerrando session')
96
         auth.logout();
122
         auth.logout();
97
         navigate('/')
123
         navigate('/')
98
     } 
124
     } 
99
 
125
 
126
+
100
     return (
127
     return (
101
         <ThemeProvider theme={mdTheme}>
128
         <ThemeProvider theme={mdTheme}>
102
             <Box sx={{ display: 'flex' }}>
129
             <Box sx={{ display: 'flex' }}>
103
                 <CssBaseline />
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
                     <Toolbar sx={{ pr: '24px' ,  borderBottom : "1px solid #ec5e69"}} >
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
                             <MenuIcon  style={{
143
                             <MenuIcon  style={{
113
                                 background: '#ec5e69',
144
                                 background: '#ec5e69',
114
                                 fontSize: "40",
145
                                 fontSize: "40",
119
                         <Typography component="h1" variant="h6" color="inherit" noWrap sx={{ flexGrow: 1 }} >
150
                         <Typography component="h1" variant="h6" color="inherit" noWrap sx={{ flexGrow: 1 }} >
120
 
151
 
121
                             {
152
                             {
122
-                                open ? (
153
+                                !useCheckMobileScreen() && open ? (
123
                                     <React.Fragment>
154
                                     <React.Fragment>
124
 
155
 
125
                                         <IconButton onClick={toggleDrawer}>
156
                                         <IconButton onClick={toggleDrawer}>
201
 
232
 
202
                         <div style={{ flat : 'righ' }} className="sidebar-header">
233
                         <div style={{ flat : 'righ' }} className="sidebar-header">
203
                             <div className="width_img">
234
                             <div className="width_img">
204
-                                <img src={Logo} alt=""/>
235
+                                <img src={Logo} alt="pruebas psicometricas"/>
205
                             </div>
236
                             </div>
206
                         </div>
237
                         </div>
207
 
238
 

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

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
         if(!auth.isLogged(0)){
26
         if(!auth.isLogged(0)){
27
             return navigate('/')
27
             return navigate('/')
28
         }
28
         }
29
-    },[])
29
+    },[auth, ])
30
     
30
     
31
 
31
 
32
     return(
32
     return(
33
         <Routes>
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
                 auth.isLogged() ? 
38
                 auth.isLogged() ? 
54
             }
54
             }
55
 
55
 
56
 
56
 
57
+
57
             <Route path="*" element={<NotFound/>}/>
58
             <Route path="*" element={<NotFound/>}/>
58
 
59
 
59
         </Routes>
60
         </Routes>

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

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

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

2018
 }
2018
 }
2019
 .content-section .main p {
2019
 .content-section .main p {
2020
     color: #878787;
2020
     color: #878787;
2021
-    padding: 0 15px;
2021
+    /* padding: 0 15px; */
2022
     /* margin-bottom: 40px; */
2022
     /* margin-bottom: 40px; */
2023
 }
2023
 }
2024
 .datos_candidato {
2024
 .datos_candidato {
3940
     margin: 0!important;
3940
     margin: 0!important;
3941
     text-align: center;
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
                                 <div class="row">
13
                                 <div class="row">
14
                                     <div class="col-md-4">
14
                                     <div class="col-md-4">
15
                                         <div class="img-container">
15
                                         <div class="img-container">
16
-                                            <img src={ProfilePicture} alt='profile picture' />
16
+                                            <img src={ProfilePicture} alt='profile ' />
17
                                         </div>
17
                                         </div>
18
                                     </div>
18
                                     </div>
19
                                     <div class="col-md-8">
19
                                     <div class="col-md-8">
52
                                 </div>
52
                                 </div>
53
                                 <div class="boton_guardar_info">
53
                                 <div class="boton_guardar_info">
54
                                     <div class="success_btn">
54
                                     <div class="success_btn">
55
-                                        <a href="#">Guardar</a>
55
+                                        <a href="/">Guardar</a>
56
                                     </div>
56
                                     </div>
57
                                 </div>
57
                                 </div>
58
                             </div>
58
                             </div>

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

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