'use client'; import { useState } from 'react'; import Link from 'next/link'; import { usePathname, useRouter } from 'next/navigation'; import { LayoutDashboard, Users, CreditCard, Key, KeyRound, BarChart3, Settings, Package, LogOut, Menu, X, ScrollText, Sun, Moon, Ticket, Tag, Gift, Palette, Wallet, Bell, BookOpen, Activity, FileText, Shield, MessageSquare, Megaphone, ClipboardList, Beaker, } from 'lucide-react'; import { cn } from '@/lib/utils'; import { useAuth } from '@/lib/auth-context'; import { useTheme } from '@/lib/theme-context'; import { ProductSwitcher } from '@/components/product-switcher'; const navItems = [ { href: '/', label: 'Dashboard', icon: LayoutDashboard }, { href: '/users', label: 'Users', icon: Users }, { href: '/subscriptions', label: 'Subscriptions', icon: CreditCard }, { href: '/licenses', label: 'Licenses', icon: KeyRound }, { href: '/tokens', label: 'API Tokens', icon: Key }, { href: '/usage', label: 'Usage Analytics', icon: BarChart3 }, { href: '/invitations', label: 'Invitations', icon: Ticket }, { href: '/promos', label: 'Promo Codes', icon: Tag }, { href: '/referrals', label: 'Referrals', icon: Gift }, { href: '/broadcasts', label: 'Broadcasts', icon: Megaphone }, { href: '/surveys', label: 'Surveys', icon: ClipboardList }, { href: '/themes', label: 'Themes', icon: Palette }, { href: '/billing', label: 'Billing', icon: Wallet }, { href: '/products', label: 'Products', icon: Package }, { href: '/notifications', label: 'Notifications', icon: Bell }, { href: '/docs', label: 'Docs & Runbooks', icon: BookOpen }, { href: '/flags', label: 'Feature Flags', icon: Settings }, { href: '/audit', label: 'Audit Log', icon: ScrollText }, { href: '/ops', label: 'Mission Control', icon: Activity }, { href: '/ops/client-logs', label: 'Client Logs', icon: FileText }, { href: '/ops/telemetry-policies', label: 'Telemetry Policies', icon: Shield }, { href: '/ops/ab-testing', label: 'A/B Testing', icon: Beaker }, { href: '/feedback', label: 'User Feedback', icon: MessageSquare }, { href: '/ops/secrets', label: 'Secrets Manager', icon: KeyRound }, { href: '/settings', label: 'Settings', icon: Settings }, ]; export function SidebarNav() { const pathname = usePathname(); const router = useRouter(); const { user, logout } = useAuth(); const { resolved, setTheme } = useTheme(); const [mobileOpen, setMobileOpen] = useState(false); const handleLogout = () => { logout(); router.replace('/login'); }; const initials = user?.name ? user.name .split(' ') .map(w => w[0]) .join('') .toUpperCase() .slice(0, 2) : '??'; const sidebarContent = ( <> {/* Logo */}
Admin Console
{user?.name ?? 'Admin'}
{user?.email ?? ''}