-
diff --git a/src/components/layout/Sidebar.tsx b/src/components/layout/Sidebar.tsx
index 0c88001..17a9634 100644
--- a/src/components/layout/Sidebar.tsx
+++ b/src/components/layout/Sidebar.tsx
@@ -1,88 +1,112 @@
'use client'
-import { useState } from 'react'
-import Link from 'next/link'
import { usePathname } from 'next/navigation'
+import Link from 'next/link'
import {
LayoutDashboard,
Monitor,
- Smartphone,
+ Video,
+ Terminal,
+ FolderOpen,
+ Gauge,
+ Package,
Network,
+ Smartphone,
AlertTriangle,
FileText,
Settings,
- Users,
- Building2,
- ChevronLeft,
- ChevronRight,
Activity,
+ X,
} from 'lucide-react'
import { cn } from '@/lib/utils'
+import SidebarItem, { type BadgeType } from './SidebarItem'
+import SidebarSection from './SidebarSection'
-interface NavItem {
+export interface SidebarMenuItem {
label: string
href: string
icon: React.ReactNode
- badge?: number
+ badge?: { type: BadgeType; value: string | number }
}
-const navItems: NavItem[] = [
- {
- label: 'Dashboard',
- href: '/',
- icon:
,
- },
- {
- label: 'Equipos',
- href: '/equipos',
- icon:
,
- },
- {
- label: 'Celulares',
- href: '/celulares',
- icon:
,
- },
- {
- label: 'Red',
- href: '/red',
- icon:
,
- },
- {
- label: 'Alertas',
- href: '/alertas',
- icon:
,
- },
- {
- label: 'Reportes',
- href: '/reportes',
- icon:
,
- },
-]
+export interface SidebarMenuSection {
+ label: string
+ items: SidebarMenuItem[]
+}
-const adminItems: NavItem[] = [
+const menuConfig: SidebarMenuSection[] = [
{
- label: 'Clientes',
- href: '/clientes',
- icon:
,
+ label: 'PRINCIPAL',
+ items: [
+ { label: 'Dashboard', href: '/', icon:
},
+ {
+ label: 'Dispositivos',
+ href: '/devices',
+ icon:
,
+ badge: { type: 'red', value: 10 },
+ },
+ {
+ label: 'Sesiones',
+ href: '/sesiones',
+ icon:
,
+ badge: { type: 'red', value: 4 },
+ },
+ ],
},
{
- label: 'Usuarios',
- href: '/usuarios',
- icon:
,
+ label: 'HERRAMIENTAS',
+ items: [
+ { label: 'Terminal', href: '/terminal', icon:
},
+ { label: 'Archivos', href: '/archivos', icon:
},
+ { label: 'Rendimiento', href: '/rendimiento', icon:
},
+ { label: 'Software', href: '/software', icon:
},
+ ],
},
{
- label: 'Configuracion',
- href: '/configuracion',
- icon:
,
+ label: 'INTEGRACIONES',
+ items: [
+ {
+ label: 'LibreNMS',
+ href: '/configuracion',
+ icon:
,
+ badge: { type: 'green', value: 'OK' },
+ },
+ {
+ label: 'Headwind MDM',
+ href: '/configuracion',
+ icon:
,
+ badge: { type: 'blue', value: 12 },
+ },
+ ],
+ },
+ {
+ label: 'MONITOREO',
+ items: [
+ {
+ label: 'Alertas',
+ href: '/alerts',
+ icon:
,
+ badge: { type: 'red', value: 5 },
+ },
+ { label: 'Reportes', href: '/reportes', icon:
},
+ ],
+ },
+ {
+ label: 'SISTEMA',
+ items: [
+ { label: 'Configuracion', href: '/configuracion', icon:
},
+ ],
},
]
interface SidebarProps {
- alertasActivas?: number
+ activeAlertsCount?: number
+ devicesCount?: number
+ open?: boolean
+ onClose?: () => void
}
-export default function Sidebar({ alertasActivas = 0 }: SidebarProps) {
- const [collapsed, setCollapsed] = useState(false)
+export default function Sidebar({ activeAlertsCount, devicesCount, open = false, onClose }: SidebarProps) {
const pathname = usePathname()
const isActive = (href: string) => {
@@ -90,93 +114,83 @@ export default function Sidebar({ alertasActivas = 0 }: SidebarProps) {
return pathname.startsWith(href)
}
- const items = navItems.map((item) => ({
- ...item,
- badge: item.href === '/alertas' ? alertasActivas : undefined,
- }))
+ const getBadgeValue = (item: SidebarMenuItem): SidebarMenuItem['badge'] => {
+ if (item.href === '/alerts' && activeAlertsCount !== undefined) {
+ if (activeAlertsCount === 0) return undefined
+ return { type: 'red', value: activeAlertsCount }
+ }
+ if (item.href === '/devices' && devicesCount !== undefined) {
+ return { type: 'red', value: devicesCount }
+ }
+ return item.badge
+ }
return (
-