'use client'; import { Button } from '@/components/ui/Button'; import { Icon } from '@/components/ui/Icon'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; import React, { useEffect, useState } from 'react'; interface NavbarProps { onToggleSidebar?: () => void; showSidebarToggle?: boolean; } 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 || 'dark'; setTheme(initial); if (initial === 'light') { document.documentElement.classList.remove('dark'); document.documentElement.classList.add('light'); } else { document.documentElement.classList.add('dark'); document.documentElement.classList.remove('light'); } }, []); const toggleTheme = () => { const nextTheme = theme === 'dark' ? 'light' : 'dark'; setTheme(nextTheme); localStorage.setItem('datastack-theme', nextTheme); if (nextTheme === 'light') { document.documentElement.classList.remove('dark'); document.documentElement.classList.add('light'); } else { document.documentElement.classList.add('dark'); document.documentElement.classList.remove('light'); } }; const isVcon = pathname?.startsWith('/vcon'); return (
{/* Left: Mobile hamburger + Brand */}
{showSidebarToggle && ( )} DataStack {isVcon && ( v2.4 )}
{/* Middle: Links */} {/* Right: Admin runtime indicators or public feature action */}
{isVcon && (
:4000 | :3000
)} {!isVcon && ( )}
); }; export default Navbar;