'use client'; import { usePathname } from 'next/navigation'; import Link from 'next/link'; import { cn } from '@/lib/utils'; import { LayoutDashboard, Server, Database, Activity, HardDrive, Sparkles, Users, TrendingUp, BarChart3, GitCompare, Brain, Search, AlertTriangle, } from 'lucide-react'; import { NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, navigationMenuTriggerStyle, } from '@/components/ui/navigation-menu'; import { Button } from '@/components/ui/button'; import { ThemeToggle } from '@/components/theme-toggle'; import { StatusIndicator } from '@/components/navigation/status-indicator'; import { UserMenu } from '@/components/navigation/user-menu'; import { MobileNav } from '@/components/navigation/mobile-nav'; import { useSession } from '@/lib/auth-client'; interface NavItem { title: string; href?: string; icon?: React.ElementType; description?: string; children?: NavItem[]; } const navigationItems: NavItem[] = [ { title: 'Dashboard', href: '/', icon: LayoutDashboard, description: 'Overview and quick access' }, { title: 'Configuration Items', href: '/configuration-items', icon: Server, description: 'Manage IT assets and devices' }, { title: 'Backup Status', icon: HardDrive, children: [ { title: 'Backup Status', href: '/backup-status', icon: HardDrive, description: 'Veeam backup health and compliance' }, { title: 'RPO Comparison', href: '/veeam-comparison', icon: GitCompare, description: 'Pulse RPO shadow vs Datto RMM ticket comparison' }, { title: 'Ticket Analysis', href: '/veeam-analysis', icon: Brain, description: 'AI classification of backup tickets — patterns, skills, SOP gaps' }, ] }, { title: 'Engagement', icon: Users, children: [ { title: 'Overview', href: '/engagement', icon: Users, description: 'Staff activity and engagement metrics', }, { title: 'Employee Profile', href: '/engagement/profile', icon: TrendingUp, description: '12-month activity calendar and performance profile', }, ], }, { title: 'Analyzer', icon: Sparkles, children: [ { title: 'Browse Tickets', href: '/analyzer/tickets', icon: Search, description: 'Filter tickets by period, client, or issue type — pick one to analyze', }, { title: 'Aggregate Reports', href: '/analyzer/reports', icon: BarChart3, description: 'Cross-ticket pattern analysis: documentation gaps, process gaps, recurrence clusters', }, { title: 'Needs Review', href: '/analyzer/queue', icon: AlertTriangle, description: 'Analyses flagged for human review (low confidence or cost-ceiling skipped Opus)', }, { title: 'IT Glue — Applications', href: '/analyzer/itglue/applications', icon: Database, description: 'Audit IT Glue Application records against ticket history; admins can apply or revert documentation changes', }, { title: 'IT Glue — Configurations', href: '/analyzer/itglue/configurations', icon: Database, description: 'Audit IT Glue Configuration records (servers, workstations, devices) against ticket history; admins can apply or revert', }, ], }, { title: 'Admin', icon: Activity, children: [ { title: 'Admin home', href: '/admin', icon: Activity, description: 'Tile index of every admin tool', }, { title: 'Sync schedules', href: '/admin/sync', icon: GitCompare, description: 'Cron-driven syncs for Autotask, IT Glue, Veeam, Engagement, etc.', }, { title: 'Workflow rules', href: '/admin/workflow', icon: Brain, description: 'Classification, AI prompts, ticket digest, and execution history', }, { title: 'RMM Overshell', href: '/admin/rmm-overshell', icon: Activity, description: 'Curated Datto RMM scripts; recent executions and rate limits', }, { title: 'IT Glue write log', href: '/admin/itglue-writes', icon: Database, description: 'Audit-driven changes pushed back to IT Glue; revert from here', }, { title: 'Device-link conflicts', href: '/admin/device-link-conflicts', icon: AlertTriangle, description: 'Cross-system mappings needing a human decision', }, { title: 'Users & roles', href: '/admin/users', icon: Users, description: 'Invite users, manage roles and permissions', }, ], }, ]; export function AppNavigation() { const pathname = usePathname(); const { data: session } = useSession(); const userRole = (session?.user as any)?.role || 'user'; const isSuperAdmin = userRole === 'super-admin'; // Mobile routes have their own nav — suppress desktop header if (pathname.startsWith('/mobile')) return null; const isActive = (href?: string) => { if (!href) return false; return pathname === href || pathname.startsWith(href + '/'); }; // Hide Engagement and Admin from non-super-admins const visibleItems = navigationItems.filter((item) => { if (item.title === 'Engagement' || item.title === 'Admin') { return isSuperAdmin; } return true; }); return (
{/* Mobile hamburger + brand */}
Wulf Consulting

Pulse

Operations console

{/* Main Navigation — centered, desktop only */} {visibleItems.map((item) => { const childActive = item.children?.some((c) => isActive(c.href)) ?? false; const flatActive = isActive(item.href); // Brand-blue 2px underline marks active state — echoes the // PageHeader rule rather than filling the button with primary. const activeRule = 'relative after:absolute after:inset-x-2 after:bottom-0 after:h-[2px] after:bg-primary after:rounded-full'; return ( {item.children ? ( <> {item.icon && } {item.title}
    {item.children.map((child) => { const active = isActive(child.href); return (
  • {child.icon && ( )}
    {child.title}
    {child.description && (

    {child.description}

    )}
  • ); })}
) : ( {item.icon && } {item.title} )}
); })}
{/* Right Side Actions */}
); } // PageHeader moved to ./page-header.tsx; re-exported for backwards compatibility. export { PageHeader } from '@/components/navigation/page-header'; export type { BreadcrumbItem, PageHeaderProps } from '@/components/navigation/page-header';