瀏覽代碼

preview and store token

amenpunk 3 年之前
父節點
當前提交
6b1ce6dd20
共有 3 個文件被更改,包括 26 次插入15 次删除
  1. 17 0
      src/Components/Home/Candidato.jsx
  2. 8 14
      src/Components/Home/Candidatos.js
  3. 1 1
      src/Pages/Login.jsx

+ 17 - 0
src/Components/Home/Candidato.jsx

@@ -1,4 +1,6 @@
1
+import { Skeleton, Box } from '@mui/material';
1 2
 import React from 'react'
3
+const big_as = 40
2 4
 
3 5
 export function Candidato (props) {
4 6
     let { password,puesto,DPI, aplicacion,pendientes } = props.user
@@ -25,3 +27,18 @@ export function Candidato (props) {
25 27
         </div>
26 28
     )
27 29
 }
30
+
31
+export function Preview() {
32
+    return(
33
+        <Box sx={{ width: '100%' }}>
34
+            <Skeleton height={big_as} animation="wave" />
35
+            <Skeleton height={big_as} animation="wave" />
36
+            <Skeleton height={big_as} animation="wave" />
37
+            <Skeleton height={big_as} animation="wave" />
38
+            <Skeleton height={big_as} animation="wave" />
39
+            <Skeleton height={big_as} animation="wave" />
40
+            <Skeleton height={big_as} animation="wave" />
41
+            <Skeleton height={big_as} animation="wave" />
42
+        </Box>
43
+    )
44
+}

+ 8 - 14
src/Components/Home/Candidatos.js

@@ -3,18 +3,19 @@ import React, { useState, useEffect } from 'react';
3 3
 import UpdateIcon from '@mui/icons-material/Update';
4 4
 
5 5
 import {
6
-    Typography, Pagination, Stack, CircularProgress, Box
6
+    Typography, Pagination, Stack, 
7
+    // CircularProgress, Box
7 8
 } from '@mui/material'
8 9
 
9 10
 import { Row, Col } from 'react-bootstrap';
10 11
 
11
-import { Candidato } from './Candidato'
12
+import { Candidato, Preview } from './Candidato'
12 13
 // const USER_LENGTH = 14
13
-const USER_LENGTH = 99
14
+const USER_LENGTH = 120
14 15
 
15 16
 
16 17
 function Divide(arregloOriginal){
17
-    const LONGITUD_PEDAZOS = 10;
18
+    const LONGITUD_PEDAZOS = 6;
18 19
     let arregloDeArreglos = [];
19 20
     for (let i = 0; i < arregloOriginal.length; i += LONGITUD_PEDAZOS) {
20 21
         let pedazo = arregloOriginal.slice(i, i + LONGITUD_PEDAZOS);
@@ -39,8 +40,6 @@ export default function Candidatos () {
39 40
     useEffect(() => {
40 41
 
41 42
         setTimeout(() => {
42
-
43
-
44 43
             let list =  [{
45 44
                 password : 'tester',
46 45
                 puesto : "Piloto Repartidor",
@@ -93,14 +92,9 @@ export default function Candidatos () {
93 92
                     </Row>
94 93
                 </div>
95 94
                 {
96
-                    users.length ?
97
-                    users[page - 1].map( user => (<Candidato key={user.DPI} user={user}/>)) 
98
-                    : 
99
-                        <center>
100
-                            <Box sx={{ display: 'flex', padding : '5%',  maginTop : 100,  }}> 
101
-                                <CircularProgress /> 
102
-                            </Box>
103
-                        </center>
95
+                    users.length 
96
+                    ? users[page - 1].map( user => (<Candidato key={user.DPI} user={user}/>)) 
97
+                    : <Preview lenght={10}/>
104 98
                 }
105 99
                 <Row style={{ padding : 5 }}>
106 100
                     <Col>

+ 1 - 1
src/Pages/Login.jsx

@@ -1,6 +1,6 @@
1 1
 import * as React from 'react';
2 2
 import toast, { Toaster } from 'react-hot-toast';
3
-import jwt_decode from "jwt-decode";
3
+// import jwt_decode from "jwt-decode";
4 4
 
5 5
 import { 
6 6
     Paper, Box, Grid, Checkbox, FormControlLabel, Typography,