From bc43558c58b6f9e900f8401082c44fac96dd93af Mon Sep 17 00:00:00 2001 From: Dotta Date: Tue, 16 Jun 2026 17:34:05 +0000 Subject: [PATCH] Refine selected-agent chat header layout Co-Authored-By: Paperclip --- ui/src/components/SelectedAgentChat.test.tsx | 44 +++++++++ ui/src/components/SelectedAgentChat.tsx | 99 +++++++++++--------- 2 files changed, 98 insertions(+), 45 deletions(-) diff --git a/ui/src/components/SelectedAgentChat.test.tsx b/ui/src/components/SelectedAgentChat.test.tsx index 177b1f219a5..733332fdc9a 100644 --- a/ui/src/components/SelectedAgentChat.test.tsx +++ b/ui/src/components/SelectedAgentChat.test.tsx @@ -91,6 +91,10 @@ describe("SelectedAgentChatView", () => { flushSync(() => root.render(node)); } + function countText(text: string, needle: string): number { + return text.split(needle).length - 1; + } + it("renders the real selected-agent identity in the header", () => { render( { expect(container.textContent?.toLowerCase()).not.toContain("concierge"); }); + it("uses the left-side selector as the selected-agent identity without repeating the role", () => { + render( + {}} + onTargetAgentChange={() => {}} + />, + ); + + const header = container.querySelector( + '[data-testid="selected-agent-chat-header"]', + ) as HTMLDivElement | null; + const switcher = header?.querySelector('[aria-label="Choose chat agent"]'); + expect(switcher).not.toBeNull(); + expect(switcher?.textContent).toContain("Sarah"); + expect(countText(switcher?.textContent ?? "", "CEO")).toBe(1); + expect(header?.textContent).toBe(switcher?.textContent); + }); + + it("pads the chat body to align with the selected-agent header", () => { + render( + {}} + />, + ); + + const body = container.querySelector( + '[data-testid="selected-agent-chat-body"]', + ) as HTMLDivElement | null; + expect(body).not.toBeNull(); + expect(body?.className).toContain("px-4"); + expect(body?.className).toContain("pt-3"); + expect(body?.className).toContain("pb-4"); + }); + it("shows a loading indicator while the first fetch is in flight", () => { render( {}} />, diff --git a/ui/src/components/SelectedAgentChat.tsx b/ui/src/components/SelectedAgentChat.tsx index 360c613a09b..d93e0f8961e 100644 --- a/ui/src/components/SelectedAgentChat.tsx +++ b/ui/src/components/SelectedAgentChat.tsx @@ -184,28 +184,14 @@ export function SelectedAgentChatView({ return (
{/* Identity header — real selected agent (no board-concierge persona). */} -
+
-
- - - {targetAgent?.icon ? ( - - ) : ( - agentInitials(targetName) - )} - - -
-
{targetName}
- {targetRole ? ( -
{targetRole}
- ) : null} -
-
{canSwitch ? ( - ) : null} + ) : ( +
+ + + {targetAgent?.icon ? ( + + ) : ( + agentInitials(targetName) + )} + + +
+
{targetName}
+ {targetRole ? ( +
{targetRole}
+ ) : null} +
+
+ )}
{errorText ? ( @@ -266,30 +270,35 @@ export function SelectedAgentChatView({
) : ( - +
+ +
)}
);