cf2349ef2f
- 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
44 lines
1.7 KiB
TypeScript
44 lines
1.7 KiB
TypeScript
'use client';
|
|
|
|
import Link from 'next/link';
|
|
import { usePathname } from 'next/navigation';
|
|
import { useState } from 'react';
|
|
|
|
const menuItems = [
|
|
{ href: '/dashboard', icon: 'fas fa-home', label: 'Dashboard' },
|
|
{ href: '/leads', icon: 'fas fa-users', label: 'Leads' },
|
|
{ href: '/cotizaciones', icon: 'fas fa-file-invoice-dollar', label: 'Cotizaciones' },
|
|
{ href: '/cursos', icon: 'fas fa-book', label: 'Cursos' },
|
|
{ href: '/alumnos', icon: 'fas fa-user-graduate', label: 'Alumnos' },
|
|
{ href: '/arqueo', icon: 'fas fa-cash-register', label: 'Arqueo' },
|
|
{ href: '/empresas', icon: 'fas fa-building', label: 'Empresas' },
|
|
{ href: '/reportes/ventas', icon: 'fas fa-chart-bar', label: 'Reportes' },
|
|
{ href: '/autorizador', icon: 'fas fa-check-double', label: 'Autorizador' },
|
|
{ href: '/contacto', icon: 'fas fa-envelope', label: 'Contacto' },
|
|
];
|
|
|
|
export default function Sidebar() {
|
|
const pathname = usePathname();
|
|
const [collapsed, setCollapsed] = useState(false);
|
|
|
|
return (
|
|
<div className={`sidebar ${collapsed ? 'collapsed' : ''}`}>
|
|
<div className="logo-details">
|
|
<img className="icon" src="/img/favicon.png" width="60" alt="SAM" />
|
|
<div className="logo_name">SAM</div>
|
|
<i className="bx bx-menu" id="btn" onClick={() => setCollapsed(!collapsed)}></i>
|
|
</div>
|
|
<ul className="nav-list">
|
|
{menuItems.map(item => (
|
|
<li key={item.href} className={pathname.startsWith(item.href) ? 'active' : ''}>
|
|
<Link href={item.href}>
|
|
<i className={item.icon}></i>
|
|
<span className="links_name">{item.label}</span>
|
|
</Link>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</div>
|
|
);
|
|
}
|