'use client'; import { PWAInstallButton } from '@/components/pwa/PwaLifecycle'; import { Button, buttonClassNames } from '@/components/ui/Button'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; import React, { useEffect, useState } from 'react'; interface NavbarProps { onToggleSidebar?: () => void; showSidebarToggle?: boolean; } const VCON_LABELS: Record = { '/vcon/dashboard': 'Dashboard', '/vcon/data': 'Events', '/vcon/clients': 'Clients', '/vcon/export': 'Export', '/vcon/storage': 'Storage', '/vcon/files': 'Files Manager', '/vcon/sdk': 'Client SDKs', '/vcon/simulator': 'Simulator', '/vcon/team': 'Team & RBAC', '/vcon/audit': 'Audit Log', '/vcon/profile': 'Profile', '/vcon/settings': 'Settings', }; export const Navbar: React.FC = ({ onToggleSidebar, showSidebarToggle = false, }) => { const pathname = usePathname(); const [theme, setTheme] = useState<'dark' | 'light'>('dark'); useEffect(() => { const saved = localStorage.getItem('datastack-theme') as 'dark' | 'light' | null; const initial = saved === 'light' ? 'light' : 'dark'; setTheme(initial); document.documentElement.classList.toggle('light', initial === 'light'); document.documentElement.classList.toggle('dark', initial === 'dark'); }, []); const toggleTheme = () => { const nextTheme = theme === 'dark' ? 'light' : 'dark'; setTheme(nextTheme); localStorage.setItem('datastack-theme', nextTheme); document.documentElement.classList.toggle('light', nextTheme === 'light'); document.documentElement.classList.toggle('dark', nextTheme === 'dark'); }; const isVcon = pathname?.startsWith('/vcon'); const currentSectionLabel = (pathname && VCON_LABELS[pathname]) || 'Console'; if (showSidebarToggle && isVcon) { return (
); } return (
DataStack
); }; export default Navbar;