diff --git a/components/Icon/resolver.tsx b/components/Icon/resolver.tsx index a33aa707c..45900af60 100644 --- a/components/Icon/resolver.tsx +++ b/components/Icon/resolver.tsx @@ -276,6 +276,9 @@ export const Icons = { clock: () => ( ), + disc: () => ( + + ), files: () => ( ), diff --git a/components/SideMenu/SideMenu.tsx b/components/SideMenu/SideMenu.tsx index 5a1adbf14..8a3a6bc5a 100644 --- a/components/SideMenu/SideMenu.tsx +++ b/components/SideMenu/SideMenu.tsx @@ -14,6 +14,7 @@ import AgentsNavItem from "../Sidebar/AgentsNavItem"; import { usePathname } from "next/navigation"; import TasksNavItem from "../Sidebar/TasksNavItem"; import FilesNavItem from "../Sidebar/FilesNavItem"; +import CatalogsNavItem from "../Sidebar/CatalogsNavItem"; const SideMenu = ({ isVisible, @@ -33,6 +34,7 @@ const SideMenu = ({ const isAgents = pathname.includes("/agents"); const isTasks = pathname.includes("/tasks"); const isFiles = pathname.includes("/files"); + const isCatalogs = pathname.includes("/catalogs"); const goToItem = (link?: string) => { if (isPrepared()) { @@ -88,6 +90,10 @@ const SideMenu = ({ )}
+ goToItem("catalogs")} + /> goToItem("agents")} diff --git a/components/Sidebar/CatalogsNavItem.tsx b/components/Sidebar/CatalogsNavItem.tsx new file mode 100644 index 000000000..028a6281c --- /dev/null +++ b/components/Sidebar/CatalogsNavItem.tsx @@ -0,0 +1,26 @@ +import NavButton from "./NavButton"; + +export interface CatalogsNavItemProps { + isActive: boolean; + isExpanded?: boolean; + onClick: () => void; +} + +const CatalogsNavItem = ({ + isActive, + isExpanded, + onClick, +}: CatalogsNavItemProps) => { + return ( + + ); +}; + +export default CatalogsNavItem; diff --git a/components/Sidebar/Menu.tsx b/components/Sidebar/Menu.tsx index a1e6f9354..79bc500f0 100644 --- a/components/Sidebar/Menu.tsx +++ b/components/Sidebar/Menu.tsx @@ -24,6 +24,7 @@ const Menu = ({ isExpanded, isPinned = false, onTogglePin }: MenuProps) => { const isAgents = pathname.includes("/agents"); const isTasks = pathname.includes("/tasks"); const isFiles = pathname.includes("/files"); + const isCatalogs = pathname.includes("/catalogs"); const goToItem = (link?: string) => { if (isPrepared()) { @@ -47,6 +48,7 @@ const Menu = ({ isExpanded, isPinned = false, onTogglePin }: MenuProps) => { isAgents={isAgents} isTasks={isTasks} isFiles={isFiles} + isCatalogs={isCatalogs} onNavigate={goToItem} /> diff --git a/components/Sidebar/SecondaryNav.tsx b/components/Sidebar/SecondaryNav.tsx index a506270b3..6888c5698 100644 --- a/components/Sidebar/SecondaryNav.tsx +++ b/components/Sidebar/SecondaryNav.tsx @@ -1,12 +1,14 @@ import AgentsNavItem from "./AgentsNavItem"; import TasksNavItem from "./TasksNavItem"; import FilesNavItem from "./FilesNavItem"; +import CatalogsNavItem from "./CatalogsNavItem"; interface SecondaryNavProps { isExpanded: boolean; isAgents: boolean; isTasks: boolean; isFiles: boolean; + isCatalogs: boolean; onNavigate: (path: string) => void; } @@ -15,9 +17,11 @@ const SecondaryNav = ({ isAgents, isTasks, isFiles, + isCatalogs, onNavigate, }: SecondaryNavProps) => (
+ onNavigate("catalogs")} /> onNavigate("agents")} /> onNavigate("tasks")} /> onNavigate("files")} /> diff --git a/components/Sidebar/__tests__/SecondaryNav.test.tsx b/components/Sidebar/__tests__/SecondaryNav.test.tsx new file mode 100644 index 000000000..55df8e970 --- /dev/null +++ b/components/Sidebar/__tests__/SecondaryNav.test.tsx @@ -0,0 +1,54 @@ +// @vitest-environment jsdom +import React from "react"; +import { fireEvent, render, screen } from "@testing-library/react"; +import { describe, expect, it, vi } from "vitest"; +import SecondaryNav from "@/components/Sidebar/SecondaryNav"; + +vi.mock("@/components/Agents/useAgentData", () => ({ + useAgentData: () => ({ prefetchAgents: vi.fn() }), +})); + +const renderNav = (overrides = {}) => { + const onNavigate = vi.fn(); + render( + , + ); + return { onNavigate }; +}; + +describe("SecondaryNav", () => { + // chat#1912 row 3: Catalogs is the valuation payoff surface and was + // reachable only by direct URL, so a customer could not find it from the + // app's own navigation. Reporter and quote live on the issue, not here. + it("links Catalogs alongside the other tools", () => { + renderNav(); + + expect( + screen.getByRole("button", { name: /view catalogs/i }), + ).toBeDefined(); + }); + + it("navigates to the catalogs route when Catalogs is clicked", () => { + const { onNavigate } = renderNav(); + + fireEvent.click(screen.getByRole("button", { name: /view catalogs/i })); + + expect(onNavigate).toHaveBeenCalledWith("catalogs"); + }); + + it("still links the pre-existing tools", () => { + renderNav(); + + expect(screen.getByRole("button", { name: /view agents/i })).toBeDefined(); + expect(screen.getByRole("button", { name: /view tasks/i })).toBeDefined(); + expect(screen.getByRole("button", { name: /view files/i })).toBeDefined(); + }); +});