added skeleton

This commit is contained in:
2025-12-09 17:00:41 -06:00
parent 96bb970d81
commit d8e37b5475
6 changed files with 56 additions and 38 deletions
+18
View File
@@ -108,3 +108,21 @@ select {
top: 8px !important;
}
}
.skeleton {
background: linear-gradient(90deg, #e0e0e0 0%, #f5f5f5 50%, #e0e0e0 100%);
background-size: 200% 100%;
animation: shimmer 1.5s infinite;
border-radius: 8px;
height: 32px;
width: 100%;
}
@keyframes shimmer {
0% {
background-position: -200% 0;
}
100% {
background-position: 200% 0;
}
}
+33 -20
View File
@@ -24,7 +24,7 @@ const USO_INDEX: Record<string, number> = {
const CATEGORIA_MAP: Record<string, { tabla: number }> = {
"ESCRITORIO PC": { tabla: 0 },
"ESCRITORIO MAC OS": { tabla: 0 },
"ESCRITORIO MAC OS ": { tabla: 0 }, // tiene espacio al final
"ESCRITORIO MAC OS ": { tabla: 0 },
"ESCRITORIO LINUX": { tabla: 0 },
@@ -61,7 +61,6 @@ function normalizarSO(soRaw: string): string {
if (so.includes("CHROME")) return "Chrome OS";
if (so.includes("IOS") || so.includes("IPAD")) return "iPad OS";
// Servidores
if (so.includes("SERVER") || so.includes("UNIX")) return "Servidor";
return "Otro";
@@ -80,6 +79,7 @@ export default function Pregunta1() {
const [loading, setLoading] = useState(true);
const cargarDatos = async (baja: boolean) => {
setLoading(true);
const token = Cookies.get("token");
if (!token) {
console.error("Token no encontrado");
@@ -109,9 +109,8 @@ export default function Pregunta1() {
let soIndex = -1;
// 🟦 Caso especial: SERVIDOR → siempre a la fila "Servidor"
if (tabla === 3) {
soIndex = 0; // único SO disponible en SISTEMAS_POR_TABLA[3]
soIndex = 0;
} else {
const soNormalizado = normalizarSO(item.sistema_operativo);
soIndex = SISTEMAS_POR_TABLA[tabla].indexOf(soNormalizado);
@@ -123,7 +122,6 @@ export default function Pregunta1() {
const total = parseInt(item.total) || 0;
// 🔥 Corrección importante → SUMAR, no reemplazar
nuevaTablas[tabla][soIndex][usoIndex] += total;
}
@@ -141,7 +139,7 @@ export default function Pregunta1() {
const datosSO = tablas[tablaIndex];
const totalesColumnas = Array(5).fill(0);
for (let soIndex = 0; soIndex < 3; soIndex++) {
for (let soIndex = 0; soIndex < datosSO.length; soIndex++) {
for (let col = 0; col < 5; col++) {
totalesColumnas[col] += datosSO[soIndex][col];
}
@@ -176,12 +174,24 @@ export default function Pregunta1() {
<td>{so}</td>
{valores.map((valor, colIndex) => (
<td key={colIndex}>
<div className={style["input-contenedor"]}>
<input type="number" value={valor} readOnly />
<div
className={`${style["input-contenedor"]} ${
loading ? "skeleton" : ""
}`}
>
{!loading ? (
<input type="number" value={valor} readOnly />
) : (
" "
)}
</div>
</td>
))}
<td className={style["total-celda"]}>{totalFila}</td>
<td className={style["total-celda"]}>
<div className={loading ? "skeleton" : ""}>
{!loading && totalFila}
</div>
</td>
</tr>
);
})}
@@ -189,9 +199,21 @@ export default function Pregunta1() {
<tr className={style["fila-total"]}>
<td>Total</td>
{totalesColumnas.map((t, i) => (
<td key={i}>{t}</td>
<td key={i}>
<div
className={`${style["input-contenedor"]} ${
loading ? "skeleton" : ""
}`}
>
{!loading && t}
</div>
</td>
))}
<td className={style["total-celda"]}>{totalGeneral}</td>
<td className={style["total-celda"]}>
<div className={loading ? "skeleton" : ""}>
{!loading && totalGeneral}
</div>
</td>
</tr>
</tbody>
</table>
@@ -199,15 +221,6 @@ export default function Pregunta1() {
);
};
if (loading) {
return (
<div className={style["contenedor-pregunta"]}>
<div className={style["contenedor-censo"]}>Censo de equipos</div>
<div className={style["pregunta-cuadro"]}>Cargando datos...</div>
</div>
);
}
return (
<div className={style["contenedor-pregunta"]}>
<div className={style["contenedor-censo"]}>
+2 -2
View File
@@ -43,7 +43,7 @@ const PLATFORM_OS_LIST: Record<PlatformKey, string[]> = {
],
"apple-desktop": [
"MAC OS (SEQUOIA)",
"MAC OS(15 - Sequoia)",
"Mac OS (13 - Ventura, 14 - Sonoma)",
"Mac OS X (Mojave, Catalina, 11 - Big Sur, 12 - Monterrey)",
"Mac OS X (Snow Leopard, Lion, Mountain Lion, Mavericks)",
@@ -205,7 +205,7 @@ export default function Pregunta2() {
<div className={styles["os-name_P1"]}>{item.os}</div>
<div
className={`${styles["count-box_P1"]} ${
loading ? styles.skeleton : ""
loading ? "skeleton" : ""
}`}
>
{loading ? " " : item.count}
@@ -74,6 +74,7 @@
display: flex;
justify-content: center;
align-items: center;
height: 32px;
input {
width: 100%;
@@ -138,7 +138,7 @@
text-align: center;
border-radius: 5px;
min-height: 33px;
min-width: 70px;
width: 70px;
}
.total-row_P1 {
@@ -151,21 +151,6 @@
}
}
.skeleton {
background: linear-gradient(90deg,
#e0e0e0 0%,
#f5f5f5 50%,
#e0e0e0 100%);
background-size: 200% 100%;
animation: shimmer 1.5s infinite;
border-radius: 8px;
}
@keyframes shimmer {
0% { background-position: -200% 0; }
100% { background-position: 200% 0; }
}
@media (max-width: 700px) {
.scanView_P1 .tabs_P1 {
width: 160px;
+1
View File
@@ -61,6 +61,7 @@ export const PROCESADORES_POR_EQUIPO: Record<
{ id_procesador: 8, procesador: "i5 o equivalentes (1a - 4a generación)" },
{ id_procesador: 12, procesador: "i3 o equivalentes (1a - 4a generación)" },
{ id_procesador: 22, procesador: "Core2 Mac, Quad Core o anteriores" },
{ id_procesador: 22, procesador: "MAC OS(15 - Sequoia)" },
],
/*"ESCRITORIO LINUX"*/ 3: [
{