Rediseño visual de checada.html (piel cream) sobre theme.js
Reconstruye la pantalla de checada con el lenguaje visual del diseño
(paleta crema, tipografías Bricolage Grotesque/Figtree, íconos de línea,
logo de la Fundación) sin tocar la lógica ni el cableado al backend.
theme.js:
- Nuevo set "cream" (Logo, IconBadge, Card, Btn, Input, Aviso, Estado)
que devuelve makeUI("checada"); añade paleta CREAM, fuentes de marca e
íconos SVG (nfc, amanecer, luna, check, reloj, refresh, candado…).
- El camino panel/becario queda intacto (misma API COLORS/FONT); la
fidelidad de estilos de esos dos flavors no cambia.
checada.html:
- Migra la vista a los componentes cream; Estado pasa de emoji a
icon+tone. Los 13 estados del inventario se conservan y cada uno sigue
disparándose por su MISMO code/parámetro (cerrado, TOKEN_*,
BECARIO_NO_ACTIVO, CONFLICTO_TIPO, duplicada…). Endpoints, campos
(t/tipo/concepto), toggle entrada/salida, gate de concepto y link a
becario.html sin cambios. Sin marcos de iPhone ni barra de estado.
logo-taboada.png: logo de marca servido same-origin.
Dockerfile: hornea el logo en la imagen de producción.
This commit is contained in:
1 parent
743440968b
commit
ee265c15e8
4 files changed
+231
-42
No files matched your search
+2
-2
@@ -21,8 +21,8 @@ COPY --chown=node:node backend/src ./src
|
||||
# stat/leer los archivos; copiar con `--chmod=644 … /dir/` deja el propio
|
||||
# directorio en 0644 y nginx falla con "Permission denied". Por eso se fijan
|
||||
# los permisos explícitamente después del COPY.
|
||||
COPY frontend/checada.html frontend/panel.html frontend/becario.html frontend/theme.js /usr/share/nginx/html/
|
||||
RUN chmod 755 /usr/share/nginx/html && chmod 644 /usr/share/nginx/html/*.html
|
||||
COPY frontend/checada.html frontend/panel.html frontend/becario.html frontend/theme.js frontend/logo-taboada.png /usr/share/nginx/html/
|
||||
RUN chmod 755 /usr/share/nginx/html && chmod 644 /usr/share/nginx/html/*
|
||||
COPY --chmod=644 backend/nginx-default.conf /etc/nginx/http.d/default.conf
|
||||
COPY --chmod=755 backend/docker-entrypoint.sh /docker-entrypoint.sh
|
||||
|
||||
|
||||
+76
-40
@@ -4,20 +4,32 @@
|
||||
<meta charset="UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<title>Taboada — Checada</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com"/>
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,700&family=Figtree:wght@400;500;600;700&display=swap" rel="stylesheet"/>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/18.2.0/umd/react.production.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/18.2.0/umd/react-dom.production.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/7.23.2/babel.min.js"></script>
|
||||
<script src="theme.js"></script>
|
||||
<style>
|
||||
* { box-sizing: border-box; }
|
||||
html, body { margin: 0; padding: 0; }
|
||||
body { background: #F3EBDD; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
|
||||
input::placeholder { color: #B4A99A; }
|
||||
@keyframes tb-spin { to { transform: rotate(360deg); } }
|
||||
</style>
|
||||
</head>
|
||||
<body style="margin:0;padding:0;">
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="text/babel" data-presets="react">
|
||||
const { useState, useEffect } = React;
|
||||
|
||||
// Base visual compartida (theme.js), ligada al flavor 'checada'.
|
||||
const { COLORS, FONT, SPACE, RADIUS, makeUI } = Theme;
|
||||
const { Btn, Card, Input, Badge, Field, Estado } = makeUI("checada");
|
||||
// Piel visual "cream" del rediseño, servida por theme.js para el flavor 'checada'.
|
||||
// Colores, tipografías e íconos viven en theme.js — aquí no hay estilos sueltos.
|
||||
const UI = Theme.makeUI("checada");
|
||||
const { Logo, IconBadge, Card, Btn, Input, Aviso, Estado, palette, fonts, icons } = UI;
|
||||
|
||||
// ─────────────────── Cableado al backend (SIN cambios) ───────────────────
|
||||
const API_BASE = `${window.location.origin}/api`;
|
||||
async function apiFetch(path, options = {}) {
|
||||
const res = await fetch(`${API_BASE}${path}`, {
|
||||
@@ -36,13 +48,31 @@ async function apiFetch(path, options = {}) {
|
||||
|
||||
const fmtHoras = (h) => `${(h ?? 0).toLocaleString("es-MX", { maximumFractionDigits: 1 })} h`;
|
||||
const fmtHM = (iso) => (iso ? new Date(iso).toLocaleTimeString("es-MX", { timeZone: "America/Mexico_City", hour: "2-digit", minute: "2-digit" }) : "");
|
||||
// Porcentaje para la barra de avance (usa el del backend; si falta, lo deriva).
|
||||
const pctDe = (a) => (typeof a?.porcentaje === "number" ? a.porcentaje : (a?.meta_horas ? Math.round((a.total_horas / a.meta_horas) * 100) : 0));
|
||||
|
||||
// ─────────────────── Piezas visuales locales ───────────────────
|
||||
const Shell = ({ children }) => (
|
||||
<div style={{ minHeight: "100vh", background: COLORS.bg, display: "flex", alignItems: "center", justifyContent: "center", padding: "20px", fontFamily: FONT }}>
|
||||
<div style={{ width: "100%", maxWidth: "400px" }}>{children}</div>
|
||||
<div style={{ minHeight: "100vh", background: palette.bgGradient, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", padding: "28px 20px", fontFamily: fonts.body }}>
|
||||
<div style={{ width: "100%", maxWidth: "420px" }}>
|
||||
<div style={{ display: "flex", justifyContent: "center", marginBottom: "22px" }}>
|
||||
<Logo style={{ height: "72px" }} />
|
||||
</div>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
// ═══════════════ Login inline (para no perder el token de la URL) ═══════════════
|
||||
|
||||
const Cargando = ({ texto = "Cargando…" }) => (
|
||||
<Card style={{ textAlign: "center" }}>
|
||||
<div style={{ display: "flex", flexDirection: "column", alignItems: "center", gap: "12px" }}>
|
||||
<span style={{ display: "inline-flex" }}>{icons.spinner({ size: 24, color: palette.primary, track: palette.line })}</span>
|
||||
<span style={{ fontFamily: fonts.body, fontSize: "14px", color: palette.inkSoft }}>{texto}</span>
|
||||
</div>
|
||||
</Card>
|
||||
);
|
||||
|
||||
// ═══════════════ A3 · Login inline (para no perder el token de la URL) ═══════════════
|
||||
function LoginInline({ onEntra }) {
|
||||
const [f, setF] = useState({ telefono: "", password: "" });
|
||||
const [error, setError] = useState(null);
|
||||
@@ -53,14 +83,17 @@ function LoginInline({ onEntra }) {
|
||||
await apiFetch("/becario/login", { method: "POST", body: JSON.stringify(f) });
|
||||
onEntra(await apiFetch("/becario/session"));
|
||||
} catch (err) {
|
||||
setError(err.status === 429 ? "Demasiados intentos, espera un minuto." : "Número o contraseña incorrectos.");
|
||||
// Mismo mapeo de siempre: 429 vs credenciales; el ícono sólo acompaña.
|
||||
setError(err.status === 429
|
||||
? { text: "Demasiados intentos, espera un minuto.", ic: "clock" }
|
||||
: { text: "Número o contraseña incorrectos.", ic: "alertCircle" });
|
||||
} finally { setBusy(false); }
|
||||
};
|
||||
return (
|
||||
<Card>
|
||||
<h2 style={{ margin: "0 0 4px", color: COLORS.ink, fontSize: "20px", textAlign: "center" }}>Inicia sesión para checar</h2>
|
||||
<p style={{ margin: "0 0 18px", color: COLORS.inkSoft, fontSize: "13px", textAlign: "center" }}>Tu código sigue activo unos minutos.</p>
|
||||
{error && <div style={{ background: COLORS.dangerBg, color: COLORS.danger, padding: "10px", borderRadius: "10px", fontSize: "14px", marginBottom: "12px" }}>⚠ {error}</div>}
|
||||
<h2 style={{ margin: "0 0 4px", fontFamily: fonts.title, fontWeight: 600, letterSpacing: "-.01em", color: palette.ink, fontSize: "22px", textAlign: "center" }}>Inicia sesión para checar</h2>
|
||||
<p style={{ margin: "0 0 18px", fontFamily: fonts.body, color: palette.inkSoft, fontSize: "13px", textAlign: "center" }}>Tu código sigue activo unos minutos.</p>
|
||||
{error && <Aviso variant="error" icon={error.ic}>{error.text}</Aviso>}
|
||||
<form onSubmit={submit}>
|
||||
<div style={{ marginBottom: "12px" }}>
|
||||
<Input placeholder="Celular (10 dígitos)" inputMode="numeric" value={f.telefono} onChange={(e) => setF({ ...f, telefono: e.target.value.replace(/\D/g, "").slice(0, 10) })} required />
|
||||
@@ -68,10 +101,10 @@ function LoginInline({ onEntra }) {
|
||||
<div style={{ marginBottom: "16px" }}>
|
||||
<Input type="password" placeholder="Contraseña" value={f.password} onChange={(e) => setF({ ...f, password: e.target.value })} required />
|
||||
</div>
|
||||
<Btn type="submit" disabled={busy || f.telefono.length !== 10 || !f.password}>{busy ? "…" : "Entrar"}</Btn>
|
||||
<Btn type="submit" loading={busy} disabled={busy || f.telefono.length !== 10 || !f.password}>{busy ? "Entrando…" : "Entrar"}</Btn>
|
||||
</form>
|
||||
<p style={{ textAlign: "center", marginTop: "14px", marginBottom: 0, fontSize: "13px" }}>
|
||||
<a href="/becario.html" style={{ color: COLORS.primary }}>¿No tienes cuenta? Regístrate</a>
|
||||
<p style={{ textAlign: "center", marginTop: "16px", marginBottom: 0, fontSize: "13px", fontFamily: fonts.body }}>
|
||||
<a href="/becario.html" style={{ color: palette.primary, fontWeight: 600, textDecoration: "none" }}>¿No tienes cuenta? Regístrate</a>
|
||||
</p>
|
||||
</Card>
|
||||
);
|
||||
@@ -107,58 +140,61 @@ function Checar({ token }) {
|
||||
} finally { setBusy(false); }
|
||||
};
|
||||
|
||||
if (ctx === undefined) return <Card style={{ textAlign: "center", color: COLORS.inkSoft }}>Cargando…</Card>;
|
||||
if (ctx === undefined) return <Cargando />; // C1
|
||||
|
||||
// Errores de contexto / registro
|
||||
if (error && !resultado) {
|
||||
if (error.code === "BECARIO_NO_ACTIVO")
|
||||
return <Estado emoji="⏳" title="Cuenta pendiente" tone={COLORS.warn} sub="Tu cuenta aún no está aprobada; no puedes checar todavía. Avisa a la supervisora." />;
|
||||
if (error.code === "TOKEN_VENCIDO" || error.code === "TOKEN_INVALIDO")
|
||||
return <Estado emoji="⌛" title="El código expiró" tone={COLORS.warn} sub="Vuelve a acercar tu celular al chip para generar uno nuevo." />;
|
||||
if (error.code === "TOKEN_YA_USADO")
|
||||
return <Estado emoji="↩️" title="Código ya usado" sub="Ese código ya se utilizó. Acerca tu celular al chip de nuevo." />;
|
||||
if (error.code === "BECARIO_NO_ACTIVO") // C2
|
||||
return <Estado icon="hourglass" tone="amber" title="Cuenta pendiente" sub="Tu cuenta aún no está aprobada; no puedes checar todavía. Avisa a la supervisora." />;
|
||||
if (error.code === "TOKEN_VENCIDO" || error.code === "TOKEN_INVALIDO") // C3
|
||||
return <Estado icon="clock" tone="amber" title="El código expiró" sub="Vuelve a acercar tu celular al chip para generar uno nuevo." />;
|
||||
if (error.code === "TOKEN_YA_USADO") // C4 (informativo, no rojo)
|
||||
return <Estado icon="refresh" tone="blue" dashed title="Código ya usado" sub="Ese código ya se utilizó. Acerca tu celular al chip de nuevo." />;
|
||||
// CONFLICTO_TIPO cae aquí como aviso, pero seguimos mostrando el formulario abajo.
|
||||
if (error.code !== "CONFLICTO_TIPO")
|
||||
return <Estado emoji="⚠️" title="No se pudo registrar" tone={COLORS.danger} sub={error.message} />;
|
||||
if (error.code !== "CONFLICTO_TIPO") // C5 genérico
|
||||
return <Estado icon="alertCircle" tone="danger" title="No se pudo registrar" sub={error.message} />;
|
||||
}
|
||||
|
||||
if (resultado) {
|
||||
// Token de un solo uso ya consumido: no es error del becario, es lo correcto.
|
||||
// C6 · Token de un solo uso ya consumido: no es error del becario, es lo correcto.
|
||||
if (resultado.duplicada)
|
||||
return <Estado emoji="🔄" title="Este código ya se usó" tone={COLORS.primary}
|
||||
return <Estado icon="refresh" tone="blue" dashed title="Este código ya se usó"
|
||||
sub="Cada código del chip sirve una sola vez (así debe ser). Acerca de nuevo el celular al chip para registrar tu siguiente movimiento." />;
|
||||
// El título refleja el tipo REAL que aplicó el backend (toggle), no lo que
|
||||
// pulsó el becario — si hubo conflicto ya se reconfirmó antes de llegar aquí.
|
||||
const esEntrada = resultado.tipo === "entrada";
|
||||
const hora = fmtHM(resultado.ts);
|
||||
if (esEntrada)
|
||||
return <Estado emoji="🟢" title={`Entrada registrada${hora ? ` a las ${hora}` : ""}`} tone={COLORS.success}
|
||||
const pct = pctDe(resultado.acumulado);
|
||||
if (esEntrada) // C11
|
||||
return <Estado icon="check" tone="green" progress={pct} title={`Entrada registrada${hora ? ` a las ${hora}` : ""}`}
|
||||
sub={`Llevas ${fmtHoras(resultado.acumulado.total_horas)} de ${fmtHoras(resultado.acumulado.meta_horas)}. Cuando termines, vuelve a acercar el celular al chip para registrar tu salida.`} />;
|
||||
return <Estado emoji="🔴" title={`Salida registrada${hora ? ` a las ${hora}` : ""}`} tone={COLORS.success}
|
||||
return <Estado icon="check" tone="green" progress={pct} title={`Salida registrada${hora ? ` a las ${hora}` : ""}`} /* C12 */
|
||||
sub={`Jornada cerrada. Llevas ${fmtHoras(resultado.acumulado.total_horas)} de ${fmtHoras(resultado.acumulado.meta_horas)} (${resultado.acumulado.porcentaje}%).`} />;
|
||||
}
|
||||
|
||||
// C7 / C8 · Formulario de confirmación (amanecer=entrada, luna=salida)
|
||||
const esEntrada = ctx.tipo_sugerido === "entrada";
|
||||
return (
|
||||
<Card>
|
||||
<h2 style={{ margin: "0 0 4px", color: COLORS.ink, fontSize: "20px", textAlign: "center" }}>
|
||||
<IconBadge icon={esEntrada ? "sunrise" : "moon"} tone={esEntrada ? "green" : "blue"} />
|
||||
<h2 style={{ margin: "0 0 4px", fontFamily: fonts.title, fontWeight: 600, letterSpacing: "-.01em", color: palette.ink, fontSize: "22px", textAlign: "center" }}>
|
||||
Registrar {esEntrada ? "entrada" : "salida"}
|
||||
</h2>
|
||||
<p style={{ margin: "0 0 18px", color: COLORS.inkSoft, fontSize: "14px", textAlign: "center" }}>
|
||||
<p style={{ margin: "0 0 18px", fontFamily: fonts.body, color: palette.inkSoft, fontSize: "14px", textAlign: "center" }}>
|
||||
{esEntrada ? "Vas a abrir tu jornada." : "Vas a cerrar tu jornada abierta."}
|
||||
</p>
|
||||
{error && error.code === "CONFLICTO_TIPO" && (
|
||||
<div style={{ background: COLORS.warnBg, color: COLORS.warn, padding: "10px", borderRadius: "10px", fontSize: "13px", marginBottom: "12px" }}>
|
||||
{error && error.code === "CONFLICTO_TIPO" && ( /* C10 */
|
||||
<Aviso variant="warn" icon="alertTriangle">
|
||||
Ajustamos el registro a <strong>{ctx.tipo_sugerido}</strong> según tu jornada. Confirma.
|
||||
</div>
|
||||
</Aviso>
|
||||
)}
|
||||
{ctx.tarea_activa && (
|
||||
{ctx.tarea_activa && ( /* C9 */
|
||||
<div style={{ marginBottom: "16px" }}>
|
||||
<label style={{ display: "block", fontSize: "13px", fontWeight: 600, color: COLORS.inkSoft, marginBottom: "6px" }}>¿Qué tarea realizas? (obligatorio)</label>
|
||||
<label style={{ display: "block", fontFamily: fonts.body, fontSize: "13px", fontWeight: 600, color: palette.label, marginBottom: "6px" }}>¿Qué tarea realizas? (obligatorio)</label>
|
||||
<Input value={concepto} onChange={(e) => setConcepto(e.target.value)} placeholder="Describe la actividad" />
|
||||
</div>
|
||||
)}
|
||||
<Btn onClick={registrar} variant={esEntrada ? "success" : "primary"} disabled={busy || (ctx.tarea_activa && !concepto.trim())}>
|
||||
<Btn onClick={registrar} variant={esEntrada ? "success" : "primary"} loading={busy} disabled={busy || (ctx.tarea_activa && !concepto.trim())}>
|
||||
{busy ? "Registrando…" : `Confirmar ${esEntrada ? "entrada" : "salida"}`}
|
||||
</Btn>
|
||||
</Card>
|
||||
@@ -173,10 +209,10 @@ function App() {
|
||||
|
||||
useEffect(() => { apiFetch("/becario/session").then(setSession).catch(() => setSession(null)); }, []);
|
||||
|
||||
if (cerrado) return <Shell><Estado emoji="🚫" title="Checado cerrado" tone={COLORS.warn} sub="Estás fuera del horario permitido para checar. Intenta dentro de la ventana horaria." /></Shell>;
|
||||
if (session === undefined) return <Shell><Card style={{ textAlign: "center", color: COLORS.inkSoft }}>Cargando…</Card></Shell>;
|
||||
if (!session) return <Shell><LoginInline onEntra={setSession} /></Shell>;
|
||||
if (!token) return <Shell><Estado emoji="📲" title="Acerca tu celular al chip" sub="Para checar, escanea el chip NFC en la oficina de la supervisora." /></Shell>;
|
||||
if (cerrado) return <Shell><Estado icon="lock" tone="amber" title="Checado cerrado" sub="Estás fuera del horario permitido para checar. Intenta dentro de la ventana horaria." /></Shell>; // A2
|
||||
if (session === undefined) return <Shell><Cargando texto="Verificando sesión…" /></Shell>; // A1
|
||||
if (!session) return <Shell><LoginInline onEntra={setSession} /></Shell>; // A3
|
||||
if (!token) return <Shell><Estado icon="nfc" tone="blue" title="Acerca tu celular al chip" sub="Para checar, escanea el chip NFC en la oficina de la supervisora." /></Shell>; // A4
|
||||
return <Shell><Checar token={token} /></Shell>;
|
||||
}
|
||||
ReactDOM.createRoot(document.getElementById("root")).render(<App />);
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
@@ -26,6 +26,23 @@ window.Theme = (function () {
|
||||
var SPACE = { none: "0", xs: "4px", sm: "8px", md: "12px", lg: "16px", xl: "20px", "2xl": "24px", "3xl": "32px" };
|
||||
var RADIUS = { sm: "8px", md: "10px", lg: "12px", xl: "14px", "2xl": "16px", pill: "999px" };
|
||||
|
||||
// ── Rediseño de checada: paleta crema + fuentes de marca (flavor 'checada') ──
|
||||
// No afecta a panel/becario: sus componentes siguen usando COLORS/FONT.
|
||||
var CREAM = {
|
||||
bg: "#F3EBDD",
|
||||
bgGradient: "radial-gradient(120% 80% at 50% -10%, #FBF5EA 0%, #F3EBDD 55%, #EFE5D3 100%)",
|
||||
surface: "#FFFFFF", cardBorder: "#F0E8DA",
|
||||
ink: "#2E2A24", inkSoft: "#8A8175", label: "#6E6559", placeholder: "#B4A99A", line: "#E4D9C6",
|
||||
brand: "#16406B", primary: "#2E77B8", primaryDark: "#25689F",
|
||||
green: "#2F8A63", greenDark: "#287854", amber: "#B7791F", danger: "#C0392B",
|
||||
greenTint: "#E4F1E9", blueTint: "#E7F0F8", amberTint: "#FBF0DC", dangerTint: "#FBEBE8",
|
||||
errBg: "#FBEBE8", errBorder: "#F3D3CC", errText: "#B4362A",
|
||||
warnBg: "#FBF0DC", warnBorder: "#EFD9A8", warnText: "#8A5A12",
|
||||
inputBorder: "#ECE3D4", inputBg: "#FBF8F2", track: "#EDE4D5", dashed: "#C7DBEC",
|
||||
};
|
||||
var FONT_TITLE = "'Bricolage Grotesque', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif";
|
||||
var FONT_BODY = "'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif";
|
||||
|
||||
// Vocabulario de tonos de Badge, unión de los dos que usaban panel y becario.
|
||||
var TONES = {
|
||||
chip: { bg: COLORS.chip, color: COLORS.inkSoft },
|
||||
@@ -80,9 +97,145 @@ window.Theme = (function () {
|
||||
}
|
||||
}
|
||||
|
||||
// ── Íconos de línea del rediseño (name -> función(opts) -> <svg>) ──
|
||||
// opts: { size, color, sw (stroke-width), style }. Sin dependencias externas.
|
||||
function makeIcons(React) {
|
||||
var h = React.createElement;
|
||||
function ic(paths, o) {
|
||||
o = o || {};
|
||||
var kids = paths.map(function (p, i) { return h(p[0], Object.assign({ key: i }, p[1])); });
|
||||
return h("svg", {
|
||||
width: o.size || 28, height: o.size || 28, viewBox: "0 0 24 24", fill: "none",
|
||||
stroke: o.color || "currentColor", strokeWidth: o.sw || 1.7,
|
||||
strokeLinecap: "round", strokeLinejoin: "round", style: o.style,
|
||||
}, kids);
|
||||
}
|
||||
return {
|
||||
nfc: function (o) { return ic([["rect",{x:6,y:2.5,width:9,height:19,rx:2.5}],["path",{d:"M18 8a5 5 0 0 1 0 8"}],["path",{d:"M20.6 5.4a8.5 8.5 0 0 1 0 13.2"}]], o); },
|
||||
sunrise: function (o) { return ic([["path",{d:"M12 2.6v2.6"}],["path",{d:"M4.7 8 6.3 9.6"}],["path",{d:"M19.3 8 17.7 9.6"}],["path",{d:"M2.4 15h3"}],["path",{d:"M18.6 15h3"}],["path",{d:"M8 15a4 4 0 0 1 8 0"}],["path",{d:"M1.6 19h20.8"}]], o); },
|
||||
moon: function (o) { return ic([["path",{d:"M20 14.6A8 8 0 1 1 9.4 4a6.5 6.5 0 0 0 10.6 10.6z"}]], o); },
|
||||
check: function (o) { return ic([["path",{d:"M21.6 11.1V12a9.6 9.6 0 1 1-5.7-8.8"}],["path",{d:"M8.6 11.5 12 15l9.6-9.6"}]], o); },
|
||||
hourglass: function (o) { return ic([["path",{d:"M6.5 3h11"}],["path",{d:"M6.5 21h11"}],["path",{d:"M7.5 3v3.1a5 5 0 0 0 2.8 4.5L12 12l1.7-1.4A5 5 0 0 0 16.5 6.1V3"}],["path",{d:"M7.5 21v-3.1a5 5 0 0 1 2.8-4.5L12 12l1.7 1.4a5 5 0 0 1 2.5 4.5V21"}]], o); },
|
||||
clock: function (o) { return ic([["circle",{cx:12,cy:12,r:8.6}],["path",{d:"M12 7.2V12l3.2 2"}]], o); },
|
||||
refresh: function (o) { return ic([["path",{d:"M3.2 12a8.8 8.8 0 0 1 15.1-6.1L21 8"}],["path",{d:"M21 3.6V8h-4.4"}],["path",{d:"M20.8 12a8.8 8.8 0 0 1-15.1 6.1L3 16"}],["path",{d:"M3 20.4V16h4.4"}]], o); },
|
||||
lock: function (o) { o = o || {}; return ic([["rect",{x:4.5,y:10.5,width:15,height:10.5,rx:3}],["path",{d:"M8 10.5V7a4 4 0 0 1 8 0v3.5"}],["circle",{cx:12,cy:15.6,r:1.4,fill:o.color||"currentColor",stroke:"none"}]], o); },
|
||||
alertCircle: function (o) { return ic([["circle",{cx:12,cy:12,r:9.2}],["path",{d:"M12 7.6v5"}],["path",{d:"M12 16.2h.01"}]], o); },
|
||||
alertTriangle: function (o) { return ic([["path",{d:"M12 3 2.6 20h18.8L12 3z"}],["path",{d:"M12 9.6v4"}],["path",{d:"M12 17h.01"}]], o); },
|
||||
spinner: function (o) {
|
||||
o = o || {};
|
||||
return h("svg", { width: o.size || 18, height: o.size || 18, viewBox: "0 0 24 24", fill: "none",
|
||||
style: Object.assign({ animation: "tb-spin .8s linear infinite" }, o.style || {}) },
|
||||
[ h("circle", { key: 0, cx: 12, cy: 12, r: 9, stroke: o.track || "rgba(255,255,255,.35)", strokeWidth: 3 }),
|
||||
h("path", { key: 1, d: "M21 12a9 9 0 0 0-9-9", stroke: o.color || "#fff", strokeWidth: 3, strokeLinecap: "round" }) ]);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// ── Set de componentes "cream" para el flavor 'checada' (rediseño visual) ──
|
||||
// Devuelve su propia API (Logo, IconBadge, Card, Btn, Input, Aviso, Estado,
|
||||
// palette, fonts, icons). Independiente del camino panel/becario.
|
||||
function makeCream(React) {
|
||||
var h = React.createElement;
|
||||
var C = CREAM;
|
||||
var fonts = { title: FONT_TITLE, body: FONT_BODY };
|
||||
var icons = makeIcons(React);
|
||||
// tone (string) -> stroke del glifo, tinte del círculo, color del título.
|
||||
var STATE = {
|
||||
green: { stroke: C.green, tint: C.greenTint, title: C.green },
|
||||
blue: { stroke: C.primary, tint: C.blueTint, title: C.ink },
|
||||
amber: { stroke: C.amber, tint: C.amberTint, title: C.amber },
|
||||
danger: { stroke: C.danger, tint: C.dangerTint, title: C.danger },
|
||||
};
|
||||
|
||||
function Logo(props) {
|
||||
return h("img", { src: "logo-taboada.png", alt: "Fundación Taboada",
|
||||
style: Object.assign({ height: "64px", width: "auto", display: "block" }, (props && props.style) || {}) });
|
||||
}
|
||||
|
||||
function IconBadge(props) {
|
||||
var t = STATE[props.tone] || STATE.blue;
|
||||
var sz = props.size || 64;
|
||||
var glyph = icons[props.icon] ? icons[props.icon]({ color: t.stroke, size: Math.round(sz * 0.47), sw: 1.7 }) : null;
|
||||
return h("div", { style: { width: sz + "px", height: sz + "px", borderRadius: "50%", background: t.tint,
|
||||
display: "flex", alignItems: "center", justifyContent: "center", margin: "0 auto 16px" } }, glyph);
|
||||
}
|
||||
|
||||
function Card(props) {
|
||||
return h("div", { style: Object.assign({
|
||||
background: C.surface, border: "1px solid " + C.cardBorder, borderRadius: "26px",
|
||||
padding: "24px", boxShadow: "0 20px 44px -28px rgba(33,28,22,.35)",
|
||||
}, props.style || {}) }, props.children);
|
||||
}
|
||||
|
||||
function Btn(props) {
|
||||
var success = props.variant === "success";
|
||||
var bg = success ? C.green : C.primary;
|
||||
var shadow = success ? "0 12px 22px -10px rgba(47,138,99,.75)" : "0 12px 22px -10px rgba(46,119,184,.75)";
|
||||
var disabled = props.disabled;
|
||||
var style = {
|
||||
width: "100%", boxSizing: "border-box", padding: "15px", border: "none", borderRadius: "16px",
|
||||
background: disabled ? "#C6CFD8" : bg, color: disabled ? "#F4F8FC" : "#fff",
|
||||
fontFamily: fonts.body, fontSize: "15px", fontWeight: 700,
|
||||
cursor: disabled ? "not-allowed" : (props.loading ? "progress" : "pointer"),
|
||||
boxShadow: disabled ? "none" : shadow,
|
||||
display: "flex", alignItems: "center", justifyContent: "center", gap: "10px",
|
||||
};
|
||||
var kids = [];
|
||||
if (props.loading) kids.push(h("span", { key: "s", style: { display: "inline-flex" } }, icons.spinner({ size: 18 })));
|
||||
kids.push(h("span", { key: "t" }, props.children));
|
||||
return h("button", { type: props.type || "button", onClick: props.onClick, disabled: disabled, style: style }, kids);
|
||||
}
|
||||
|
||||
function Input(props) {
|
||||
var rest = Object.assign({}, props); delete rest.style;
|
||||
var style = Object.assign({
|
||||
width: "100%", boxSizing: "border-box", padding: "14px 15px",
|
||||
border: "1.5px solid " + C.inputBorder, borderRadius: "15px", background: C.inputBg,
|
||||
fontFamily: fonts.body, fontSize: "15px", color: C.ink, outline: "none",
|
||||
}, props.style || {});
|
||||
return h("input", Object.assign(rest, { style: style }));
|
||||
}
|
||||
|
||||
function Aviso(props) {
|
||||
var warn = props.variant === "warn";
|
||||
var box = warn
|
||||
? { bg: C.warnBg, bd: C.warnBorder, text: C.warnText, ink: C.amber }
|
||||
: { bg: C.errBg, bd: C.errBorder, text: C.errText, ink: C.danger };
|
||||
var glyph = icons[props.icon] ? icons[props.icon]({ color: box.ink, size: 18, style: { flexShrink: 0 } }) : null;
|
||||
return h("div", { style: { display: "flex", gap: "10px", alignItems: "flex-start",
|
||||
background: box.bg, border: "1px solid " + box.bd, borderRadius: "14px", padding: "11px 13px", marginBottom: "14px" } },
|
||||
[ glyph ? h("span", { key: "i", style: { display: "inline-flex", flexShrink: 0, marginTop: "1px" } }, glyph) : null,
|
||||
h("span", { key: "t", style: { fontFamily: fonts.body, fontSize: "13px", fontWeight: 500, color: box.text, lineHeight: 1.45 } }, props.children) ]);
|
||||
}
|
||||
|
||||
// Patrón ícono-en-círculo + título + mensaje (+ progreso / acción opcionales).
|
||||
// props.tone: "green" | "blue" | "amber" | "danger"; props.icon: nombre en icons.
|
||||
function Estado(props) {
|
||||
var t = STATE[props.tone] || STATE.blue;
|
||||
var cardStyle = { textAlign: "center", padding: "28px 24px" };
|
||||
if (props.dashed) cardStyle.border = "1.5px dashed " + C.dashed;
|
||||
var kids = [
|
||||
h(IconBadge, { key: "i", icon: props.icon, tone: props.tone }),
|
||||
h("h2", { key: "t", style: { margin: "0 0 8px", fontFamily: fonts.title, fontWeight: 600,
|
||||
fontSize: "21px", color: t.title, letterSpacing: "-.01em", lineHeight: 1.2 } }, props.title),
|
||||
];
|
||||
if (props.sub) kids.push(h("p", { key: "s", style: { margin: 0, fontFamily: fonts.body,
|
||||
fontWeight: 400, fontSize: "14px", color: C.inkSoft, lineHeight: 1.55 } }, props.sub));
|
||||
if (typeof props.progress === "number") kids.push(
|
||||
h("div", { key: "pg", style: { height: "8px", borderRadius: "99px", background: C.track, marginTop: "16px", overflow: "hidden" } },
|
||||
h("div", { style: { height: "100%", width: Math.max(0, Math.min(100, props.progress)) + "%", borderRadius: "99px", background: C.green } })));
|
||||
if (props.action) kids.push(h("div", { key: "a", style: { marginTop: "18px" } }, props.action));
|
||||
return Card({ style: cardStyle, children: kids });
|
||||
}
|
||||
|
||||
return { Logo: Logo, IconBadge: IconBadge, Card: Card, Btn: Btn, Input: Input,
|
||||
Aviso: Aviso, Estado: Estado, palette: C, fonts: fonts, icons: icons };
|
||||
}
|
||||
|
||||
function makeUI(flavor) {
|
||||
var React = window.React;
|
||||
var h = React.createElement;
|
||||
if (flavor === "checada") return makeCream(React); // rediseño: set cream propio
|
||||
var F = FLAVORS[flavor];
|
||||
if (!F) throw new Error("Theme.makeUI: flavor desconocido '" + flavor + "'");
|
||||
|
||||
|
||||
Reference in new issue
Block a user