useActiveMenuLabel() — supabase Function Reference
Architecture documentation for the useActiveMenuLabel() function in GlobalNavigationMenu.tsx from the supabase codebase.
Entity Profile
Dependency Diagram
graph TD 6b24c547_76b2_a6b3_c5ce_f64931f9696a["useActiveMenuLabel()"] 66f8c08c_e430_be77_02f9_6c4b92fbbc4e["AccordionMenuItem()"] 66f8c08c_e430_be77_02f9_6c4b92fbbc4e -->|calls| 6b24c547_76b2_a6b3_c5ce_f64931f9696a 3d3f13dc_0f46_0e7d_3205_788dc6fc2cc9["GlobalNavigationMenu()"] 3d3f13dc_0f46_0e7d_3205_788dc6fc2cc9 -->|calls| 6b24c547_76b2_a6b3_c5ce_f64931f9696a style 6b24c547_76b2_a6b3_c5ce_f64931f9696a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/docs/components/Navigation/NavigationMenu/GlobalNavigationMenu.tsx lines 25–57
export const useActiveMenuLabel = (menu: typeof GLOBAL_MENU_ITEMS) => {
const pathname = usePathname()
const [activeLabel, setActiveLabel] = useState('')
useEffect(() => {
// check if homepage
if (pathname === '/') {
return setActiveLabel('Home')
}
for (let index = 0; index < menu.length; index++) {
const section = menu[index]
if (section[0].enabled === false) continue
// check if first level menu items match beginning of url
if (section[0].href?.startsWith(pathname)) {
return setActiveLabel(section[0].label)
}
// check if second level menu items match beginning of url
if (section[0].menuItems) {
section[0].menuItems.map((menuItemGroup) =>
menuItemGroup
.filter((menuItem) => menuItem.enabled !== false)
.map(
(menuItem) => menuItem.href?.startsWith(pathname) && setActiveLabel(section[0].label)
)
)
}
}
}, [pathname, menu])
return activeLabel
}
Domain
Subdomains
Source
Frequently Asked Questions
What does useActiveMenuLabel() do?
useActiveMenuLabel() is a function in the supabase codebase.
What calls useActiveMenuLabel()?
useActiveMenuLabel() is called by 2 function(s): AccordionMenuItem, GlobalNavigationMenu.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free