Przeglądaj źródła

version stable 1

amenpunk 2 lat temu
rodzic
commit
80a0ba8ad6

+ 0 - 193
src/Components/AppBar.js

@@ -1,193 +0,0 @@
1
-import React, { useEffect, useState, useRef } from 'react';
2
-import { styled, createTheme, ThemeProvider } from '@mui/material/styles';
3
-import useAuth from '../Auth/useAuth';
4
-import { Outlet, useNavigate} from "react-router-dom";
5
-
6
-import Typography from '@mui/material/Typography';
7
-import IconButton from '@mui/material/IconButton';
8
-import MenuIcon from '@mui/icons-material/Menu';
9
-import Menu from '@mui/material/Menu';
10
-// import Container from '@mui/material/Container';
11
-import Badge from '@mui/material/Badge';
12
-import Avatar from '@mui/material/Avatar';
13
-import FullscreenIcon from '@mui/icons-material/Fullscreen';
14
-
15
-import MenuItem from '@mui/material/MenuItem';
16
-import MailIcon from '@mui/icons-material/Mail';
17
-import ProfilePicture from '../Images/man.png';
18
-import MuiAppBar from '@mui/material/AppBar';
19
-import NotificationsIcon from '@mui/icons-material/Notifications';
20
-import Toolbar from '@mui/material/Toolbar';
21
-import Box from '@mui/material/Box';
22
-
23
-const drawerWidth = 240;
24
-
25
-const useCheckMobileScreen = () => {
26
-    const [width, setWidth] = useState(window.innerWidth);
27
-    const handleWindowSizeChange = () => {
28
-        let size = window.innerWidth;
29
-        setWidth(size);
30
-    }
31
-
32
-    useEffect(() => {
33
-        window.addEventListener('resize', handleWindowSizeChange);
34
-        return () => {
35
-            window.removeEventListener('resize', handleWindowSizeChange);
36
-        }
37
-    }, []);
38
-
39
-    let isMobile = width <= 1000
40
-
41
-    return (isMobile);
42
-}
43
-
44
-const AppBar = styled(MuiAppBar, {
45
-    shouldForwardProp: (prop) => prop !== 'open',
46
-})(({ theme, open }) => ({
47
-    transition: theme.transitions.create(['margin', 'width'], {
48
-        easing: theme.transitions.easing.sharp,
49
-        duration: theme.transitions.duration.leavingScreen,
50
-    }),
51
-    ...(open && {
52
-        width: `calc(100% - ${drawerWidth}px)`,
53
-        marginLeft: `${drawerWidth}px`,
54
-        transition: theme.transitions.create(['margin', 'width'], {
55
-            easing: theme.transitions.easing.easeOut,
56
-            duration: theme.transitions.duration.enteringScreen,
57
-        }),
58
-    }),
59
-}));
60
-
61
-export default function AppBarComponent (){
62
-
63
-    const [open, setOpen] = React.useState(true);
64
-    const elRef = useRef();
65
-
66
-
67
-    const auth = useAuth();
68
-    const navigate = useNavigate()
69
-    const [anchorEl, setAnchorEl] = React.useState(null);
70
-
71
-    const [anchorElMovil, setAnchorElMov] = React.useState(null);
72
-
73
-    const toggleDrawer = () => setOpen(!open);
74
-    const open_profile = Boolean(anchorEl);
75
-    const handleClick = (event) => setAnchorEl(event.currentTarget);
76
-    const handleClose = () => setAnchorEl(null)
77
-    const openMov = Boolean(anchorElMovil);
78
-    const handleCloseMov = () => {
79
-        setAnchorElMov(null);
80
-    };
81
-
82
-    const MenuResponsive = ()  => {
83
-        setAnchorElMov(elRef.current);
84
-    } 
85
-
86
-    const CerrarSession = () => {
87
-        console.log('cerrando session')
88
-        // auth.logout();
89
-        // navigate('/')
90
-    } 
91
-
92
-    return(
93
-        <AppBar 
94
-            style={{ backgroundColor : '#fff', boxShadow : 'None' }} 
95
-            position="fixed" 
96
-            open={useCheckMobileScreen() ? false : open} >
97
-
98
-            <Toolbar sx={{ borderBottom : "1px solid #ec5e69"}} >
99
-
100
-                <div ref={elRef}>
101
-                    <IconButton 
102
-                        edge="start" 
103
-                        color="inherit" 
104
-                        aria-label="open drawer" 
105
-                        onClick={ useCheckMobileScreen() ? MenuResponsive : toggleDrawer } 
106
-                        sx={{ marginRight: '36px', ...( !useCheckMobileScreen() && open && { display: 'none' }), }} >
107
-                        <MenuIcon  style={{
108
-                            background: '#ec5e69',
109
-                            fontSize: "40",
110
-                            color: "#fff"
111
-                        }}/>
112
-                    </IconButton>
113
-
114
-                    <Menu
115
-                        id="basic-menu"
116
-                        anchorEl={anchorElMovil}
117
-                        open={openMov}
118
-                        onClose={handleCloseMov}
119
-                        MenuListProps={{
120
-                            'aria-labelledby': 'basic-button',
121
-                        }}>
122
-                        <MenuItem onClick={ () => navigate('/perfil') }>Perfil</MenuItem>
123
-                        <MenuItem onClick={handleCloseMov}>My account</MenuItem>
124
-                        <MenuItem onClick={handleCloseMov}>Logout</MenuItem>
125
-                    </Menu>
126
-
127
-                </div>
128
-
129
-                <Typography component="h1" variant="h6" color="inherit" noWrap sx={{ flexGrow: 1 }} >
130
-                    {
131
-                        !useCheckMobileScreen() && open ? (
132
-                            <React.Fragment>
133
-
134
-                                <IconButton onClick={toggleDrawer}>
135
-                                    <MenuIcon />
136
-                                </IconButton>
137
-
138
-                                <IconButton onClick={ (event) =>  event.target.requestFullscreen() }>
139
-                                    <FullscreenIcon style={{ paddinLeft : 15 }}/>
140
-                                </IconButton>
141
-
142
-
143
-                            </React.Fragment>
144
-                        ) : undefined
145
-                    }
146
-                </Typography>
147
-
148
-
149
-                <Box sx={{ display: { xs: 'none', md: 'flex' } }}>
150
-                    <IconButton size="large" aria-label="show 4 new mails" color="inherit">
151
-                        <Badge badgeContent={4} color="error">
152
-                            <MailIcon style={{ color : '#212529' }} />
153
-                        </Badge>
154
-                    </IconButton>
155
-                    <IconButton
156
-                        size="large"
157
-                        aria-label="show 17 new notifications"
158
-                        color="inherit">
159
-                        <Badge badgeContent={17} color="error">
160
-                            <NotificationsIcon style={{ color : '#212529' }}/>
161
-                        </Badge>
162
-                    </IconButton>
163
-
164
-
165
-                    <IconButton
166
-                        size="small"
167
-                        edge="end"
168
-                        aria-label="account of current user"
169
-                        aria-haspopup="true"
170
-                        aria-expanded={open_profile ? 'true' : undefined}
171
-                        onClick={handleClick}
172
-                        color="inherit"
173
-                    >
174
-                        <Avatar alt="Cindy Baker" src={ProfilePicture} />
175
-
176
-                    </IconButton>
177
-                    <Menu
178
-                        id="basic-menu"
179
-                        anchorEl={anchorEl}
180
-                        open={open_profile}
181
-                        onClose={handleClose}
182
-                        MenuListProps={{ 'aria-labelledby': 'basic-button', }}>
183
-                        <MenuItem onClick={() => navigate('perfil') }>Profile</MenuItem>
184
-                        <MenuItem onClick={() => console.log('opcion 2')}>My account</MenuItem>
185
-                        <MenuItem onClick={CerrarSession}>Logout</MenuItem>
186
-                    </Menu>
187
-
188
-                </Box>
189
-
190
-            </Toolbar>
191
-        </AppBar>
192
-    )
193
-}

