feat: complete Phases 2 to 5 inclusive - Access Core, Web Cockpit, Hardware enqueuing, Optical Scanner and QA (v0.5.0-beta)

This commit is contained in:
Carlos Tello
2026-10-13 15:47:43 -03:00
parent 78c1a306de
commit 1ba74f7929
53 changed files with 4000 additions and 279 deletions
+32 -256
View File
@@ -1,272 +1,48 @@
import React, { useState, useEffect, useCallback } from 'react';
// ==============================================================================
// Componente Raíz de OnEverControl Web
// Modo Cliente Ligero de Puesto de Control optimizado para Samsung Galaxy Tab A9/A11
// ==============================================================================
import React from 'react';
import './styles/tokens.css';
import './styles/base.css';
import { AuthProvider, useAuth } from './context/AuthContext';
import { LoginView } from './views/LoginView';
import { ControlPostView } from './views/ControlPostView';
interface HealthData {
status: string;
app: string;
version: string;
timestamp: string;
}
const MainNavigator: React.FC = () => {
const { isAuthenticated, loading } = useAuth();
export const App: React.FC = () => {
const [health, setHealth] = useState<HealthData | null>(null);
const [loading, setLoading] = useState<boolean>(true);
const [error, setError] = useState<string | null>(null);
const [theme, setTheme] = useState<'dark' | 'light'>('dark');
const [workstation] = useState<string>('GARITA_PRINCIPAL');
const checkHealth = useCallback(async () => {
setLoading(true);
setError(null);
try {
const res = await fetch('/health');
if (!res.ok) {
throw new Error(`HTTP ${res.status}`);
}
const data: HealthData = await res.json();
setHealth(data);
} catch (err) {
setError(err instanceof Error ? err.message : 'Error al conectar con servidor');
setHealth(null);
} finally {
setLoading(false);
}
}, []);
useEffect(() => {
checkHealth();
}, [checkHealth]);
const toggleTheme = () => {
const nextTheme = theme === 'dark' ? 'light' : 'dark';
setTheme(nextTheme);
document.documentElement.setAttribute('data-theme', nextTheme);
};
const toggleFullscreen = () => {
if (!document.fullscreenElement) {
document.documentElement.requestFullscreen().catch(() => {});
} else {
document.exitFullscreen().catch(() => {});
}
};
return (
<div
style={{
display: 'flex',
flexDirection: 'column',
height: '100%',
backgroundColor: 'var(--bg-app)',
}}
>
{/* Barra Superior de Garita */}
<header
if (loading) {
return (
<div
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
padding: '0.75rem 1.25rem',
backgroundColor: 'var(--bg-surface)',
borderBottom: '1px solid var(--border-subtle)',
minHeight: '64px',
}}
>
<div style={{ display: 'flex', alignItems: 'center', gap: '1rem' }}>
<div>
<h1 style={{ fontSize: 'var(--font-size-lg)', fontWeight: 700, margin: 0, color: 'var(--text-primary)' }}>
OnEverControl
</h1>
<span style={{ fontSize: 'var(--font-size-xs)', color: 'var(--text-muted)' }}>
Puesto de Control Web • Modo Cliente
</span>
</div>
<span className="badge badge-info" title="Estación activa">
🖥️ {workstation}
</span>
</div>
<div style={{ display: 'flex', alignItems: 'center', gap: '0.75rem' }}>
{/* Indicador de Salud del Servidor */}
{loading ? (
<span className="badge badge-info">Conectando...</span>
) : health ? (
<span className="badge badge-success">
● API Conectada (v{health.version})
</span>
) : (
<span className="badge badge-danger">
✕ Servidor Desconectado ({error})
</span>
)}
{/* Botón de Modo Oscuro / Claro */}
<button
onClick={toggleTheme}
className="touch-target"
style={{
background: 'transparent',
border: '1px solid var(--border-strong)',
borderRadius: 'var(--touch-radius)',
color: 'var(--text-primary)',
cursor: 'pointer',
padding: '0.5rem',
}}
title="Cambiar tema de alto contraste"
>
{theme === 'dark' ? '☀️' : '🌙'}
</button>
{/* Botón de Pantalla Completa */}
<button
onClick={toggleFullscreen}
className="touch-target"
style={{
background: 'transparent',
border: '1px solid var(--border-strong)',
borderRadius: 'var(--touch-radius)',
color: 'var(--text-primary)',
cursor: 'pointer',
padding: '0.5rem',
}}
title="Pantalla Completa (Modo Kiosco)"
>
⛶
</button>
</div>
</header>
{/* Contenido Principal */}
<main
style={{
flex: 1,
overflowY: 'auto',
padding: '1.5rem',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
gap: '1.5rem',
height: '100%',
backgroundColor: 'var(--bg-app)',
color: 'var(--text-secondary)',
gap: '1rem',
}}
>
<div
style={{
maxWidth: '680px',
width: '100%',
backgroundColor: 'var(--bg-surface)',
border: '1px solid var(--border-subtle)',
borderRadius: '12px',
padding: '2rem',
boxShadow: 'var(--shadow-md)',
}}
>
<div style={{ textAlign: 'center', marginBottom: '1.5rem' }}>
<h2 style={{ fontSize: 'var(--font-size-xl)', marginBottom: '0.5rem' }}>
Base del Sistema Operativa (Fase 1)
</h2>
<p style={{ color: 'var(--text-secondary)', fontSize: 'var(--font-size-sm)' }}>
Entorno base configurado para tablets táctiles y servidores multiplataforma.
</p>
</div>
<div style={{ fontSize: '2.5rem' }}>🛡️</div>
<div style={{ fontSize: '1.1rem', fontWeight: 600 }}>Cargando OnEverControl...</div>
<span style={{ fontSize: '0.85rem', color: 'var(--text-muted)' }}>
Verificando sesión en red local...
</span>
</div>
);
}
<div
style={{
display: 'grid',
gridTemplateColumns: 'repeat(auto-fit, minmax(240px, 1fr))',
gap: '1rem',
marginBottom: '1.5rem',
}}
>
<div
style={{
backgroundColor: 'var(--bg-surface-elevated)',
padding: '1rem',
borderRadius: '8px',
border: '1px solid var(--border-subtle)',
}}
>
<div style={{ fontSize: 'var(--font-size-xs)', color: 'var(--text-muted)' }}>HARDWARE OBJETIVO</div>
<div style={{ fontWeight: 600, marginTop: '0.25rem' }}>Samsung Tab A9 / A11 (4GB)</div>
<div style={{ fontSize: 'var(--font-size-xs)', color: 'var(--color-success)', marginTop: '0.25rem' }}>
✓ Optimizado para 4GB RAM
</div>
</div>
return isAuthenticated ? <ControlPostView /> : <LoginView />;
};
<div
style={{
backgroundColor: 'var(--bg-surface-elevated)',
padding: '1rem',
borderRadius: '8px',
border: '1px solid var(--border-subtle)',
}}
>
<div style={{ fontSize: 'var(--font-size-xs)', color: 'var(--text-muted)' }}>ENTORNO SERVIDOR</div>
<div style={{ fontWeight: 600, marginTop: '0.25rem' }}>Windows / LXC / Docker</div>
<div style={{ fontSize: 'var(--font-size-xs)', color: 'var(--color-info)', marginTop: '0.25rem' }}>
✓ Portabilidad Agnostica
</div>
</div>
<div
style={{
backgroundColor: 'var(--bg-surface-elevated)',
padding: '1rem',
borderRadius: '8px',
border: '1px solid var(--border-subtle)',
}}
>
<div style={{ fontSize: 'var(--font-size-xs)', color: 'var(--text-muted)' }}>INTEGRACION HARDWARE</div>
<div style={{ fontWeight: 600, marginTop: '0.25rem' }}>Cola pdtmdl en videoman</div>
<div style={{ fontSize: 'var(--font-size-xs)', color: 'var(--color-success)', marginTop: '0.25rem' }}>
✓ Desacople de puertos COM
</div>
</div>
<div
style={{
backgroundColor: 'var(--bg-surface-elevated)',
padding: '1rem',
borderRadius: '8px',
border: '1px solid var(--border-subtle)',
}}
>
<div style={{ fontSize: 'var(--font-size-xs)', color: 'var(--text-muted)' }}>VERSION ACTUAL</div>
<div style={{ fontWeight: 600, marginTop: '0.25rem' }}>v0.1.0-alpha</div>
<div style={{ fontSize: 'var(--font-size-xs)', color: 'var(--text-secondary)', marginTop: '0.25rem' }}>
Gitea Sincronizado
</div>
</div>
</div>
<div style={{ display: 'flex', gap: '1rem', justifyContent: 'center' }}>
<button onClick={checkHealth} className="touch-button btn-primary">
🔄 Probar Conectividad (/health)
</button>
<button onClick={toggleFullscreen} className="touch-button btn-secondary">
📱 Modo Pantalla Completa
</button>
</div>
</div>
</main>
{/* Pie de Página */}
<footer
style={{
padding: '0.75rem 1.25rem',
backgroundColor: 'var(--bg-surface)',
borderTop: '1px solid var(--border-subtle)',
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
fontSize: 'var(--font-size-xs)',
color: 'var(--text-muted)',
}}
>
<span>Oemspot OnEverControl • Control de Accesos de Alta Disponibilidad</span>
<span>FastAPI + React • v0.1.0-alpha</span>
</footer>
</div>
export const App: React.FC = () => {
return (
<AuthProvider>
<MainNavigator />
</AuthProvider>
);
};