'use client'; import { BarChart3, Bookmark, Bot, CreditCard, FileText, Gem, Home, List, LogOut, Menu, MessageSquare, Moon, Plus, Sun, Target, User, X, type LucideIcon, } from 'lucide-react'; import { usePathname } from 'next/navigation'; import { useTranslations } from 'next-intl'; import { useState } from 'react'; import { NotificationBell } from '@/components/notifications/notification-bell'; import { useTheme } from '@/components/providers/theme-provider'; import { Button } from '@/components/ui/button'; import { LanguageSwitcher } from '@/components/ui/language-switcher'; import { Link } from '@/i18n/navigation'; import { useAuthStore } from '@/lib/auth-store'; import { cn } from '@/lib/utils'; interface NavItem { href: string; label: string; icon: LucideIcon; } interface NavGroup { label: string; items: NavItem[]; } export default function DashboardLayout({ children }: { children: React.ReactNode }) { const pathname = usePathname(); const { user, logout } = useAuthStore(); const { theme, toggleTheme } = useTheme(); const t = useTranslations(); const [sidebarOpen, setSidebarOpen] = useState(false); const navGroups: NavGroup[] = [ { label: t('dashboard.title'), items: [ { href: '/dashboard', label: t('dashboard.title'), icon: Home }, { href: '/listings', label: t('dashboard.listings'), icon: List }, { href: '/listings/new', label: t('dashboard.createListing'), icon: Plus }, ], }, { label: 'CRM', items: [ { href: '/inquiries', label: t('dashboard.inquiries'), icon: MessageSquare }, { href: '/leads', label: t('dashboard.leads'), icon: Target }, ], }, { label: t('dashboard.analytics'), items: [ { href: '/analytics', label: t('dashboard.analytics'), icon: BarChart3 }, { href: '/dashboard/reports', label: t('dashboard.reports'), icon: FileText }, { href: '/dashboard/saved-searches', label: t('dashboard.savedSearches'), icon: Bookmark }, { href: '/dashboard/valuation', label: t('dashboard.aiValuation'), icon: Bot }, ], }, { label: t('dashboard.profile'), items: [ { href: '/dashboard/profile', label: t('dashboard.profile'), icon: User }, { href: '/dashboard/subscription', label: t('dashboard.subscription'), icon: Gem }, { href: '/dashboard/payments', label: t('dashboard.payments'), icon: CreditCard }, ], }, ]; // Flat list for desktop nav (only primary items shown inline) const primaryNav: NavItem[] = [ { href: '/dashboard', label: t('dashboard.title'), icon: Home }, { href: '/listings', label: t('dashboard.listings'), icon: List }, { href: '/listings/new', label: t('dashboard.createListing'), icon: Plus }, { href: '/inquiries', label: t('dashboard.inquiries'), icon: MessageSquare }, { href: '/leads', label: t('dashboard.leads'), icon: Target }, { href: '/analytics', label: t('dashboard.analytics'), icon: BarChart3 }, ]; const secondaryNav: NavItem[] = [ { href: '/dashboard/reports', label: t('dashboard.reports'), icon: FileText }, { href: '/dashboard/saved-searches', label: t('dashboard.savedSearches'), icon: Bookmark }, { href: '/dashboard/valuation', label: t('dashboard.aiValuation'), icon: Bot }, { href: '/dashboard/profile', label: t('dashboard.profile'), icon: User }, { href: '/dashboard/subscription', label: t('dashboard.subscription'), icon: Gem }, { href: '/dashboard/payments', label: t('dashboard.payments'), icon: CreditCard }, ]; const isActive = (href: string) => pathname === href || (href !== '/dashboard' && pathname.startsWith(href)); return (