Skip to main content
Glama
sidebar-nav.tsx1.34 kB
"use client"; import { SidebarMenu, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, } from "@repo/ui/components/ui/sidebar"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { memo, useMemo } from "react"; import type { IAppSidebarNavItem } from "./type"; type IProps = { items: IAppSidebarNavItem[]; }; export const SidebarNav = memo(({ items }: IProps) => { const pathname = usePathname(); const navItemList = useMemo(() => { return items.map((item) => ({ ...item, isActive: (pathname: string) => { console.log(pathname, item.url, pathname.includes(item.url)); return pathname.includes(item.url); }, })); }, [items, pathname]); return ( <SidebarMenu> {navItemList.map((item) => ( <SidebarMenuItem key={item.title}> <SidebarMenuButton asChild isActive={item.isActive?.(pathname)}> <Link href={item.url}> {item.icon} <span>{item.title}</span> {item.badge && ( <SidebarMenuBadge className="ml-auto bg-primary text-primary-foreground"> {item.badge} </SidebarMenuBadge> )} </Link> </SidebarMenuButton> </SidebarMenuItem> ))} </SidebarMenu> ); });

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/metacode0602/open-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server