Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript
477 B
Raw Blame
import { isControlRouteSection } from '@constants/routes'
import type { SidebarChildItem } from './types'

export function activeSidebarChildHref(
  pathname: string,
  children: readonly SidebarChildItem[]
): string | undefined {
  return children
    .filter(child => isControlRouteSection(pathname, child.matchPath ?? child.href))
    .sort(
      (first, second) =>
        (second.matchPath ?? second.href).length - (first.matchPath ?? first.href).length
    )[0]?.href
}