);
}
function SubLink({
item,
pathname,
search,
siblingClaims,
nested,
}: {
item: NavItem;
pathname: string;
search: string;
siblingClaims: boolean;
nested: NavAccordion;
}) {
const { counts } = useSeoBadges();
const count = navCount(counts, item.to);
// A link carrying a query (?tab=) decides its own active state, or every
// sibling on the same pathname would light at once.
const byQuery = searchLinkActive(pathname, search, item);
if (item.children && item.menuKey) {
return (
);
}
if (item.external) {
return (
}
>
{item.label}
);
}
return (
classNames(
'flex items-center gap-2 rounded-[10px] px-2.5 py-1.5 text-[13px] transition-colors hover:bg-nav-hover',
(byQuery ?? (isActive && !siblingClaims))
? 'font-medium text-nav-foreground'
: 'text-nav-idle hover:text-nav-foreground'
)
}
/>
}
>
{item.label}
{item.badge && }
{count && }
);
}
/**
* A page with rows of its own under it (the checkup's groups, a settings
* page's sections): the page link with a chevron, then the rows, open on
* the page you are on and one at a time otherwise.
*/
function SubTree({
item,
pathname,
search,
nested,
count,
}: {
item: NavItem;
pathname: string;
search: string;
nested: NavAccordion;
count: ReturnType;
}) {
const { counts } = useSeoBadges();
const menuKey = item.menuKey ?? item.label;
const open = nested.isOpen(menuKey);
const page = (item.to ?? '').split('?')[0];
const onPage = pathname === page;
return (
}
>
{item.label}
{count && }
{open && (
{(item.children ?? []).map(child => {
if (!child.to) {
return (