feat(base): finalizada Fase 1 scaffolding v0.1.0-alpha
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"
|
||||
/>
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
<meta name="theme-color" content="#121824" />
|
||||
<meta name="description" content="OnEverControl - Cliente Web Puesto de Control de Garita" />
|
||||
<title>OnEverControl — Puesto de Control</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
Generated
+1755
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "onevercontrol-frontend",
|
||||
"private": true,
|
||||
"version": "0.1.0-alpha",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "tsc && vite build",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^18.3.3",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"@vitejs/plugin-react": "^4.3.1",
|
||||
"typescript": "^5.4.5",
|
||||
"vite": "^5.3.1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,273 @@
|
||||
import React, { useState, useEffect, useCallback } from 'react';
|
||||
import './styles/tokens.css';
|
||||
import './styles/base.css';
|
||||
|
||||
interface HealthData {
|
||||
status: string;
|
||||
app: string;
|
||||
version: string;
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
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
|
||||
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',
|
||||
}}
|
||||
>
|
||||
<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={{
|
||||
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>
|
||||
|
||||
<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 default App;
|
||||
@@ -0,0 +1,9 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import App from './App';
|
||||
|
||||
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>
|
||||
);
|
||||
@@ -0,0 +1,115 @@
|
||||
/* ==============================================================================
|
||||
Reset Base y Layout Táctil (100dvh) para Tablets
|
||||
============================================================================== */
|
||||
|
||||
*, *::before, *::after {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
html, body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
height: 100dvh;
|
||||
overflow: hidden;
|
||||
background-color: var(--bg-app);
|
||||
color: var(--text-primary);
|
||||
font-family: var(--font-family);
|
||||
font-size: 16px;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
|
||||
/* Prevenir zoom accidental en tablets */
|
||||
touch-action: manipulation;
|
||||
/* Prevenir recarga por arrastre en Chrome Android */
|
||||
overscroll-behavior-y: contain;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
#root {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
height: 100dvh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* Clases de utilidad táctil */
|
||||
.touch-target {
|
||||
min-height: var(--touch-min-size);
|
||||
min-width: var(--touch-min-size);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.touch-button {
|
||||
min-height: var(--touch-button-height);
|
||||
padding: 0 1.25rem;
|
||||
border-radius: var(--touch-radius);
|
||||
font-size: var(--font-size-base);
|
||||
font-weight: 600;
|
||||
border: 1px solid transparent;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.15s ease, transform 0.05s ease;
|
||||
touch-action: manipulation;
|
||||
}
|
||||
|
||||
.touch-button:active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background-color: var(--color-primary);
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
background-color: var(--color-primary-hover);
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
background-color: var(--bg-surface-highlight);
|
||||
color: var(--text-primary);
|
||||
border-color: var(--border-strong);
|
||||
}
|
||||
|
||||
.btn-danger {
|
||||
background-color: var(--color-danger);
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.btn-success {
|
||||
background-color: var(--color-success);
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
/* Indicadores y Badges */
|
||||
.badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.375rem;
|
||||
padding: 0.25rem 0.625rem;
|
||||
border-radius: 9999px;
|
||||
font-size: var(--font-size-xs);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.badge-success {
|
||||
background-color: var(--color-success-bg);
|
||||
color: var(--color-success);
|
||||
border: 1px solid var(--color-success);
|
||||
}
|
||||
|
||||
.badge-danger {
|
||||
background-color: var(--color-danger-bg);
|
||||
color: var(--color-danger);
|
||||
border: 1px solid var(--color-danger);
|
||||
}
|
||||
|
||||
.badge-info {
|
||||
background-color: rgba(56, 189, 248, 0.15);
|
||||
color: var(--color-info);
|
||||
border: 1px solid var(--color-info);
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/* ==============================================================================
|
||||
OnEver Design Tokens (Tokens Semánticos de Diseño)
|
||||
Optimizado para Garitas y Tablets de 4GB RAM (Samsung Tab A9 / A11)
|
||||
============================================================================== */
|
||||
|
||||
:root {
|
||||
/* Paleta Dark Mode (Por defecto en garitas de seguridad) */
|
||||
--bg-app: #0b0f19;
|
||||
--bg-surface: #121826;
|
||||
--bg-surface-elevated: #1a2235;
|
||||
--bg-surface-highlight: #232e48;
|
||||
|
||||
--border-subtle: #232d42;
|
||||
--border-strong: #334155;
|
||||
|
||||
--text-primary: #f8fafc;
|
||||
--text-secondary: #94a3b8;
|
||||
--text-muted: #64748b;
|
||||
|
||||
/* Estados y Semántica */
|
||||
--color-primary: #0284c7;
|
||||
--color-primary-hover: #0369a1;
|
||||
--color-success: #10b981;
|
||||
--color-success-bg: rgba(16, 185, 129, 0.15);
|
||||
--color-danger: #ef4444;
|
||||
--color-danger-bg: rgba(239, 68, 68, 0.15);
|
||||
--color-warning: #f59e0b;
|
||||
--color-warning-bg: rgba(245, 158, 11, 0.15);
|
||||
--color-info: #38bdf8;
|
||||
|
||||
/* Touch Targets y Ergonomía Táctil */
|
||||
--touch-min-size: 48px;
|
||||
--touch-button-height: 52px;
|
||||
--touch-input-height: 50px;
|
||||
--touch-radius: 8px;
|
||||
|
||||
/* Tipografía */
|
||||
--font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
--font-size-xs: 0.75rem;
|
||||
--font-size-sm: 0.875rem;
|
||||
--font-size-base: 1rem;
|
||||
--font-size-lg: 1.125rem;
|
||||
--font-size-xl: 1.25rem;
|
||||
--font-size-2xl: 1.5rem;
|
||||
|
||||
/* Sombras y elevación */
|
||||
--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
|
||||
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
/* Modo Claro Opcional (Para puestos al sol directo) */
|
||||
[data-theme="light"] {
|
||||
--bg-app: #f1f5f9;
|
||||
--bg-surface: #ffffff;
|
||||
--bg-surface-elevated: #f8fafc;
|
||||
--bg-surface-highlight: #e2e8f0;
|
||||
|
||||
--border-subtle: #cbd5e1;
|
||||
--border-strong: #94a3b8;
|
||||
|
||||
--text-primary: #0f172a;
|
||||
--text-secondary: #475569;
|
||||
--text-muted: #64748b;
|
||||
|
||||
--color-primary: #0284c7;
|
||||
--color-primary-hover: #0369a1;
|
||||
--color-success: #059669;
|
||||
--color-success-bg: rgba(5, 150, 105, 0.1);
|
||||
--color-danger: #dc2626;
|
||||
--color-danger-bg: rgba(220, 38, 38, 0.1);
|
||||
--color-warning: #d97706;
|
||||
--color-warning-bg: rgba(217, 119, 6, 0.1);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"useDefineForClassFields": true,
|
||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": false,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
server: {
|
||||
host: '0.0.0.0', // Permite acceso desde tablets Samsung en la LAN
|
||||
port: 5173,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://localhost:8000',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/health': {
|
||||
target: 'http://localhost:8000',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/ws': {
|
||||
target: 'ws://localhost:8000',
|
||||
ws: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
build: {
|
||||
target: 'es2020',
|
||||
sourcemap: false,
|
||||
chunkSizeWarningLimit: 600,
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks: {
|
||||
vendor: ['react', 'react-dom'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user