diff --git a/frontend/src/views/LoginView.tsx b/frontend/src/views/LoginView.tsx index 6a8c541..7de047b 100644 --- a/frontend/src/views/LoginView.tsx +++ b/frontend/src/views/LoginView.tsx @@ -1,7 +1,7 @@ // ============================================================================== -// Vista de Inicio de Sesión de Operador / Guardia -// Sistema de Diseño OnEver (C:\Workspace\OemspotPySYS\styles\design_system.py) -// Optimizado para uso táctil en tablets Samsung Galaxy Tab y Windows (Touch-First) +// Vista de Inicio de Sesión de Operador / Guardia (OnEverControl Web) +// Paridad Visual 1:1 con la versión de escritorio de OneverAccess (login_window.py) +// Sistema de Diseño OnEver con Ola Gradiente (Indigo/Blue), Pills inputs y Glassmorphism // ============================================================================== import React, { useState, useEffect } from 'react'; import { useAuth } from '../context/AuthContext'; @@ -15,11 +15,14 @@ export const LoginView: React.FC = () => { const [username, setUsername] = useState('guardia'); const [password, setPassword] = useState(''); + const [showPassword, setShowPassword] = useState(false); const [selectedWks, setSelectedWks] = useState(workstation || 'CFT-DESK'); const [availableWorkstations, setAvailableWorkstations] = useState([]); const [isLoading, setIsLoading] = useState(false); const [errorMsg, setErrorMsg] = useState(null); + const isDark = theme === 'dark'; + useEffect(() => { // Carga de Workstations reales desde SQL Server workstationApi @@ -56,12 +59,20 @@ export const LoginView: React.FC = () => { setWorkstation(selectedWks); await login(username.trim(), password, selectedWks); } catch (err: any) { - setErrorMsg(err.message || 'Error al iniciar sesión. Verifique sus credenciales.'); + setErrorMsg(err.message || 'Credenciales inválidas. Verifique usuario o contraseña.'); } finally { setIsLoading(false); } }; + const toggleFullscreen = () => { + if (!document.fullscreenElement) { + document.documentElement.requestFullscreen().catch(() => {}); + } else { + document.exitFullscreen().catch(() => {}); + } + }; + return (
{ alignItems: 'center', justifyContent: 'center', minHeight: '100%', - backgroundColor: 'var(--bg-main)', + backgroundColor: isDark ? '#090D16' : '#F1F5F9', + backgroundImage: isDark + ? 'radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 60%)' + : 'radial-gradient(circle at 50% 0%, rgba(14, 165, 233, 0.12) 0%, transparent 60%)', padding: '1.5rem', position: 'relative', + userSelect: 'none', }} > - {/* Botón flotante de alternancia de tema (Oscuro / Claro) */} - + + +
+ + {/* Tarjeta de Login (Paridad con LoginBackgroundFrame de OneverAccess Desktop) */}
- {/* Cabecera del Login */} -
+ {/* Onda Decorativa Superior con Gradiente Curvo (Idéntica a LoginBackgroundFrame) */} +
+ + + + {isDark ? ( + <> + {/* Indigo */} + {/* Blue */} + + ) : ( + <> + {/* Purple */} + {/* Light Blue */} + + )} + + + {/* Curva Bezier cúbica idéntica al painter.cubicTo de PyQt6 */} + + +
+ + {/* Contenido Principal del Formulario */} +
+ {/* Logo Corporativo OneverAccess */}
OnEver Access { (e.target as HTMLImageElement).src = '/logo_mini.png'; }} />
-

- OnEverControl -

-
- - Puesto de Control Web • Modo Garita - - + + +
+ + {/* Campo Usuario (Pill Shape) */} +
+ + setUsername(e.target.value)} + placeholder="Username" + autoCapitalize="none" + autoCorrect="off" + required + style={{ + width: '100%', + height: '46px', + borderRadius: '23px', + backgroundColor: isDark ? '#1E293B' : '#F8FAFC', + border: `1px solid ${isDark ? '#374151' : '#CBD5E1'}`, + color: isDark ? '#F8FAFC' : '#0F172A', + padding: '0 20px', + fontSize: '0.925rem', + fontWeight: 500, + outline: 'none', + transition: 'border-color 0.2s, box-shadow 0.2s', + }} + onFocus={(e) => { + e.currentTarget.style.borderColor = '#2563EB'; + e.currentTarget.style.boxShadow = '0 0 0 3px rgba(37, 99, 235, 0.2)'; + }} + onBlur={(e) => { + e.currentTarget.style.borderColor = isDark ? '#374151' : '#CBD5E1'; + e.currentTarget.style.boxShadow = 'none'; + }} + /> +
+ + {/* Campo Contraseña con Botón de Ojo (Pill Shape) */} +
+ +
+ setPassword(e.target.value)} + placeholder="Password" + required + style={{ + flex: 1, + height: '100%', + border: 'none', + backgroundColor: 'transparent', + color: isDark ? '#F8FAFC' : '#0F172A', + padding: '0 0 0 20px', + fontSize: '0.925rem', + fontWeight: 500, + outline: 'none', + }} + onFocus={() => { + const el = document.getElementById('passwordContainer'); + if (el) { + el.style.borderColor = '#2563EB'; + el.style.boxShadow = '0 0 0 3px rgba(37, 99, 235, 0.2)'; + } + }} + onBlur={() => { + const el = document.getElementById('passwordContainer'); + if (el) { + el.style.borderColor = isDark ? '#374151' : '#CBD5E1'; + el.style.boxShadow = 'none'; + } + }} + /> + +
+
+ + {/* Mensaje de Error (si ocurre) */} + {errorMsg && ( +
+ ⚠️ {errorMsg} +
+ )} + + {/* Botón Ingresar / Login (Pill Shape estilo OnEver Desktop) */} +
-
+ {isLoading ? ( + <> + ⏳ Validando credenciales... + + ) : ( + 'Login' + )} + + - {/* Alerta de Error */} - {errorMsg && ( + {/* Pie Informativo y Estado de Conexión */}
- ⚠️ {errorMsg} -
- )} - -
- {/* Selector de Workstation Real desde SQL Server */} -
- - -
+ { + (e.target as HTMLElement).style.display = 'none'; + }} + /> + OnEver Access · Control Web {APP_VERSION} + + {APP_BUILD} + +
- {/* Campo Usuario */} -
- - setUsername(e.target.value)} - placeholder="Ej: guardia, supervisor" - autoCapitalize="none" - autoCorrect="off" - required - style={{ width: '100%' }} - /> + ● + Conectado a Microsoft SQL Server (Transaccional) +
- - {/* Campo Contraseña */} -
- - setPassword(e.target.value)} - placeholder="••••••••" - required - style={{ width: '100%' }} - /> -
- - {/* Botón de Ingreso Táctil */} - - - -
- OnEver Access · Control Web {APP_VERSION} ({APP_BUILD}) • Conectado a Microsoft SQL Server