From 294dbada5ee93e1ed361b973c2a1a68193b7dcae Mon Sep 17 00:00:00 2001 From: alejandrobailo Date: Tue, 30 Jun 2026 11:00:13 +0200 Subject: [PATCH] fix(ui): mark active Lighthouse chat in sidebar --- .../lighthouse-v2-session-history.test.tsx | 43 ++++++++++ .../history/lighthouse-v2-session-history.tsx | 16 +++- .../lighthouse-v2-sidebar-chat.test.tsx | 78 +++++++++++++++++++ .../navigation/lighthouse-v2-sidebar-chat.tsx | 5 +- 4 files changed, 138 insertions(+), 4 deletions(-) create mode 100644 ui/app/(prowler)/lighthouse/_components/navigation/lighthouse-v2-sidebar-chat.test.tsx diff --git a/ui/app/(prowler)/lighthouse/_components/history/lighthouse-v2-session-history.test.tsx b/ui/app/(prowler)/lighthouse/_components/history/lighthouse-v2-session-history.test.tsx index e95f36190d..5eeec16447 100644 --- a/ui/app/(prowler)/lighthouse/_components/history/lighthouse-v2-session-history.test.tsx +++ b/ui/app/(prowler)/lighthouse/_components/history/lighthouse-v2-session-history.test.tsx @@ -112,6 +112,49 @@ describe("LighthouseV2SessionHistory", () => { ).not.toBeInTheDocument(); }); + it("marks the active session with a visible sidebar indicator", () => { + // Given / When + renderHistory({ + activeSessionId: "session-active", + sessions: [ + session({ + id: "session-active", + title: "Active chat", + updatedAt: "2026-06-25T09:00:00Z", + }), + session({ + id: "session-other", + title: "Other chat", + updatedAt: "2026-06-25T09:00:00Z", + }), + ], + }); + + // Then + const activeSessionButton = screen.getByRole("button", { + name: /Active chat.*Today/, + }); + const otherSessionButton = screen.getByRole("button", { + name: /Other chat.*Today/, + }); + const activeSessionTitle = + within(activeSessionButton).getByText("Active chat"); + const otherSessionTitle = + within(otherSessionButton).getByText("Other chat"); + + expect(activeSessionButton.parentElement).toHaveClass( + "before:bg-button-primary", + "before:absolute", + "before:left-0", + ); + expect(activeSessionButton).toHaveClass("text-text-neutral-primary"); + expect(activeSessionTitle).toHaveClass("font-medium"); + expect(otherSessionButton.parentElement).not.toHaveClass( + "before:bg-button-primary", + ); + expect(otherSessionTitle).not.toHaveClass("font-medium"); + }); + it("replaces the age label with the archive action on row hover", () => { // Given / When renderHistory({ diff --git a/ui/app/(prowler)/lighthouse/_components/history/lighthouse-v2-session-history.tsx b/ui/app/(prowler)/lighthouse/_components/history/lighthouse-v2-session-history.tsx index 62d35e57f1..9ccc3e6dd4 100644 --- a/ui/app/(prowler)/lighthouse/_components/history/lighthouse-v2-session-history.tsx +++ b/ui/app/(prowler)/lighthouse/_components/history/lighthouse-v2-session-history.tsx @@ -88,23 +88,33 @@ export function LighthouseV2SessionHistory({
{visibleSessions.map((session) => { const sessionTitle = session.title || "Untitled chat"; + const isActive = activeSessionId === session.id; return (