From f9633ae844e326c4bd09031fbcf1ccf5b085ff31 Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Mon, 26 Oct 2026 08:12:51 -0400 Subject: [PATCH 1/2] fix(sidebar): highlight rationguard, promptargs and dibs as the current project Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- .../fixed-482-sidebar-current-project.md | 1 + src/__tests__/RelatedProjects.behavior.test.tsx | 17 +++++++++++++++-- src/components/docs/RelatedProjects.tsx | 11 +++++------ 3 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 changelog.d/fixed-482-sidebar-current-project.md diff --git a/changelog.d/fixed-482-sidebar-current-project.md b/changelog.d/fixed-482-sidebar-current-project.md new file mode 100644 index 00000000..17c051f2 --- /dev/null +++ b/changelog.d/fixed-482-sidebar-current-project.md @@ -0,0 +1 @@ +- The docs sidebar now highlights rationguard, promptargs and dibs on their own pages instead of Hive; the current project is derived from the project hrefs (hivecommons/docs#482). diff --git a/src/__tests__/RelatedProjects.behavior.test.tsx b/src/__tests__/RelatedProjects.behavior.test.tsx index 7c6bf67d..72741af1 100644 --- a/src/__tests__/RelatedProjects.behavior.test.tsx +++ b/src/__tests__/RelatedProjects.behavior.test.tsx @@ -98,6 +98,19 @@ describe("project list and highlighting", () => { expect(inactive.className).not.toContain("font-medium"); }); + it("highlights projects without a hard-coded prefix, not Hive", () => { + pathname = "/docs/rationguard/overview/introduction"; + useSharedConfigMock.mockReturnValue({ + config: configWith([ + { title: "Hive", href: "/docs/hive/overview/introduction" }, + { title: "rationguard", href: "/docs/rationguard/overview/introduction" }, + ]), + }); + render(); + expect(screen.getByText("rationguard").className).toContain("font-medium"); + expect(screen.getByText("Hive").className).not.toContain("font-medium"); + }); + it("falls back to Hive when no section prefix matches", () => { pathname = "/docs/something-else"; render(); @@ -203,8 +216,8 @@ describe("renderLegacyMenuTree", () => { function renderTree() { // The tree renders only under the *current* secondary project, and - // getCurrentProject() recognizes a fixed set of pathname prefixes, so the - // secondary project must be one of those (pluk here). + // getCurrentProject() matches the pathname against the project hrefs, so + // the secondary project's href must be a prefix of the pathname. pathname = "/docs/pluk"; useSharedConfigMock.mockReturnValue({ config: configWith([ diff --git a/src/components/docs/RelatedProjects.tsx b/src/components/docs/RelatedProjects.tsx index 21335d75..1d3f1ab7 100644 --- a/src/components/docs/RelatedProjects.tsx +++ b/src/components/docs/RelatedProjects.tsx @@ -222,12 +222,11 @@ export function RelatedProjects({ variant = 'full', onCollapse, bannerActive = f // Determine current project or section from pathname // THIS HIGHLIGHTS THE ACTIVE PROJECT/SECTION IN THE PROJECT LIST IN THE SIDEBAR const getCurrentProject = () => { - if (pathname.startsWith('/docs/hotshot')) return 'hotshot'; - if (pathname.startsWith('/docs/a2a')) return 'A2A'; - if (pathname.startsWith('/docs/kubeflex')) return 'KubeFlex'; - if (pathname.startsWith('/docs/multi-plugin')) return 'Multi Plugin'; - if (pathname.startsWith('/docs/pluk')) return 'pluk'; - if (pathname.startsWith('/docs/spektacular')) return 'Spektacular'; + const matched = allProjects.find((project) => { + const base = `/docs/${project.href.split('/')[2]}`; + return pathname === base || pathname.startsWith(`${base}/`); + }); + if (matched) return matched.title; if (pathname.startsWith('/docs/contributing')) return 'Contributing'; if (pathname.startsWith('/docs/community')) return 'Community'; if (pathname.startsWith('/docs/news')) return 'News'; From f5a7daff533b522ef21aaa54ccf40fa633d6b9ea Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Mon, 26 Oct 2026 08:21:19 -0400 Subject: [PATCH 2/2] fix(sidebar): wrap test fixture line for Prettier Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- src/__tests__/RelatedProjects.behavior.test.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/__tests__/RelatedProjects.behavior.test.tsx b/src/__tests__/RelatedProjects.behavior.test.tsx index 72741af1..9ec5af83 100644 --- a/src/__tests__/RelatedProjects.behavior.test.tsx +++ b/src/__tests__/RelatedProjects.behavior.test.tsx @@ -103,7 +103,10 @@ describe("project list and highlighting", () => { useSharedConfigMock.mockReturnValue({ config: configWith([ { title: "Hive", href: "/docs/hive/overview/introduction" }, - { title: "rationguard", href: "/docs/rationguard/overview/introduction" }, + { + title: "rationguard", + href: "/docs/rationguard/overview/introduction", + }, ]), }); render();