diff --git a/src/components/cortex/CortexDesktopLayout.tsx b/src/components/cortex/CortexDesktopLayout.tsx index d413536..5c31c4f 100644 --- a/src/components/cortex/CortexDesktopLayout.tsx +++ b/src/components/cortex/CortexDesktopLayout.tsx @@ -233,7 +233,7 @@ export function CortexDesktopLayout(props: ParentProps) { "view:agents": (() => { setSidebarTab("agents"); setSidebarCollapsed(false); }) as EventListener, "sidebar:toggle": (() => setSidebarCollapsed(!sidebarCollapsed())) as EventListener, "selection:select-all": (() => document.execCommand("selectAll")) as EventListener, - "help:docs": (() => window.open("https://docs.cortex.dev", "_blank")) as EventListener, + "help:docs": (() => { setSidebarTab("docs"); setSidebarCollapsed(false); }) as EventListener, "terminal:toggle": (() => { if (bottomPanelCollapsed()) { setBottomPanelCollapsed(false); setBottomPanelTab("terminal"); } else if (bottomPanelTab() === "terminal") { setBottomPanelCollapsed(true); } else { setBottomPanelTab("terminal"); } }) as EventListener, "layout:toggle-panel": (() => setBottomPanelCollapsed(!bottomPanelCollapsed())) as EventListener, "ai:modifications:toggle": (() => setShowAIModifications((prev) => !prev)) as EventListener, diff --git a/src/components/cortex/__tests__/SidebarNavigation.integration.test.tsx b/src/components/cortex/__tests__/SidebarNavigation.integration.test.tsx index 2c6760a..e1cbab3 100644 --- a/src/components/cortex/__tests__/SidebarNavigation.integration.test.tsx +++ b/src/components/cortex/__tests__/SidebarNavigation.integration.test.tsx @@ -104,6 +104,10 @@ vi.mock("@/components/cortex/CortexAccountPanel", () => ({ CortexAccountPanel: () =>
Account Panel
, })); +vi.mock("@/components/cortex/CortexDocumentationPanel", () => ({ + CortexDocumentationPanel: () =>
Documentation Panel
, +})); + const STORAGE_KEYS = { sidebarTab: "figma_layout_sidebar_tab", sidebarCollapsed: "figma_layout_sidebar_collapsed", @@ -119,6 +123,7 @@ const NAV_ITEMS: ActivityBarItem[] = [ { id: "agents", icon: "users", label: "AI Agents" }, { id: "extensions", icon: "grid", label: "Extensions" }, { id: "themes", icon: "brush", label: "Themes" }, + { id: "docs", icon: "book", label: "Documentation" }, ]; function SidebarIntegrationWrapper(props: { initialTab?: SidebarTab; initialCollapsed?: boolean }) { @@ -311,6 +316,19 @@ describe("SidebarNavigation Integration", () => { expect(panel).toBeTruthy(); expect(panel.textContent).toContain("Account Panel"); }); + + it("clicking 'docs' shows documentation panel", async () => { + const { container, findByTestId } = render(() => ); + + const docsButton = container.querySelector('button[aria-label="Documentation"]'); + expect(docsButton).toBeTruthy(); + + await fireEvent.click(docsButton!); + + const panel = await findByTestId("panel-docs"); + expect(panel).toBeTruthy(); + expect(panel.textContent).toContain("Documentation Panel"); + }); }); describe("Collapse and Expand", () => {