50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
// ==============================================================================
|
|
// 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';
|
|
|
|
const MainNavigator: React.FC = () => {
|
|
const { isAuthenticated, loading } = useAuth();
|
|
|
|
if (loading) {
|
|
return (
|
|
<div
|
|
style={{
|
|
display: 'flex',
|
|
flexDirection: 'column',
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
height: '100%',
|
|
backgroundColor: 'var(--bg-app)',
|
|
color: 'var(--text-secondary)',
|
|
gap: '1rem',
|
|
}}
|
|
>
|
|
<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>
|
|
);
|
|
}
|
|
|
|
return isAuthenticated ? <ControlPostView /> : <LoginView />;
|
|
};
|
|
|
|
export const App: React.FC = () => {
|
|
return (
|
|
<AuthProvider>
|
|
<MainNavigator />
|
|
</AuthProvider>
|
|
);
|
|
};
|
|
|
|
export default App;
|