import { type Component, Show } from 'solid-js'; import { A, useLocation } from '@solidjs/router'; import { BrainCircuit, Settings, LogOut, Menu, Shield } from 'lucide-solid'; import { useAuth } from '~/contexts/AuthContext'; import { useI18n } from '~/i18n'; interface NavbarProps { onToggleMobile: () => void; } /** * Top navigation bar visible on all authenticated pages. * * - **Active route detection**: The current pathname is compared against each * link's `href` to apply a highlighted bottom-border style. * - **Admin link visibility**: The admin navigation link is only rendered * when `isAdmin()` is true, using a prefix match on `/admin` for the * active state so all admin sub-routes highlight the same tab. */ const Navbar: Component = (props) => { const { user, isAdmin, logout } = useAuth(); const location = useLocation(); const { t } = useI18n(); const isActive = (path: string) => location.pathname === path ? 'border-indigo-500 text-gray-900' : 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700'; return ( ); }; export default Navbar;