(props: { pathname: string; onNavigate?: () => void })
| 57 | // slash stripped. |
| 58 | |
| 59 | function PluginNav(props: { pathname: string; onNavigate?: () => void }) { |
| 60 | const plugins = useClientPlugins(); |
| 61 | const entries = plugins.flatMap((plugin) => |
| 62 | (plugin.pages ?? []) |
| 63 | .filter((page) => page.nav) |
| 64 | .map((page) => { |
| 65 | const splat = page.path.replace(/^\//, ""); |
| 66 | const href = `/plugins/${plugin.id}${splat ? `/${splat}` : "/"}`; |
| 67 | return { |
| 68 | key: `${plugin.id}:${page.path}`, |
| 69 | pluginId: plugin.id, |
| 70 | splat, |
| 71 | href, |
| 72 | label: page.nav!.label, |
| 73 | }; |
| 74 | }), |
| 75 | ); |
| 76 | if (entries.length === 0) return null; |
| 77 | return ( |
| 78 | <> |
| 79 | {entries.map((entry) => ( |
| 80 | <Link |
| 81 | key={entry.key} |
| 82 | to="/{-$orgSlug}/plugins/$pluginId/$" |
| 83 | params={{ pluginId: entry.pluginId, _splat: entry.splat }} |
| 84 | onClick={props.onNavigate} |
| 85 | className={[ |
| 86 | "flex items-center gap-2.5 rounded-md px-2.5 py-1.5 text-sm transition-colors", |
| 87 | props.pathname === entry.href || props.pathname.startsWith(`${entry.href}/`) |
| 88 | ? "bg-sidebar-active text-foreground font-medium" |
| 89 | : "text-sidebar-foreground hover:bg-sidebar-active/60 hover:text-foreground", |
| 90 | ].join(" ")} |
| 91 | > |
| 92 | {entry.label} |
| 93 | </Link> |
| 94 | ))} |
| 95 | </> |
| 96 | ); |
| 97 | } |
| 98 | |
| 99 | // ── IntegrationList ─────────────────────────────────────────────────────────── |
| 100 |
nothing calls this directly
no test coverage detected