Skip to content

Commit 4e1a0e8

Browse files
UtkarshUsernametyulyukov
authored andcommitted
feat: show full thread title in a tooltip when hovering sidebar thread names (pingdotgg#1994)
1 parent 3d14852 commit 4e1a0e8

2 files changed

Lines changed: 45 additions & 2 deletions

File tree

apps/web/src/components/ChatView.browser.tsx

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ vi.mock("../lib/gitStatusState", () => ({
5858
}));
5959

6060
const THREAD_ID = "thread-browser-test" as ThreadId;
61+
const THREAD_TITLE = "Browser test thread";
6162
const ARCHIVED_SECONDARY_THREAD_ID = "thread-secondary-project-archived" as ThreadId;
6263
const PROJECT_ID = "project-1" as ProjectId;
6364
const SECOND_PROJECT_ID = "project-2" as ProjectId;
@@ -308,7 +309,7 @@ function createSnapshotForTargetUser(options: {
308309
{
309310
id: THREAD_ID,
310311
projectId: PROJECT_ID,
311-
title: "Browser test thread",
312+
title: THREAD_TITLE,
312313
modelSelection: {
313314
provider: "codex",
314315
model: "gpt-5",
@@ -3292,6 +3293,34 @@ describe("ChatView timeline estimator parity (full app)", () => {
32923293
}
32933294
});
32943295

3296+
it("exposes the full thread title on the sidebar row tooltip", async () => {
3297+
const mounted = await mountChatView({
3298+
viewport: DEFAULT_VIEWPORT,
3299+
snapshot: createSnapshotForTargetUser({
3300+
targetMessageId: "msg-user-thread-tooltip-target" as MessageId,
3301+
targetText: "thread tooltip target",
3302+
}),
3303+
});
3304+
3305+
try {
3306+
const threadTitle = page.getByTestId(`thread-title-${THREAD_ID}`);
3307+
3308+
await expect.element(threadTitle).toBeInTheDocument();
3309+
await threadTitle.hover();
3310+
3311+
await vi.waitFor(
3312+
() => {
3313+
const tooltip = document.querySelector<HTMLElement>('[data-slot="tooltip-popup"]');
3314+
expect(tooltip).not.toBeNull();
3315+
expect(tooltip?.textContent).toContain(THREAD_TITLE);
3316+
},
3317+
{ timeout: 8_000, interval: 16 },
3318+
);
3319+
} finally {
3320+
await mounted.cleanup();
3321+
}
3322+
});
3323+
32953324
it("shows the confirm archive action after clicking the archive button", async () => {
32963325
localStorage.setItem(
32973326
"marcode:client-settings:v1",

apps/web/src/components/Sidebar.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,21 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
551551
onClick={handleRenameInputClick}
552552
/>
553553
) : (
554-
<span className="min-w-0 flex-1 truncate text-xs">{thread.title}</span>
554+
<Tooltip>
555+
<TooltipTrigger
556+
render={
557+
<span
558+
className="min-w-0 flex-1 truncate text-xs"
559+
data-testid={`thread-title-${thread.id}`}
560+
>
561+
{thread.title}
562+
</span>
563+
}
564+
/>
565+
<TooltipPopup side="top" className="max-w-80 whitespace-normal leading-tight">
566+
{thread.title}
567+
</TooltipPopup>
568+
</Tooltip>
555569
)}
556570
</div>
557571
<div className="ml-auto flex shrink-0 items-center gap-1.5">

0 commit comments

Comments
 (0)