浏览代码

some styles componentes

amenpunk 2 年之前
父节点
当前提交
0f93c18258

+ 1 - 0
src/App.css

@@ -416,6 +416,7 @@
416 416
   color:white !important;
417 417
   background:var(--main) !important;
418 418
 }
419
+
419 420
 .headert_pwdu{
420 421
   background:var(--main);
421 422
   color:white !important;

+ 1 - 1
src/App.js

@@ -12,7 +12,7 @@ import Routes from './Components/Routes'
12 12
 const queryClient = new QueryClient({
13 13
   defaultOptions: {
14 14
     queries: {
15
-      refetchOnWindowFocus: false,
15
+      refetchOnWindowFocus: true,
16 16
     },
17 17
   },
18 18
 })

+ 101 - 68
src/Components/Dashboard.js

@@ -2,16 +2,16 @@ import React from 'react';
2 2
 import { ThemeProvider, styled, createTheme } from '@mui/material/styles';
3 3
 
4 4
 import {
5
-    Container, IconButton, Divider,
6
-    Typography, List, Toolbar,useMediaQuery as Size,
7
-    Box, Badge, Menu, Avatar, MenuItem
5
+  Container, IconButton, Divider,
6
+  Typography, List, Toolbar, useMediaQuery as Size,
7
+  Box, Badge, Menu, Avatar, MenuItem
8 8
 } from '@mui/material'
9 9
 
10 10
 import {
11
-    Fullscreen as FullscreenIcon,
12
-    Menu as MenuIcon,
13
-    KeyboardDoubleArrowLeft as LeftKey,
14
-    Notifications as NotificationsIcon,
11
+  Fullscreen as FullscreenIcon,
12
+  Menu as MenuIcon,
13
+  KeyboardDoubleArrowLeft as LeftKey,
14
+  Notifications as NotificationsIcon,
15 15
 } from '@mui/icons-material'
16 16
 
17 17
 import Logo from '../Images/evaluacion.jpeg';
@@ -23,57 +23,86 @@ import Footer from "../Components/Footer";
23 23
 import { Drawer as MuiDrawer, AppBar as MuiAppBar } from "../Components/Navigation/AppBar"
24 24
 import { MainListItems, SecondaryListItems } from '../Components/Navigation/listItems';
25 25
 import ProfilePicture from '../Images/man.png';
26
-import { useDispatch } from 'react-redux';
26
+import { useDispatch, useSelector } from 'react-redux';
27 27
 import { removeToken } from '../Slices/tokenSlice';
28 28
 
29 29
 const drawerWidth = 240;
30 30
 const mdTheme = createTheme();
31 31
 
32
+function stringToColor(string) {
33
+  let hash = 0;
34
+  let i;
35
+  /* eslint-disable no-bitwise */
36
+  for (i = 0; i < string.length; i += 1) {
37
+    hash = string.charCodeAt(i) + ((hash << 5) - hash);
38
+  }
39
+
40
+  let color = '#';
41
+
42
+  for (i = 0; i < 3; i += 1) {
43
+    const value = (hash >> (i * 8)) & 0xff;
44
+    color += `00${value.toString(16)}`.slice(-2);
45
+  }
46
+  /* eslint-enable no-bitwise */
47
+  return color;
48
+}
49
+
50
+
51
+function stringAvatar(name) {
52
+  console.log("NAME: ", name)
53
+  return {
54
+    sx: {
55
+      bgcolor: stringToColor(name),
56
+    },
57
+    children: `${name.split(' ')[0][0]}${name.split(' ')[1][0]}`,
58
+  };
59
+}
60
+
32 61
 const AppBar = styled(MuiAppBar, {
33
-    shouldForwardProp: (prop) => prop !== 'open',
62
+  shouldForwardProp: (prop) => prop !== 'open',
34 63
 })(({ theme, open }) => ({
35
-    zIndex: theme.zIndex.drawer + 1,
64
+  zIndex: theme.zIndex.drawer + 1,
65
+  transition: theme.transitions.create(['width', 'margin'], {
66
+    easing: theme.transitions.easing.sharp,
67
+    duration: theme.transitions.duration.leavingScreen,
68
+  }),
69
+  ...(open && {
70
+    marginLeft: drawerWidth,
71
+    width: `calc(100% - ${drawerWidth}px)`,
36 72
     transition: theme.transitions.create(['width', 'margin'], {
37
-        easing: theme.transitions.easing.sharp,
38
-        duration: theme.transitions.duration.leavingScreen,
39
-    }),
40
-    ...(open && {
41
-        marginLeft: drawerWidth,
42
-        width: `calc(100% - ${drawerWidth}px)`,
43
-        transition: theme.transitions.create(['width', 'margin'], {
44
-            easing: theme.transitions.easing.sharp,
45
-            duration: theme.transitions.duration.enteringScreen,
46
-        }),
73
+      easing: theme.transitions.easing.sharp,
74
+      duration: theme.transitions.duration.enteringScreen,
47 75
     }),
76
+  }),
48 77
 }));
49 78
 
50 79
 
51
-const Drawer = styled(MuiDrawer, 
52
-    { shouldForwardProp: (prop) => prop !== 'open' })(
80
+const Drawer = styled(MuiDrawer,
81
+  { shouldForwardProp: (prop) => prop !== 'open' })(
53 82
     ({ theme, open }) => ({
54
-        '& .MuiDrawer-paper': {
55
-            position: 'relative',
56
-            whiteSpace: 'nowrap',
57
-            width: drawerWidth,
58
-            transition: theme.transitions.create('width', {
59
-                easing: theme.transitions.easing.sharp,
60
-                duration: theme.transitions.duration.enteringScreen,
61
-            }),
62
-            boxSizing: 'border-box',
63
-            ...(!open && {
64
-                overflowX: 'hidden',
65
-                transition: theme.transitions.create('width', {
66
-                    easing: theme.transitions.easing.sharp,
67
-                    duration: theme.transitions.duration.leavingScreen,
68
-                }),
69
-                width: theme.spacing(7),
70
-                [theme.breakpoints.up('sm')]: {
71
-                    width: theme.spacing(9),
72
-                },
73
-            }),
74
-        },
83
+      '& .MuiDrawer-paper': {
84
+        position: 'relative',
85
+        whiteSpace: 'nowrap',
86
+        width: drawerWidth,
87
+        transition: theme.transitions.create('width', {
88
+          easing: theme.transitions.easing.sharp,
89
+          duration: theme.transitions.duration.enteringScreen,
90
+        }),
91
+        boxSizing: 'border-box',
92
+        ...(!open && {
93
+          overflowX: 'hidden',
94
+          transition: theme.transitions.create('width', {
95
+            easing: theme.transitions.easing.sharp,
96
+            duration: theme.transitions.duration.leavingScreen,
97
+          }),
98
+          width: theme.spacing(7),
99
+          [theme.breakpoints.up('sm')]: {
100
+            width: theme.spacing(9),
101
+          },
102
+        }),
103
+      },
75 104
     }),
76
-);
105
+  );
77 106
 
78 107
 
79 108
 function DashboardContent() {
@@ -83,25 +112,29 @@ function DashboardContent() {
83 112
   const isMovil = Size('(max-width:1000px)');
84 113
   const dispatch = useDispatch();
85 114
   const navigate = useNavigate()
115
+  const profile = useSelector((state) => state.recluter.info)
116
+  console.log('PROFILE: ', profile)
86 117
 
87 118
   const CerrarSession = () => {
119
+    //TODO:
120
+    //remove all status
88 121
     dispatch(removeToken())
89 122
     navigate('/')
90 123
   }
91 124
 
92 125
   const [anchorEl, setAnchorEl] = React.useState(null);
93 126
   const open_profile = Boolean(anchorEl);
94
-  const handleClick = (event) =>  setAnchorEl(event.currentTarget);
127
+  const handleClick = (event) => setAnchorEl(event.currentTarget);
95 128
   const handleClose = () => setAnchorEl(null)
96 129
   const toggleDrawer = () => {
97
-    if(isMovil){
130
+    if (isMovil) {
98 131
       setAnchorElMov(!anchorElMovil)
99
-    }else{
132
+    } else {
100 133
       setOpen(!open);
101 134
     }
102 135
   }
103 136
   const [anchorElMovil, setAnchorElMov] = React.useState(false);
104
-  React.useEffect(() => isMovil ? setOpen(false) : null , [isMovil])
137
+  React.useEffect(() => isMovil ? setOpen(false) : null, [isMovil])
105 138
 
106 139
   return (
107 140
     <ThemeProvider theme={mdTheme}>
@@ -114,9 +147,8 @@ function DashboardContent() {
114 147
               edge="start"
115 148
               color="inherit"
116 149
               aria-label="open drawer"
117
-              // onClick={isMovil ? MenuResponsive : toggleDrawer}
118 150
               onClick={toggleDrawer}
119
-              sx={{ marginRight: '36px', ...( open && { display: 'none' }), }} >
151
+              sx={{ marginRight: '36px', ...(open && { display: 'none' }), }} >
120 152
               <MenuIcon style={{
121 153
                 background: '#ec5e69',
122 154
                 fontSize: "40",
@@ -125,19 +157,19 @@ function DashboardContent() {
125 157
             </IconButton>
126 158
             <Typography component="h1" variant="h6" color="inherit" noWrap sx={{ flexGrow: 1 }} >
127 159
               {
128
-              open ? (
129
-                <React.Fragment>
130
-
131
-                  <IconButton onClick={toggleDrawer}>
132
-                    <LeftKey/>
133
-                  </IconButton>
134
-
135
-                  <IconButton onClick={(event) => event.target.requestFullscreen()}>
136
-                    <FullscreenIcon style={{ paddinLeft: 15 }} />
137
-                  </IconButton>
138
-                </React.Fragment>
139
-              ) : undefined
140
-            }
160
+                open ? (
161
+                  <React.Fragment>
162
+
163
+                    <IconButton onClick={toggleDrawer}>
164
+                      <LeftKey />
165
+                    </IconButton>
166
+
167
+                    <IconButton onClick={(event) => event.target.requestFullscreen()}>
168
+                      <FullscreenIcon style={{ paddinLeft: 15 }} />
169
+                    </IconButton>
170
+                  </React.Fragment>
171
+                ) : undefined
172
+              }
141 173
             </Typography>
142 174
 
143 175
             <Box sx={{ display: { xs: 'none', md: 'flex' } }}>
@@ -146,8 +178,8 @@ function DashboardContent() {
146 178
                 size="large"
147 179
                 aria-label="show 17 new notifications"
148 180
                 color="inherit">
149
-                <Badge badgeContent={17} color="error">
150
-                  <NotificationsIcon style={{ color : '#212529' }}/>
181
+                <Badge badgeContent={1} color="error">
182
+                  <NotificationsIcon style={{ color: '#212529' }} />
151 183
                 </Badge>
152 184
               </IconButton>
153 185
 
@@ -161,7 +193,8 @@ function DashboardContent() {
161 193
                 onClick={handleClick}
162 194
                 color="inherit"
163 195
               >
164
-                <Avatar alt="Cindy Baker" src={ProfilePicture} />
196
+                {/* <Avatar alt="Cindy Baker" src={ProfilePicture} /> */ }
197
+                <Avatar {...stringAvatar(`${profile.nombre} ${profile.apelidos}`)} />
165 198
 
166 199
               </IconButton>
167 200
               <Menu
@@ -170,7 +203,7 @@ function DashboardContent() {
170 203
                 open={open_profile}
171 204
                 onClose={handleClose}
172 205
                 MenuListProps={{ 'aria-labelledby': 'basic-button', }}>
173
-                <MenuItem onClick={() => navigate('/dashboard/configuraciones') }>Perfil</MenuItem>
206
+                <MenuItem onClick={() => navigate('/dashboard/configuraciones')}>Perfil</MenuItem>
174 207
                 <MenuItem onClick={CerrarSession}>Cerrar Sesion</MenuItem>
175 208
               </Menu>
176 209
             </Box>
@@ -211,6 +244,6 @@ function DashboardContent() {
211 244
 }
212 245
 
213 246
 export function Dashboard() {
214
-    return <DashboardContent />;
247
+  return <DashboardContent />;
215 248
 }
216 249
 

+ 6 - 11
src/Components/Home/Candidato.jsx

@@ -24,19 +24,15 @@ function IconStatus(props) {
24 24
   let navigate = useNavigate()
25 25
   let auth = useSelector((state) => state.token)
26 26
 
27
-  console.log(props)
28 27
   const calificar = () => {
29
-    console.log('TOKEN: ',auth.token)
30 28
     let rest = new Service(`/prueba/calificacion/cleaver/report/${props.pwd}`);
31 29
 
32 30
     rest
33 31
       .getQuery(auth.token)
34 32
       .then(r => {
35
-        console.log("SUCCESS:", r)
36 33
         navigate('/dashboard/resultados/' + props.pwd)
37 34
       })
38 35
       .catch(e => {
39
-        console.log("ERROR:", e.message)
40 36
         // navigate('/dashboard/resultados/' + props.pwd)
41 37
       })
42 38
   }
@@ -51,7 +47,7 @@ function IconStatus(props) {
51 47
             // navigate('/dashboard/resultados/' + props.pwd)
52 48
           }
53 49
         }}
54
-        style={{ color: '#0bd641' }}
50
+        style={{ color: props.color }}
55 51
         components="label">
56 52
         {<props.icon />}
57 53
       </IconButton>
@@ -67,21 +63,20 @@ function getOperation(estado, SuperPWD) {
67 63
   // Patrik: 1 -> Solo esta asignado.
68 64
   switch (estado) {
69 65
     case 1: // solo asignado
70
-      return <IconStatus icon={AddTaskIcon} message="Candidato Asignado" />
66
+      return <IconStatus color="#0bd641" icon={AddTaskIcon} message="Candidato Asignado" />
71 67
     case 97: //error en las respuestas
72
-      return <IconStatus icon={ErrorIcon} message="Hay error en las respuestas" />
68
+      return <IconStatus color="var(--main)"  icon={ErrorIcon} message="Hay error en las respuestas" />
73 69
     case 99: // el candidato se encuentra realizndolo
74
-      return <IconStatus icon={AssignmentTurnedInIcon} message="El candidato se encuentra realizando la prueba" />
70
+      return <IconStatus color="#f5f511" icon={AssignmentTurnedInIcon} message="El candidato se encuentra realizando la prueba" />
75 71
     case 100: // finalizado
76
-      return <IconStatus estado={100} icon={CheckBoxIcon} message="Calificar el examen" pwd={SuperPWD} />
72
+      return <IconStatus color="#0bd641" estado={100} icon={CheckBoxIcon} message="Calificar el examen" pwd={SuperPWD} />
77 73
     default: return null
78 74
   }
79 75
 }
80 76
 
81 77
 function Asignaciones(props) {
82 78
 
83
-  let { estado, cattest, calificacionescleaver: test_result, id: SuperPWD } = props.asign;
84
-  console.log(props, test_result, SuperPWD)
79
+  let { estado, cattest, id: SuperPWD } = props.asign;
85 80
 
86 81
   return (
87 82
     <tr>

+ 91 - 87
src/Components/Navigation/listItems.js

@@ -3,108 +3,112 @@ import { Nav } from 'react-bootstrap';
3 3
 
4 4
 import { Fingerprint, ExpandLess, ExpandMore } from '@mui/icons-material/'
5 5
 import { useNavigate, useResolvedPath, useMatch } from 'react-router-dom'
6
-import { Collapse,ListItem, List ,ListItemIcon,ListItemText,ListSubheader } from '@mui/material/'
6
+import { Collapse, ListItem, List, ListItemIcon, ListItemText, ListSubheader } from '@mui/material/'
7 7
 
8
-import { 
9
-    MainItems, ExtraItems, PruebaItems, TxTStyle,
10
-    UserItems
8
+import {
9
+  MainItems, ExtraItems, PruebaItems, TxTStyle,
10
+  UserItems
11 11
 } from '../../Utils/MenuItems'
12 12
 
13 13
 
14
-function NavItem (props) {
15
-    
16
-    let navigate = useNavigate()
17
-    let resolved = useResolvedPath(props.route);
18
-    let match = useMatch({ path: resolved.pathname, end: true });
14
+function NavItem(props) {
15
+
16
+  let navigate = useNavigate()
17
+  let resolved = useResolvedPath(props.route);
18
+  let match = useMatch({ path: resolved.pathname, end: true });
19
+
20
+  let { title, route, icon, open, AppBarVisible, setOpen } = props
21
+
22
+  if (route.startsWith('prueba') && match && open && !AppBarVisible) {
23
+    setOpen(false);
24
+  }
25
+
26
+  return (
27
+    <ListItem
28
+      sx={{ color: '#25344f' }}
29
+      selected={match && typeof (match) === "object"}
30
+      onClick={() => navigate(route)}
31
+      button >
32
+      <ListItemIcon>
33
+        {icon && icon}
34
+      </ListItemIcon>
35
+      <ListItemText
36
+        sx={TxTStyle}
37
+        primary={title}
38
+      />
39
+    </ListItem>
40
+  )
41
+}
19 42
 
20
-    let { title, route, icon, open, AppBarVisible, setOpen } = props
21 43
 
22
-    if(route.startsWith('prueba') && match && open && !AppBarVisible ){
23
-        setOpen(false);
24
-    }
44
+export const MainListItems = (props) => {
25 45
 
26
-    return(
27
-        <ListItem
28
-            sx={{ color : '#25344f'}}
29
-            selected={ match && typeof(match) === "object" }
30
-            onClick={() => navigate(route) } 
31
-            button >
32
-            <ListItemIcon>
33
-                {icon && icon}
34
-            </ListItemIcon>
35
-            <ListItemText 
36
-                sx={TxTStyle}
37
-                primary={title} 
38
-            />
39
-        </ListItem>
40
-    )
41
-}
46
+  const [open, setOpen] = React.useState(false);
42 47
 
48
+  const showPruebas = () => {
49
+    if (!props.AppBarVisible) {
50
+      props.setAppBarVisible(true);
51
+    }
52
+    setOpen(!open);
53
+  };
54
+
55
+  return (
56
+    <List>
57
+      <ListSubheader inset>MENÚ</ListSubheader>
58
+      {
59
+        MainItems.map(({ icon, title, route }, i) => (
60
+          <NavItem key={i} icon={icon} title={title} route={route} />
61
+        ))
62
+      }
63
+
64
+      {/*
65
+        <ListItem selected={open} onClick={showPruebas}>
66
+          <ListItemIcon>
67
+            <Fingerprint />
68
+          </ListItemIcon>
69
+          <ListItemText
70
+            sx={TxTStyle}
71
+            primary="Pruebas"
72
+          />
73
+          {open ? <ExpandLess /> : <ExpandMore />}
74
+        </ListItem>
43 75
 
44
-export const MainListItems = (props) =>  {
45
-
46
-    const [open, setOpen] = React.useState(false);
47
-
48
-    const showPruebas = () => {
49
-        if(!props.AppBarVisible){
50
-            props.setAppBarVisible(true);
51
-        }
52
-        setOpen(!open);
53
-    };
54
-
55
-    return(
56
-        <List>
57
-            <ListSubheader inset>MENÚ</ListSubheader>
58
-            {
59
-                MainItems.map( ({ icon, title, route}, i) =>  (
60
-                    <NavItem key={i} icon={icon} title={title} route={route} />
61
-                ))
62
-            }
63
-            <ListItem selected={open} onClick={showPruebas}>
64
-                <ListItemIcon>
65
-                    <Fingerprint />
66
-                </ListItemIcon>
67
-                <ListItemText 
68
-                    sx={TxTStyle}
69
-                    primary="Pruebas" 
70
-                />
71
-                {open ? <ExpandLess /> : <ExpandMore />}
72
-            </ListItem>
73
-            <Collapse in={open} timeout="auto" unmountOnExit>
74
-                <List component="div" disablePadding>
75
-                    {
76
-                        PruebaItems.map( ({ route, title},i) => 
77
-                            ( <NavItem key={i} setOpen={setOpen} { ...props} open={open} route={route} title={title} />)
78
-                        )
79
-                    }
80
-                </List>
76
+          <Collapse in={open} timeout="auto" unmountOnExit>
77
+            <List component="div" disablePadding>
78
+              {
79
+                PruebaItems.map(({ route, title }, i) =>
80
+                  (<NavItem key={i} setOpen={setOpen} {...props} open={open} route={route} title={title} />)
81
+                )
82
+              }
83
+            </List>
81 84
             </Collapse>
85
+      */}
82 86
 
83
-        </List>
84
-    )
87
+    </List>
88
+  )
85 89
 };
86 90
 
87
-export const UserListItems = (_props) =>  {
88
-    return(
89
-        <List>
90
-            <ListSubheader inset>MENÚ</ListSubheader>
91
-            {
92
-                UserItems.map( ({ icon, title, route}, i) =>  (
93
-                    <NavItem key={i} icon={icon} title={title} route={route} />
94
-                ))
95
-            }
96
-        </List>
97
-    )
91
+export const UserListItems = (_props) => {
92
+  return (
93
+    <List>
94
+      <ListSubheader inset>MENÚ</ListSubheader>
95
+      {
96
+        UserItems.map(({ icon, title, route }, i) => (
97
+          <NavItem key={i} icon={icon} title={title} route={route} />
98
+        ))
99
+      }
100
+    </List>
101
+  )
98 102
 };
99 103
 
100 104
 export const SecondaryListItems = (
101
-    <Nav>
102
-        <ListSubheader inset>EXTRAS</ListSubheader>
103
-        {
104
-            ExtraItems.map( ({ icon, route, title}) => 
105
-                ( <NavItem key={route} icon={icon} title={title} route={route} />)
106
-            )
107
-        }
108
-    </Nav>
105
+  <Nav>
106
+    <ListSubheader inset>EXTRAS</ListSubheader>
107
+    {
108
+      ExtraItems.map(({ icon, route, title }) =>
109
+        (<NavItem key={route} icon={icon} title={title} route={route} />)
110
+      )
111
+    }
112
+  </Nav>
109 113
 );
110 114
 

+ 4 - 0
src/Components/Routes.js

@@ -23,6 +23,7 @@ import { RestorePassword } from '../Pages/RestorePassword'
23 23
 import { HomeUser } from '../Pages/HomeUser'
24 24
 import { Prueba } from '../Pages/Prueba.jsx'
25 25
 import { RequireToken, RequireUserToken } from '../Components/PrivateRoute'
26
+import { Default } from '../Pages/Default';
26 27
 
27 28
 export default function MyRoutes() {
28 29
 
@@ -74,6 +75,9 @@ export default function MyRoutes() {
74 75
         <Route path="pruebas/listar" element={<Pruebas />} />
75 76
         <Route path="pruebas/crear" element={<PruebaNueva />} />
76 77
         <Route path="pruebas/aplicar" element={<PruebaAsignar />} />
78
+        <Route path="default" element={<Default />} />
79
+        <Route path="default2" element={<Default />} />
80
+
77 81
       </Route>
78 82
       <Route path="*" element={<NotFound />} />
79 83
 

+ 18 - 0
src/Pages/Default.jsx

@@ -0,0 +1,18 @@
1
+import { Row, Container } from 'react-bootstrap'
2
+
3
+export function Default() {
4
+
5
+  return (
6
+
7
+    <section>
8
+      <div className="content-section">
9
+        <div className="main">
10
+          <Container >
11
+            <Row style={{ display: 'flex', flexWrap: 'wrap', justifyContent: "center" }}></Row>
12
+          </Container>
13
+        </div>
14
+      </div>
15
+    </section>
16
+  )
17
+
18
+}

+ 7 - 7
src/Utils/MenuItems.js

@@ -65,19 +65,19 @@ export const MainItems = [
65 65
 ]
66 66
 
67 67
 export const ExtraItems = [
68
-  {
69
-    icon: <Star />,
70
-    route: 'elementos',
71
-    title: 'Elementos'
72
-  },
68
+  // {
69
+  //   icon: <Star />,
70
+  //   route: 'elementos',
71
+  //   title: 'Elementos'
72
+  // },
73 73
   {
74 74
     icon: <OndemandVideo />,
75
-    route: 'tutoriales',
75
+    route: 'default',
76 76
     title: 'Tutoriales'
77 77
   },
78 78
   {
79 79
     icon: <SupportAgent />,
80
-    route: 'help',
80
+    route: 'default2',
81 81
     title: 'Asistencia Técnica'
82 82
   },
83 83
 ]