+ 12 - 22
src/Components/Dashboard.js

@@ -1,26 +1,27 @@
1 1
 import React from 'react';
2
-import {createTheme, ThemeProvider } from '@mui/material/styles';
3
-
4
-import { MainListItems, secondaryListItems } from './listItems';
2
+import { ThemeProvider } from '@mui/material/styles';
5 3
 import { 
6 4
     Menu,MenuItem,Container,Avatar, Badge,IconButton,Divider,
7
-    Typography, List, Toolbar, Box, CssBaseline,useMediaQuery as Size
5
+    Typography, List, Toolbar, Box, CssBaseline,useMediaQuery as Size,
8 6
 } from '@mui/material'
9 7
 import {
10 8
     Mail as MailIcon, Notifications as NotificationsIcon, Fullscreen as FullscreenIcon,
11 9
     Menu as MenuIcon,
12 10
 } from '@mui/icons-material'
13 11
 
12
+import useAuth from '../Auth/useAuth';
13
+
14 14
 import Logo from '../Images/logo.png';
15 15
 import ProfilePicture from '../Images/man.png';
16 16
 
17
-import useAuth from '../Auth/useAuth';
17
+
18 18
 import { Outlet, useNavigate} from "react-router-dom";
19 19
 import { MenuMovil } from '../Components/Navigation/MenuMovil';
