feat: fase 3 - frontend next.js setup
- Next.js 15 + TypeScript + Bootstrap 5 + FontAwesome - Layout replica SAM.Master (sidebar collapsable + header) - Sidebar, Header, LoadingSpinner, ModalConfirmacion components - Login page with RUT validation - Dashboard page with summary cards - AuthContext + JWT auth with cookies - api.ts centralized HTTP client - useInactividad hook (30min timeout) - validarRut.ts + utils.ts migrated - Original CSS + images copied from project - Dockerfile multi-stage build
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
'use client';
|
||||
|
||||
import { useAuth } from '@/hooks/useAuth';
|
||||
import { useRouter } from 'next/navigation';
|
||||
|
||||
export default function Header() {
|
||||
const { user, logout } = useAuth();
|
||||
const router = useRouter();
|
||||
|
||||
const handleLogout = () => {
|
||||
logout();
|
||||
router.push('/login');
|
||||
};
|
||||
|
||||
return (
|
||||
<header>
|
||||
<div className="header-content">
|
||||
<span className="badge">Menu de Aplicaciones</span>
|
||||
<div className="user-info">
|
||||
<span className="user-name">
|
||||
<i className="fas fa-user"></i> {user?.nombre || 'Usuario'}
|
||||
</span>
|
||||
<button className="btn-logout" onClick={handleLogout}>
|
||||
<i className="fas fa-sign-out-alt"></i> Cerrar Sesión
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user