"use client"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { useT } from "@/app/lib/i18n/MessagesProvider"; import { cn } from "@/app/lib/utils"; // The Network sidebar node lands on the genealogy tree; this sub-nav also reaches Company/HQ account // management (openspec/changes/add-admin-company-account-crud, Part C) for in-context navigation — // same pattern as app/wallet/WalletTabs.tsx. Both /network and /network/company-accounts are gated // by the same BO_NETWORK module (see routeModules.ts); company accounts is a sub-nav surface within // Network, not a separate sidebar node. const TABS: { href: string; labelKey: string }[] = [ { href: "/network", labelKey: "NetworkTitle" }, { href: "/network/company-accounts", labelKey: "CompanyAccountsTitle" }, ]; /** Active when the current path is the tab's route or nested under it — exact for the tree root * (so a /network?root= query change does not affect the match, and the Company Accounts * route never lights up the Network tab). Tolerates a null pathname (usePathname can be null * outside a router context). */ function isActive(pathname: string | null, href: string): boolean { if (!pathname) return false; return href === "/network" ? pathname === "/network" : pathname === href || pathname.startsWith(`${href}/`); } /** Sub-navigation for the Network section, shared by every page under /network. */ export default function NetworkTabs() { const t = useT(); const pathname = usePathname(); return ( ); }