20 20
 import Footer from "../Components/Footer";
21
-import { Drawer, AppBar } from "../Components/Navigation/AppBar"
22 21
 
23
-const mdTheme = createTheme();
22
+import { mdTheme } from '../Utils/theme'
23
+import { Drawer, AppBar } from "../Components/Navigation/AppBar"
24
+import { MainListItems, SecondaryListItems } from '../Components/Navigation/listItems';
24 25
 
25 26
 function DashboardContent() {
26 27
 
@@ -72,16 +73,12 @@ function DashboardContent() {
72 73
                             {
73 74
                             !isMovil && open ? (
74 75
                                 <React.Fragment>
75
-
76 76
                                     <IconButton onClick={toggleDrawer}>
77 77
                                         <MenuIcon />
78 78
                                     </IconButton>
79
-
80 79
                                     <IconButton onClick={ (event) =>  event.target.requestFullscreen() }>
81 80
                                         <FullscreenIcon style={{ paddinLeft : 15 }}/>
82 81
                                     </IconButton>
83
-
84
-
85 82
                                 </React.Fragment>
86 83
                             ) : undefined
87 84
                         }
@@ -111,10 +108,8 @@ function DashboardContent() {
111 108
                                 aria-haspopup="true"
112 109
                                 aria-expanded={open_profile ? 'true' : undefined}
113 110
                                 onClick={handleClick}
114
-                                color="inherit"
115
-                            >
116
-                                <Avatar alt="Cindy Baker" src={ProfilePicture} />
117
-
111
+                                color="inherit" >
112
+                            <Avatar alt="profile picture" src={ProfilePicture} />
118 113
                             </IconButton>
119 114
                             <Menu
120 115
                                 id="basic-menu"
@@ -126,9 +121,7 @@ function DashboardContent() {
126 121
                                 <MenuItem onClick={() => console.log('opcion 2')}>My account</MenuItem>
127 122
                                 <MenuItem onClick={CerrarSession}>Logout</MenuItem>
128 123
                             </Menu>
129
-
130 124
                         </Box>
131
-
132 125
                     </Toolbar>
133 126
                 </AppBar>
134 127
                 <Drawer variant="permanent" open={open}>
@@ -137,16 +130,13 @@ function DashboardContent() {
137 130
                             display: 'flex',
138 131
                             alignItems: 'center',
139 132
                             justifyContent: 'flex-start',
140
-                            px: [1],
141
-
133
+                            px: [1]
142 134
                         }} >
143
-
144 135
                         <div style={{ flat : 'righ' }} className="sidebar-header">
145 136
                             <div className="width_img">
146 137
                                 <img src={Logo} alt="pruebas psicometricas"/>
147 138
                             </div>
148 139
                         </div>
149
-
150 140
                     </Toolbar>
151 141
                     <Divider />
152 142
                     <List>
@@ -154,7 +144,7 @@ function DashboardContent() {
154 144
                     </List>
155 145
                     <Divider />
156 146
                     <List>
157
-                        {secondaryListItems}
147
+                        {SecondaryListItems}
158 148
                     </List>
159 149
                 </Drawer>
160 150
                 <Container maxWidth="lg" sx={{ mt: 2 , mb: 2 }}>

+ 0 - 42
src/Components/MenuMovilList.js

@@ -1,42 +0,0 @@
1
-import Logo from '../Images/logo.png';
2
-import Fade from '@mui/material/Fade';
3
-
4
-import {
5
-    Home, Work,VisibilityOff,PeopleAlt, Equalizer
6
-} from '@mui/icons-material/'
7
-
8
-
9
-import { NavItem} from '../Components/Navigation/NavItem'
10
-import { BottomNav }  from '../Components/Navigation/BottomNavigation'
11
-
12
-
13
-export function MenuMovil(props) {
14
-
15
-    let { open } =  props;
16
-
17
-    return(
18
-        <Fade 
19
-            in={open}>
20
-            <div className="menu-shit w3-sidebar w3-bar-block w3-border-right" id="mySidebar">
21
-                <div style={{ flat : 'righ' }} className="sidebar-header">
22
-                    <div className="width_img_mov">
23
-                        <img src={Logo} alt="pruebas psicometricas"/>
24
-                    </div>
25
-                </div>
26
-                <NavItem icon={<Home/>} title="Inicio" route="home" />
27
-                <NavItem icon={<Work/>} title="Puestos" route="puestos" />
28
-                <NavItem icon={<VisibilityOff/>} title="Contraseñas" route="contrasenas" />
29
-                <NavItem icon={<PeopleAlt/>}  title="Expedientes" route="expedientes" />
30
-                <NavItem icon={<Equalizer/>} title="Resultados" route="resultados" />
31
-                <NavItem icon={<Equalizer/>} title="Resultados" route="resultados" />
32
-                <NavItem icon={<Equalizer/>} title="Resultados" route="resultados" />
33
-                <NavItem icon={<Equalizer/>} title="Resultados" route="resultados" />
34
-                <NavItem icon={<Equalizer/>} title="Resultados" route="resultados" />
35
-                <NavItem icon={<Equalizer/>} title="Resultados" route="resultados" />
36
-                <NavItem icon={<Equalizer/>} title="Resultados" route="resultados" />
37
-                <BottomNav/>
38
-            </div>
39
-        </Fade>
40
-    )
41
-
42
-}

+ 5 - 50
src/Components/Navigation/MenuMovil.jsx

@@ -1,65 +1,20 @@
1 1
 import * as React from 'react';
2
-import Box from '@mui/material/Box';
3
-import Drawer from '@mui/material/Drawer';
4
-import List from '@mui/material/List';
5
-import Divider from '@mui/material/Divider';
6
-import ListItem from '@mui/material/ListItem';
7
-import ListItemButton from '@mui/material/ListItemButton';
8
-import ListItemIcon from '@mui/material/ListItemIcon';
9
-import ListItemText from '@mui/material/ListItemText';
10
-import InboxIcon from '@mui/icons-material/MoveToInbox';
11
-import MailIcon from '@mui/icons-material/Mail';
12
-
13
-// import { MovilList } from './MovilList'
14
-let items = ['uno', 'dos', 'tres', 'cuatro', 'cinco','Inbox', 'Starred', 'Send email', 'Drafts','uno', 'dos', 'tres', 'cuatro', 'cinco','Inbox', 'Starred', 'Send email', 'Drafts']
15
-
16 2
 
3
+import Drawer from '@mui/material/Drawer';
4
+import { MainListItems } from './MainListItems'
17 5
 
18 6
 export function MenuMovil(props) {
19 7
 
20 8
     let { anchor } = props;
21
-
22
-    const list = (anchor) => (
23
-        <Box
24
-            sx={{ width: anchor === 'top' || anchor === 'bottom' ? 'auto' : 250 }}
25
-            role="presentation"
26
-        >
27
-            <List>
28
-                {items.map((text, index) => (
29
-                    <ListItem key={text} disablePadding>
30
-                        <ListItemButton>
31
-                            <ListItemIcon>
32
-                                {index % 2 === 0 ? <InboxIcon /> : <MailIcon />}
33
-                            </ListItemIcon>
34
-                            <ListItemText primary={text} />
35
-                        </ListItemButton>
36
-                    </ListItem>
37
-                ))}
38
-            </List>
39
-            <Divider />
40
-            <List>
41
-                {['All mail', 'Trash', 'Spam'].map((text, index) => (
42
-                    <ListItem key={text} disablePadding>
43
-                        <ListItemButton>
44
-                            <ListItemIcon>
45
-                                {index % 2 === 0 ? <InboxIcon /> : <MailIcon />}
46
-                            </ListItemIcon>
47
-                            <ListItemText primary={text} />
48
-                        </ListItemButton>
49
-                    </ListItem>
50
-                ))}
51
-            </List>
52
-        </Box>
53
-    );
54
-
55
-
56 9
     return (
57 10
         <div>
58 11
             <React.Fragment >
59 12
                 <Drawer
60 13
                     anchor="left"
61 14
                     open={anchor} >
62
-                    {list("left")}
15
+                    <div  style={{ paddingTop : 15}}>
16
+                        <MainListItems/>
17
+                    </div>
63 18
                 </Drawer>
64 19
             </React.Fragment>
65 20
         </div>

+ 1 - 1
src/Components/listItems.js

@@ -110,7 +110,7 @@ export const MainListItems = (props) =>  {
110 110
     )
111 111
 };
112 112
 
113
-export const secondaryListItems = (
113
+export const SecondaryListItems = (
114 114
     <Nav>
115 115
         <ListSubheader inset>EXTRAS</ListSubheader>
116 116
         <NavItem icon={<Star/>} title="Elementos" route="/work" />

+ 1 - 0
src/Pages/Login.jsx

@@ -63,6 +63,7 @@ export function Login() {
63 63
                 token = token.replace("Bearer ", "")
64 64
                     console.log(token);
65 65
                 let user_permissions = jwt_decode(token);
66
+                    console.log(user_permissions)
66 67
                 Object.keys(user_permissions);
67 68
                 // console.log("Bearer ", token)
68 69
                 setTimeout( () => {

+ 1 - 1
src/Pages/PruebaAsignar.jsx

@@ -1,7 +1,7 @@
1 1
 import React, { useEffect , useState} from 'react'
2 2
 import {Col, Row } from 'react-bootstrap'
3 3
 import $ from 'jquery'
4
-import { inteligencia, comportamiento, personalidad } from '../Components/TipoTest'
4
+import { inteligencia, comportamiento, personalidad } from '../Utils/TipoTest'
5 5
 import AyudaAsignarModal, { ShowComportamiento, ShowPersonalidad, ShowInteligencia } from '../Components/Modal/AyudaAsignar'
6 6
 
7 7
 function* idMaker() {

+ 1 - 1
src/Pages/Pruebas.jsx

@@ -5,7 +5,7 @@ import RemoveRedEyeIcon from '@mui/icons-material/RemoveRedEye';
5 5
 import EditIcon from '@mui/icons-material/Edit';
6 6
 
7 7
 import { useNavigate } from 'react-router-dom'
8
-import { inteligencia, comportamiento, personalidad } from '../Components/TipoTest'
8
+import { inteligencia, comportamiento, personalidad } from '../Utils/TipoTest'
9 9
 
10 10
 function Pagination () {
11 11
     return(

src/Components/TipoTest.js → src/Utils/TipoTest.js


+ 10 - 0
src/Utils/theme.js

@@ -0,0 +1,10 @@
1
+import { createTheme } from '@mui/material/styles';
2
+import { colors } from '@mui/material'
3
+
4
+export const mdTheme = createTheme({
5
+    palette: {
6
+        primary: {
7
+            main: colors.red[500],
8
+        },
9
+    },
10
+});