Skip to content

🙌 OpenHands: AI-Driven Development

feat(sidebar): conversation list filters, grouping, and loading UX (#530)

FraterCCCLXIII5ea55eaa9eb9
diff --git a/__tests__/api/agent-server-adapter.test.ts b/__tests__/api/agent-server-adapter.test.ts
index cb3bc972fd..b9b61501b9 100644
--- a/__tests__/api/agent-server-adapter.test.ts
+++ b/__tests__/api/agent-server-adapter.test.ts
@@ -7,6 +7,10 @@ import {
toAppConversation,
type DirectConversationInfo,
} from "#/api/agent-server-adapter";
+import {
+ removeStoredConversationMetadata,
+ setStoredConversationMetadata,
+} from "#/api/conversation-metadata-store";
import { DEFAULT_SETTINGS } from "#/services/settings";
const {
@@ -426,6 +430,24 @@ describe("toAppConversation", () => {
});
expect(result.title).toBe("My real title");
});
+
+ it("hydrates selected_workspace from stored metadata so the sidebar can group by it", () => {
+ setStoredConversationMetadata(baseInfo.id, {
+ selected_repository: null,
+ selected_branch: null,
+ git_provider: null,
+ selected_workspace: "/workspace/agent-server-gui",
+ });
+ try {
+ const result = toAppConversation({
+ ...baseInfo,
+ workspace: { working_dir: "/workspace/agent-server-gui/wt-abc" },
+ });
+ expect(result.selected_workspace).toBe("/workspace/agent-server-gui");
+ } finally {
+ removeStoredConversationMetadata(baseInfo.id);
+ }
+ });
});
describe("buildRuntimeServicesSystemSuffix", () => {
diff --git a/__tests__/components/features/conversation-panel/conversation-panel-list-helpers.test.ts b/__tests__/components/features/conversation-panel/conversation-panel-list-helpers.test.ts
new file mode 100644
index 0000000000..bf87a56efd
--- /dev/null
+++ b/__tests__/components/features/conversation-panel/conversation-panel-list-helpers.test.ts
@@ -0,0 +1,329 @@
+import { describe, expect, it } from "vitest";
+import {
+ groupConversations,
+ parseConversationTimeMs,
+ sortConversationsByField,
+} from "#/components/features/conversation-panel/conversation-panel-list-helpers";
+import type { AppConversation } from "#/api/conversation-service/agent-server-conversation-service.types";
+import { ExecutionStatus } from "#/types/agent-server/core";
+
+const base: Omit<AppConversation, "id" | "title" | "workspace"> = {
+ selected_repository: null,
+ selected_branch: null,
+ git_provider: null,
+ updated_at: "2024-01-02T00:00:00.000Z",
+ created_at: "2024-01-01T00:00:00.000Z",
+ execution_status: ExecutionStatus.FINISHED,
+ conversation_url: null,
+ created_by_user_id: null,
+ metrics: null,
+ llm_model: null,
+ trigger: null,
+ pr_number: [],
+ session_api_key: null,
+ sandbox_id: null,
+ sub_conversation_ids: [],
+};
+
+describe("conversation-panel-list-helpers", () => {
+ it("parseConversationTimeMs returns 0 for missing or unparseable timestamps and ms for ISO strings", () => {
+ // Three branches in one assertion: missing input (undefined), malformed
+ // string (NaN from Date.parse), and a real ISO timestamp.
+ expect([
+ parseConversationTimeMs(undefined),
+ parseConversationTimeMs("not-a-date"),
+ parseConversationTimeMs("2024-01-02T00:00:00.000Z"),
+ ]).toEqual([0, 0, Date.UTC(2024, 0, 2)]);
+ });
+
+ it("sorts by updated desc", () => {
+ const a: AppConversation = {
+ ...base,
+ id: "a",
+ title: "a",
+ updated_at: "2024-01-01T00:00:00.000Z",
+ created_at: "2024-01-01T00:00:00.000Z",
+ };
+ const b: AppConversation = {
+ ...base,
+ id: "b",
+ title: "b",
+ updated_at: "2024-01-03T00:00:00.000Z",
+ created_at: "2024-01-01T00:00:00.000Z",
+ };
+ expect(
+ sortConversationsByField([a, b], "updated").map((c) => c.id),
+ ).toEqual(["b", "a"]);
+ });
+
+ it("sorts by created desc independently of updated", () => {
+ // Inverted: the newer `created_at` belongs to the older `updated_at`,
+ // so a "created" sort must NOT fall through to `updated_at`.
+ const a: AppConversation = {
+ ...base,
+ id: "a",
+ title: "a",
+ created_at: "2024-01-05T00:00:00.000Z",
+ updated_at: "2024-01-01T00:00:00.000Z",
+ };
+ const b: AppConversation = {
+ ...base,
+ id: "b",
+ title: "b",
+ created_at: "2024-01-02T00:00:00.000Z",
+ updated_at: "2024-01-10T00:00:00.000Z",
+ };
+ expect(
+ sortConversationsByField([b, a], "created").map((c) => c.id),
+ ).toEqual(["a", "b"]);
+ });
+
+ it("normalizes group keys and labels across edge-case inputs", () => {
+ // Bundles edge cases the implementation must handle into one assertion
+ // so each is covered without proliferating tests:
+ // - workspace paths with trailing slashes are normalized
+ // - whitespace-only `selected_workspace` falls back to "No workspace"
+ // - root-only paths ("/", "///") trim+strip to "" and bucket to the
+ // "no workspace" / "no repository" fallback instead of producing
+ // stray `ws:` / `repo:/` groups
+ // - repository paths ignore trailing slashes (so `org/repo` and
+ // `org/repo/` collapse into the same group)
+ // - repository names ending in `.git` strip the suffix in the label
+ // - missing/invalid timestamps don't break group ordering (they sort
+ // to the bottom rather than throwing)
+ const trailingSlash: AppConversation = {
+ ...base,
+ id: "ws-trailing",
+ title: "ws-trailing",
+ selected_workspace: "/workspace/agent-server-gui///",
+ updated_at: "2024-01-04T00:00:00.000Z",
+ };
+ const whitespaceOnly: AppConversation = {
+ ...base,
+ id: "ws-blank",
+ title: "ws-blank",
+ selected_workspace: " ",
+ updated_at: "2024-01-02T00:00:00.000Z",
+ };
+ const rootOnly: AppConversation = {
+ ...base,
+ id: "ws-root",
+ title: "ws-root",
+ selected_workspace: "/",
+ updated_at: "2024-01-03T00:00:00.000Z",
+ };
+ const localGroups = groupConversations(
+ [trailingSlash, whitespaceOnly, rootOnly],
+ "local",
+ "updated",
+ { emptyWorkspace: "No workspace", emptyRepository: "No repository" },
+ );
+ expect(
+ localGroups.map((g) => ({
+ id: g.id,
+ label: g.label,
+ ids: g.conversations.map((c) => c.id),
+ })),
+ ).toEqual([
+ {
+ id: "ws:/workspace/agent-server-gui",
+ label: "agent-server-gui",
+ ids: ["ws-trailing"],
+ },
+ // Both whitespace-only and "/" collapse into the same fallback
+ // bucket — ordered by updated_at desc within the group.
+ {
+ id: "__none_workspace",
+ label: "No workspace",
+ ids: ["ws-root", "ws-blank"],
+ },
+ ]);
+
+ const dotGit: AppConversation = {
+ ...base,
+ id: "repo-git",
+ title: "repo-git",
+ selected_repository: "org/canvas.git",
+ // Unparseable timestamp — must not throw; falls to 0 ms and sorts last.
+ updated_at: "not-a-date",
+ };
+ const repoTrailingSlash: AppConversation = {
+ ...base,
+ id: "repo-slash",
+ title: "repo-slash",
+ // Same logical repo as `dotGit` would be without `.git`; with the
+ // trailing-slash normalization both forms must collapse together
+ // when they share the same path.
+ selected_repository: "org/sdk/",
+ updated_at: "2024-01-05T00:00:00.000Z",
+ };
+ const repoNoSlash: AppConversation = {
+ ...base,
+ id: "repo-noslash",
+ title: "repo-noslash",
+ selected_repository: "org/sdk",
+ updated_at: "2024-01-06T00:00:00.000Z",
+ };
+ const blankRepo: AppConversation = {
+ ...base,
+ id: "repo-blank",
+ title: "repo-blank",
+ selected_repository: " ",
+ updated_at: "2024-01-04T00:00:00.000Z",
+ };
+ const rootRepo: AppConversation = {
+ ...base,
+ id: "repo-root",
+ title: "repo-root",
+ selected_repository: "/",
+ updated_at: "2024-01-03T00:00:00.000Z",
+ };
+ const cloudGroups = groupConversations(
+ [dotGit, repoTrailingSlash, repoNoSlash, blankRepo, rootRepo],
+ "cloud",
+ "updated",
+ { emptyWorkspace: "No workspace", emptyRepository: "No repository" },
+ );
+ expect(
+ cloudGroups.map((g) => ({
+ id: g.id,
+ label: g.label,
+ ids: g.conversations.map((c) => c.id),
+ })),
+ ).toEqual([
+ // `org/sdk` and `org/sdk/` collapse to one group.
+ {
+ id: "repo:org/sdk",
+ label: "sdk",
+ ids: ["repo-noslash", "repo-slash"],
+ },
+ // Whitespace and "/" both bucket into the empty-repo fallback,
+ // sorted by updated_at desc within the group.
+ {
+ id: "__none_repo",
+ label: "No repository",
+ ids: ["repo-blank", "repo-root"],
+ },
+ {
+ id: "repo:org/canvas.git",
+ label: "canvas",
+ ids: ["repo-git"],
+ },
+ ]);
+ });
+
+ it("groups local conversations by selected_workspace, collapsing per-conversation worktree paths", () => {
+ // Two conversations launched against the same workspace but with
+ // different per-conversation worktree dirs (the agent-server runs
+ // with worktree: true). They must end up in a single group keyed
+ // off the user-selected workspace, not split by the worktree dir.
+ const sameWsA: AppConversation = {
+ ...base,
+ id: "1",
+ title: "one",
+ selected_workspace: "/workspace/agent-server-gui",
+ workspace: { working_dir: "/workspace/agent-server-gui/wt-abc" },
+ updated_at: "2024-01-02T00:00:00.000Z",
+ };
+ const sameWsB: AppConversation = {
+ ...base,
+ id: "2",
+ title: "two",
+ selected_workspace: "/workspace/agent-server-gui",
+ workspace: { working_dir: "/workspace/agent-server-gui/wt-def" },
+ updated_at: "2024-01-04T00:00:00.000Z",
+ };
+ // Different workspace — its own group.
+ const otherWs: AppConversation = {
+ ...base,
+ id: "3",
+ title: "three",
+ selected_workspace: "/workspace/other",
+ workspace: { working_dir: "/workspace/other/wt-xyz" },
+ updated_at: "2024-01-03T00:00:00.000Z",
+ };
+ // No user-selected workspace — must bucket under "No workspace"
+ // even though working_dir is set (to a per-conversation default).
+ const none: AppConversation = {
+ ...base,
+ id: "4",
+ title: "four",
+ selected_workspace: null,
+ workspace: { working_dir: "/workspace/project/agent-canvas/wt-noop" },
+ updated_at: "2024-01-01T00:00:00.000Z",
+ };
+
+ const groups = groupConversations(
+ [sameWsA, sameWsB, otherWs, none],
+ "local",
+ "updated",
+ { emptyWorkspace: "No workspace", emptyRepository: "No repository" },
+ );
+
+ expect(
+ groups.map((g) => ({
+ id: g.id,
+ label: g.label,
+ ids: g.conversations.map((c) => c.id),
+ launch: g.launch,
+ })),
+ ).toEqual([
+ {
+ id: "ws:/workspace/agent-server-gui",
+ label: "agent-server-gui",
+ ids: ["2", "1"],
+ launch: { workingDir: "/workspace/agent-server-gui" },
+ },
+ {
+ id: "ws:/workspace/other",
+ label: "other",
+ ids: ["3"],
+ launch: { workingDir: "/workspace/other" },
+ },
+ {
+ id: "__none_workspace",
+ label: "No workspace",
+ ids: ["4"],
+ launch: {},
+ },
+ ]);
+ });
+
+ it("groups cloud conversations by repository string", () => {
+ const r1: AppConversation = {
+ ...base,
+ id: "1",
+ title: "one",
+ selected_repository: "org/agent-canvas",
+ updated_at: "2024-01-02T00:00:00.000Z",
+ };
+ const r2: AppConversation = {
+ ...base,
+ id: "2",
+ title: "two",
+ selected_repository: "org/sdk",
+ updated_at: "2024-01-03T00:00:00.000Z",
+ };
+
+ const groups = groupConversations([r1, r2], "cloud", "updated", {
+ emptyWorkspace: "No workspace",
+ emptyRepository: "No repository",
+ });
+
+ expect(groups.map((g) => g.label)).toEqual(["sdk", "agent-canvas"]);
+ expect(groups[0].launch).toEqual({
+ repository: {
+ name: "org/sdk",
+ gitProvider: "github",
+ branch: "main",
+ },
+ });
+ expect(groups[1].launch).toEqual({
+ repository: {
+ name: "org/agent-canvas",
+ gitProvider: "github",
+ branch: "main",
+ },
+ });
+ });
+});
diff --git a/__tests__/components/features/conversation-panel/conversation-panel.test.tsx b/__tests__/components/features/conversation-panel/conversation-panel.test.tsx
index d4f220c889..c014ebfde6 100644
--- a/__tests__/components/features/conversation-panel/conversation-panel.test.tsx
+++ b/__tests__/components/features/conversation-panel/conversation-panel.test.tsx
@@ -339,7 +339,7 @@ describe("ConversationPanel", () => {
const ellipsisButton = within(cards[0]).getByTestId("ellipsis-button");
await user.click(ellipsisButton);
- const deleteButton = within(cards[0]).getByTestId("delete-button");
+ const deleteButton = screen.getByTestId("delete-button");
// Click the first delete button
await user.click(deleteButton);
@@ -393,7 +393,7 @@ describe("ConversationPanel", () => {
const ellipsisButton = within(cards[0]).getByTestId("ellipsis-button");
await user.click(ellipsisButton);
- const deleteButton = within(cards[0]).getByTestId("delete-button");
+ const deleteButton = screen.getByTestId("delete-button");
// Click the first delete button
await user.click(deleteButton);
@@ -575,7 +575,7 @@ describe("ConversationPanel", () => {
await user.click(ellipsisButton);
// Stop button should be available for RUNNING conversation
- const stopButton = within(cards[0]).getByTestId("stop-button");
+ const stopButton = screen.getByTestId("stop-button");
expect(stopButton).toBeInTheDocument();
// Click the stop button
@@ -634,7 +634,7 @@ describe("ConversationPanel", () => {
const ellipsisButton = within(cards[0]).getByTestId("ellipsis-button");
await user.click(ellipsisButton);
- const stopButton = within(cards[0]).getByTestId("stop-button");
+ const stopButton = screen.getByTestId("stop-button");
// Click the stop button
await user.click(stopButton);
@@ -695,7 +695,7 @@ describe("ConversationPanel", () => {
);
await user.click(runningEllipsisButton);
- expect(within(cards[0]).getByTestId("stop-button")).toBeInTheDocument();
+ expect(screen.getByTestId("stop-button")).toBeInTheDocument();
// Click outside to close the menu
await user.click(document.body);
@@ -711,7 +711,7 @@ describe("ConversationPanel", () => {
);
await user.click(startingEllipsisButton);
- expect(within(cards[1]).getByTestId("stop-button")).toBeInTheDocument();
+ expect(screen.getByTestId("stop-button")).toBeInTheDocument();
// Click outside to close the menu
await user.click(document.body);
@@ -727,9 +727,7 @@ describe("ConversationPanel", () => {
);
await user.click(stoppedEllipsisButton);
- expect(
- within(cards[2]).queryByTestId("stop-button"),
- ).not.toBeInTheDocument();
+ expect(screen.queryByTestId("stop-button")).not.toBeInTheDocument();
});
it("should show edit button in context menu", async () => {
@@ -744,7 +742,7 @@ describe("ConversationPanel", () => {
await user.click(ellipsisButton);
// Edit button should be visible within the first card's context menu
- const editButton = within(cards[0]).getByTestId("edit-button");
+ const editButton = screen.getByTestId("edit-button");
expect(editButton).toBeInTheDocument();
expect(editButton).toHaveTextContent("BUTTON$RENAME");
});
@@ -760,7 +758,7 @@ describe("ConversationPanel", () => {
await user.click(ellipsisButton);
// Click edit button within the first card's context menu
- const editButton = within(cards[0]).getByTestId("edit-button");
+ const editButton = screen.getByTestId("edit-button");
await user.click(editButton);
// Should find input field instead of title text
@@ -791,7 +789,7 @@ describe("ConversationPanel", () => {
const ellipsisButton = within(cards[0]).getByTestId("ellipsis-button");
await user.click(ellipsisButton);
- const editButton = within(cards[0]).getByTestId("edit-button");
+ const editButton = screen.getByTestId("edit-button");
await user.click(editButton);
// Edit the title
@@ -828,7 +826,7 @@ describe("ConversationPanel", () => {
const ellipsisButton = within(cards[0]).getByTestId("ellipsis-button");
await user.click(ellipsisButton);
- const editButton = within(cards[0]).getByTestId("edit-button");
+ const editButton = screen.getByTestId("edit-button");
await user.click(editButton);
// Edit the title and press Enter
@@ -863,7 +861,7 @@ describe("ConversationPanel", () => {
const ellipsisButton = within(cards[0]).getByTestId("ellipsis-button");
await user.click(ellipsisButton);
- const editButton = within(cards[0]).getByTestId("edit-button");
+ const editButton = screen.getByTestId("edit-button");
await user.click(editButton);
// Edit the title with extra whitespace
@@ -898,7 +896,7 @@ describe("ConversationPanel", () => {
const ellipsisButton = within(cards[0]).getByTestId("ellipsis-button");
await user.click(ellipsisButton);
- const editButton = within(cards[0]).getByTestId("edit-button");
+ const editButton = screen.getByTestId("edit-button");
await user.click(editButton);
// Clear the title completely
@@ -928,7 +926,7 @@ describe("ConversationPanel", () => {
const ellipsisButton = within(cards[0]).getByTestId("ellipsis-button");
await user.click(ellipsisButton);
- const editButton = within(cards[0]).getByTestId("edit-button");
+ const editButton = screen.getByTestId("edit-button");
await user.click(editButton);
// Edit the title
@@ -959,12 +957,12 @@ describe("ConversationPanel", () => {
const ellipsisButton = within(cards[0]).getByTestId("ellipsis-button");
await user.click(ellipsisButton);
- // Verify context menu is open within the first card
- const contextMenu = within(cards[0]).getByTestId("context-menu");
+ // Verify context menu is open (portaled to document.body)
+ const contextMenu = screen.getByTestId("context-menu");
expect(contextMenu).toBeInTheDocument();
- // Click edit button within the first card's context menu
- const editButton = within(cards[0]).getByTestId("edit-button");
+ // Click edit button within the open context menu
+ const editButton = screen.getByTestId("edit-button");
await user.click(editButton);
// Wait for context menu to close after edit button click.
@@ -992,7 +990,7 @@ describe("ConversationPanel", () => {
const ellipsisButton = within(cards[0]).getByTestId("ellipsis-button");
await user.click(ellipsisButton);
- const editButton = within(cards[0]).getByTestId("edit-button");
+ const editButton = screen.getByTestId("edit-button");
await user.click(editButton);
// Don't change the title, just blur
@@ -1023,7 +1021,7 @@ describe("ConversationPanel", () => {
const ellipsisButton = within(cards[0]).getByTestId("ellipsis-button");
await user.click(ellipsisButton);
- const editButton = within(cards[0]).getByTestId("edit-button");
+ const editButton = screen.getByTestId("edit-button");
await user.click(editButton);
// Edit the title with special characters
@@ -1048,7 +1046,7 @@ describe("ConversationPanel", () => {
// Open context menu and click delete
const ellipsisButton = within(cards[0]).getByTestId("ellipsis-button");
await user.click(ellipsisButton);
- const deleteButton = within(cards[0]).getByTestId("delete-button");
+ const deleteButton = screen.getByTestId("delete-button");
await user.click(deleteButton);
// Modal should be visible
@@ -1104,7 +1102,7 @@ describe("ConversationPanel", () => {
// Open context menu and click stop
const ellipsisButton = within(cards[0]).getByTestId("ellipsis-button");
await user.click(ellipsisButton);
- const stopButton = within(cards[0]).getByTestId("stop-button");
+ const stopButton = screen.getByTestId("stop-button");
await user.click(stopButton);
// Modal should be visible
@@ -1168,7 +1166,7 @@ describe("ConversationPanel", () => {
).toBeInTheDocument();
});
- it("does not render the summary when no conversations are older than 1h", async () => {
+ it("always renders the conversations header with the filter control", async () => {
vi.spyOn(
AgentServerConversationService,
"searchConversations",
@@ -1191,9 +1189,11 @@ describe("ConversationPanel", () => {
renderConversationPanel();
await screen.findAllByTestId("conversation-card");
+ const summary = screen.getByTestId("older-conversations-summary");
+ expect(summary).toBeInTheDocument();
expect(
- screen.queryByTestId("older-conversations-summary"),
- ).not.toBeInTheDocument();
+ within(summary).getByTestId("older-conversations-filter-toggle"),
+ ).toBeInTheDocument();
});
it("toggles older conversations visibility via the filter dropdown", async () => {
@@ -1283,31 +1283,28 @@ describe("ConversationPanel", () => {
).toHaveTextContent("main");
});
- it("delete-all confirms then deletes every older conversation", async () => {
+ it("delete-all is enabled when no conversations are older than the cutoff and deletes every loaded conversation", async () => {
const user = userEvent.setup();
const deleteSpy = vi
.spyOn(AgentServerConversationService, "deleteConversation")
.mockResolvedValue();
+ // Fixture: only recent conversations (none older than 1h). Before the
+ // fix the "Delete all" button was disabled in this state.
vi.spyOn(
AgentServerConversationService,
"searchConversations",
).mockResolvedValue({
items: [
createMockConversation({
- id: "recent",
- title: "Recent",
+ id: "recent-1",
+ title: "Recent 1",
updated_at: recentIso(),
}),
createMockConversation({
- id: "old1",
- title: "Old 1",
- updated_at: olderIso(),
- }),
- createMockConversation({
- id: "old2",
- title: "Old 2",
- updated_at: olderIso(),
+ id: "recent-2",
+ title: "Recent 2",
+ updated_at: recentIso(),
}),
],
next_page_id: null,
@@ -1317,29 +1314,31 @@ describe("ConversationPanel", () => {
await screen.findAllByTestId("conversation-card");
await user.click(screen.getByTestId("older-conversations-filter-toggle"));
- await user.click(screen.getByTestId("delete-older-conversations"));
-
- const confirmButton = await screen.findByRole("button", {
- name: /confirm/i,
- });
- expect(confirmButton).toBeInTheDocument();
+ const deleteAllButton = await screen.findByTestId(
+ "delete-all-conversations",
+ );
+ expect(deleteAllButton).toBeEnabled();
- await user.click(confirmButton);
+ await user.click(deleteAllButton);
+ await user.click(await screen.findByRole("button", { name: /confirm/i }));
await waitFor(() => {
expect(deleteSpy).toHaveBeenCalledTimes(2);
});
- expect(deleteSpy).toHaveBeenCalledWith("old1");
- expect(deleteSpy).toHaveBeenCalledWith("old2");
+ expect(deleteSpy).toHaveBeenCalledWith("recent-1");
+ expect(deleteSpy).toHaveBeenCalledWith("recent-2");
});
- it("shows an error toast and still navigates away when the active older conversation was deleted successfully", async () => {
+ it("navigates away after the active conversation is deleted successfully even when another deletion fails", async () => {
const user = userEvent.setup();
const navigate = vi.fn();
const deleteSpy = vi
.spyOn(AgentServerConversationService, "deleteConversation")
- .mockResolvedValueOnce(undefined)
- .mockRejectedValueOnce(new Error("delete failed"));
+ .mockImplementation(async (conversationId: string) => {
+ if (conversationId === "old2") {
+ throw new Error("delete failed");
+ }
+ });
vi.spyOn(
AgentServerConversationService,
@@ -1365,33 +1364,36 @@ describe("ConversationPanel", () => {
next_page_id: null,
});
+ // Active conversation is "old1" — it is among the conversations that
+ // get deleted successfully, so we should navigate away.
renderConversationPanel({
navigation: { conversationId: "old1", navigate },
});
await screen.findAllByTestId("conversation-card");
await user.click(screen.getByTestId("older-conversations-filter-toggle"));
- await user.click(screen.getByTestId("delete-older-conversations"));
+ await user.click(screen.getByTestId("delete-all-conversations"));
await user.click(await screen.findByRole("button", { name: /confirm/i }));
await waitFor(() => {
- expect(deleteSpy).toHaveBeenCalledTimes(2);
+ expect(deleteSpy).toHaveBeenCalledTimes(3);
});
- expect(deleteSpy).toHaveBeenNthCalledWith(1, "old1");
- expect(deleteSpy).toHaveBeenNthCalledWith(2, "old2");
expect(displayErrorToast).toHaveBeenCalledWith(
"1 conversation could not be deleted.",
);
expect(navigate).toHaveBeenCalledWith("/conversations");
});
- it("does not navigate away when the active older conversation fails to delete", async () => {
+ it("does not navigate away when the active conversation fails to delete", async () => {
const user = userEvent.setup();
const navigate = vi.fn();
const deleteSpy = vi
.spyOn(AgentServerConversationService, "deleteConversation")
- .mockResolvedValueOnce(undefined)
- .mockRejectedValueOnce(new Error("delete failed"));
+ .mockImplementation(async (conversationId: string) => {
+ if (conversationId === "old1") {
+ throw new Error("delete failed");
+ }
+ });
vi.spyOn(
AgentServerConversationService,
@@ -1417,20 +1419,20 @@ describe("ConversationPanel", () => {
next_page_id: null,
});
+ // Active conversation is "old1" — its deletion fails, so we must
+ // not navigate away from it.
renderConversationPanel({
- navigation: { conversationId: "old2", navigate },
+ navigation: { conversationId: "old1", navigate },
});
await screen.findAllByTestId("conversation-card");
await user.click(screen.getByTestId("older-conversations-filter-toggle"));
- await user.click(screen.getByTestId("delete-older-conversations"));
+ await user.click(screen.getByTestId("delete-all-conversations"));
await user.click(await screen.findByRole("button", { name: /confirm/i }));
await waitFor(() => {
- expect(deleteSpy).toHaveBeenCalledTimes(2);
+ expect(deleteSpy).toHaveBeenCalledTimes(3);
});
- expect(deleteSpy).toHaveBeenNthCalledWith(1, "old1");
- expect(deleteSpy).toHaveBeenNthCalledWith(2, "old2");
expect(displayErrorToast).toHaveBeenCalledWith(
"1 conversation could not be deleted.",
);
diff --git a/__tests__/components/features/conversation-panel/utils.ts b/__tests__/components/features/conversation-panel/utils.ts
index 2bf27a9502..c1a60f9e60 100644
--- a/__tests__/components/features/conversation-panel/utils.ts
+++ b/__tests__/components/features/conversation-panel/utils.ts
@@ -10,7 +10,7 @@ export const clickOnEditButton = async (
const ellipsisButton = wrapper.getByTestId("ellipsis-button");
await user.click(ellipsisButton);
- const menu = wrapper.getByTestId("context-menu");
+ const menu = screen.getByTestId("context-menu");
const editButton = within(menu).getByTestId("edit-button");
await user.click(editButton);
diff --git a/__tests__/stores/conversation-panel-preferences-store.test.ts b/__tests__/stores/conversation-panel-preferences-store.test.ts
index 6639a0a95a..a909f4d607 100644
--- a/__tests__/stores/conversation-panel-preferences-store.test.ts
+++ b/__tests__/stores/conversation-panel-preferences-store.test.ts
@@ -8,10 +8,14 @@ describe("conversation-panel-preferences store", () => {
window.localStorage.clear();
});
- it("defaults to showing older conversations and hiding repo/branch metadata", () => {
+ it("defaults to showing older conversations, chronological list, and expected toggles", () => {
const state = useConversationPanelPreferencesStore.getState();
expect(state.showOlderConversations).toBe(true);
expect(state.showRepoBranchMetadata).toBe(false);
+ expect(state.showLlmProfiles).toBe(false);
+ expect(state.organizeMode).toBe("chronological");
+ expect(state.conversationSort).toBe("updated");
+ expect(state.threadScope).toBe("all");
});
it("toggles showOlderConversations and persists the new value to localStorage", () => {
@@ -66,8 +70,81 @@ describe("conversation-panel-preferences store", () => {
window.localStorage.getItem(STORAGE_KEY) ?? "{}",
);
expect(Object.keys(persisted.state).sort()).toEqual([
+ "conversationSort",
+ "organizeMode",
+ "showLlmProfiles",
"showOlderConversations",
"showRepoBranchMetadata",
+ "threadScope",
]);
});
+
+ it("exposes setters and a toggler for the LLM-profiles preference", () => {
+ useConversationPanelPreferencesStore.getState().setShowLlmProfiles(true);
+ expect(
+ useConversationPanelPreferencesStore.getState().showLlmProfiles,
+ ).toBe(true);
+
+ useConversationPanelPreferencesStore
+ .getState()
+ .toggleShowLlmProfiles();
+ expect(
+ useConversationPanelPreferencesStore.getState().showLlmProfiles,
+ ).toBe(false);
+ });
+
+ it("updates organize, sort, and thread-scope preferences via their setters", () => {
+ const store = useConversationPanelPreferencesStore.getState();
+ store.setOrganizeMode("grouped");
+ store.setConversationSort("created");
+ store.setThreadScope("relevant");
+
+ const next = useConversationPanelPreferencesStore.getState();
+ expect({
+ organizeMode: next.organizeMode,
+ conversationSort: next.conversationSort,
+ threadScope: next.threadScope,
+ }).toEqual({
+ organizeMode: "grouped",
+ conversationSort: "created",
+ threadScope: "relevant",
+ });
+ });
+
+ it("rehydrates legacy localStorage payloads (older fields preserved, new fields filled with defaults)", async () => {
+ // Simulate a user upgrading from a build that only persisted the two
+ // original preferences. After rehydration the store should keep the
+ // user's existing choices and fill the new fields from `initialState`.
+ window.localStorage.setItem(
+ STORAGE_KEY,
+ JSON.stringify({
+ state: {
+ showOlderConversations: false,
+ showRepoBranchMetadata: true,
+ },
+ version: 0,
+ }),
+ );
+
+ await useConversationPanelPreferencesStore.persist.rehydrate();
+
+ const state = useConversationPanelPreferencesStore.getState();
+ expect({
+ showOlderConversations: state.showOlderConversations,
+ showRepoBranchMetadata: state.showRepoBranchMetadata,
+ showLlmProfiles: state.showLlmProfiles,
+ organizeMode: state.organizeMode,
+ conversationSort: state.conversationSort,
+ threadScope: state.threadScope,
+ }).toEqual({
+ // Preserved from the legacy payload.
+ showOlderConversations: false,
+ showRepoBranchMetadata: true,
+ // Filled with defaults for missing fields.
+ showLlmProfiles: false,
+ organizeMode: "chronological",
+ conversationSort: "updated",
+ threadScope: "all",
+ });
+ });
});
diff --git a/src/api/agent-server-adapter.ts b/src/api/agent-server-adapter.ts
index c1eeda76d1..d3641a5dfc 100644
--- a/src/api/agent-server-adapter.ts
+++ b/src/api/agent-server-adapter.ts
@@ -230,6 +230,7 @@ export function toAppConversation(
selected_repository: metadata?.selected_repository ?? null,
selected_branch: metadata?.selected_branch ?? null,
git_provider: metadata?.git_provider ?? null,
+ selected_workspace: metadata?.selected_workspace ?? null,
title: info.title?.trim()
? info.title
: getDefaultConversationTitle(info.id),
diff --git a/src/api/cloud/conversation-service.api.ts b/src/api/cloud/conversation-service.api.ts
index 99836879a6..36456cb781 100644
--- a/src/api/cloud/conversation-service.api.ts
+++ b/src/api/cloud/conversation-service.api.ts
@@ -37,6 +37,8 @@ function overlayStoredRepoSelection(
selected_branch:
conversation.selected_branch ?? stored.selected_branch ?? null,
git_provider: conversation.git_provider ?? stored.git_provider ?? null,
+ selected_workspace:
+ conversation.selected_workspace ?? stored.selected_workspace ?? null,
};
}
diff --git a/src/api/conversation-service/agent-server-conversation-service.types.ts b/src/api/conversation-service/agent-server-conversation-service.types.ts
index 277fbd9b5c..c15ed49e4c 100644
--- a/src/api/conversation-service/agent-server-conversation-service.types.ts
+++ b/src/api/conversation-service/agent-server-conversation-service.types.ts
@@ -136,6 +136,14 @@ export interface AppConversation {
session_api_key: string | null;
sandbox_id: string | null;
workspace?: ConversationWorkspace | null;
+ /**
+ * The local workspace the user explicitly attached when creating this
+ * conversation. Client-side only — never round-tripped to the agent-server
+ * or cloud. Null/undefined for conversations created via "No workspace".
+ * Distinct from `workspace.working_dir` (the per-conversation worktree path
+ * the runtime actually operates in).
+ */
+ selected_workspace?: string | null;
public?: boolean;
sub_conversation_ids: string[];
}
diff --git a/src/components/features/conversation-panel/new-conversation-button-cloud.tsx b/src/components/features/conversation-panel/cloud-new-conversation-menu.tsx
similarity index 72%
rename from src/components/features/conversation-panel/new-conversation-button-cloud.tsx
rename to src/components/features/conversation-panel/cloud-new-conversation-menu.tsx
index db4fb2476c..b43eb15839 100644
--- a/src/components/features/conversation-panel/new-conversation-button-cloud.tsx
+++ b/src/components/features/conversation-panel/cloud-new-conversation-menu.tsx
@@ -1,6 +1,5 @@
import React from "react";
import { useTranslation } from "react-i18next";
-import { Plus } from "lucide-react";
import { useCreateConversation } from "#/hooks/mutation/use-create-conversation";
import { useNavigation } from "#/context/navigation-context";
@@ -16,15 +15,22 @@ import { GitRepository } from "#/types/git";
import { Provider } from "#/types/settings";
import RepoIcon from "#/icons/repo.svg?react";
import { GitProviderIcon } from "#/components/shared/git-provider-icon";
-import { StyledTooltip } from "#/components/shared/buttons/styled-tooltip";
+import { NEW_CONVERSATION_DROPDOWN_SURFACE } from "./new-conversation-dropdown-styles";
+import { usePopoverFixedPlacement } from "#/hooks/use-popover-fixed-placement";
-interface CloudNewConversationButtonProps {
- /**
- * Render the trigger as a "+" icon-only button (used by the collapsed
- * sidebar). The popover content is unchanged; only the trigger pill
- * collapses.
- */
- compact?: boolean;
+export type CloudNewConversationMenuTriggerProps = {
+ onClick: () => void;
+ "aria-expanded": boolean;
+ "aria-haspopup": "menu";
+ disabled?: boolean;
+};
+
+export interface CloudNewConversationMenuProps {
+ trigger: (props: CloudNewConversationMenuTriggerProps) => React.ReactNode;
+ className?: string;
+ popoverClassName: string;
+ popoverTestId?: string;
+ useFixedPlacement?: boolean;
}
interface RepoListItemProps {
@@ -58,17 +64,17 @@ function RepoListItem({
}
/**
- * Cloud-backend variant of the sidebar "+ New Conversation" trigger.
- *
- * Lists git repositories (filtered by an optional search query) from the
- * active provider. Clicking a row immediately launches a conversation
- * against the repo's default branch (falling back to "main"). No branch
- * picker is exposed — the user can switch branches from inside the
- * conversation once it's running.
+ * Repository search + launch flow for cloud backends.
+ * Shared by the sidebar "+ New conversation" control and the conversation
+ * panel "new thread folder" opener.
*/
-export function CloudNewConversationButton({
- compact = false,
-}: CloudNewConversationButtonProps = {}) {
+export function CloudNewConversationMenu({
+ trigger,
+ className,
+ popoverClassName,
+ popoverTestId = "new-conversation-popover",
+ useFixedPlacement = false,
+}: CloudNewConversationMenuProps) {
const { t } = useTranslation("openhands");
const { navigate } = useNavigation();
@@ -77,14 +83,16 @@ export function CloudNewConversationButton({
const [open, setOpen] = React.useState(false);
const popoverRef = React.useRef<HTMLDivElement>(null);
+ const triggerWrapRef = React.useRef<HTMLSpanElement>(null);
+ const fixedBox = usePopoverFixedPlacement(triggerWrapRef, {
+ open,
+ enabled: useFixedPlacement,
+ });
const [selectedProvider, setSelectedProvider] =
React.useState<Provider | null>(lastSelectedProvider ?? null);
const [query, setQuery] = React.useState("");
const debouncedQuery = useDebounce(query, 300);
- // Auto-select a provider once `useUserProviders` resolves: prefer the
- // previously chosen one if it's still connected, otherwise the first
- // available provider.
React.useEffect(() => {
if (providers.length === 0) {
if (selectedProvider !== null) setSelectedProvider(null);
@@ -170,14 +178,11 @@ export function CloudNewConversationButton({
};
const itemClass = cn(
- "flex items-center gap-2 w-full px-2 py-2 text-sm text-white text-left cursor-pointer",
- "hover:bg-[var(--oh-interactive-hover)] rounded-md transition-colors duration-150 font-normal",
- "disabled:opacity-60 disabled:cursor-not-allowed",
+ "flex w-full cursor-pointer items-center gap-2 rounded px-2 py-2 text-left text-sm text-white",
+ "font-normal transition-colors hover:bg-[var(--oh-interactive-hover)]",
+ "disabled:cursor-not-allowed disabled:opacity-60",
);
- // When the popover is open and the active provider has very few repos
- // available, auto-load the next page so users can scroll without
- // explicitly clicking "Load more".
React.useEffect(() => {
if (!open) return;
if (debouncedQuery) return;
@@ -198,51 +203,46 @@ export function CloudNewConversationButton({
const showLoadMore =
!debouncedQuery && hasNextPage && repositories.length > 0;
- const newConversationLabel = t(I18nKey.SIDEBAR$NEW_CONVERSATION);
+ const toggleOpen = React.useCallback(() => {
+ setOpen((o) => !o);
+ }, []);
- const triggerButton = (
- <button
- type="button"
- data-testid="new-conversation-button"
- onClick={() => setOpen((o) => !o)}
- aria-expanded={open}
- aria-label={compact ? newConversationLabel : undefined}
- className={cn(
- "flex items-center rounded-md cursor-pointer transition-colors",
- "text-sm font-medium text-white bg-[var(--oh-surface)]/60 hover:bg-[var(--oh-surface-raised)]",
- "border border-[var(--oh-border)]",
- compact
- ? "justify-center w-10 h-10 p-0 mx-auto"
- : "gap-1.5 w-full px-3 py-2",
- )}
- >
- <Plus width={16} height={16} className="shrink-0" />
- {!compact && newConversationLabel}
- </button>
- );
+ const showPopover = open && (!useFixedPlacement || fixedBox !== null);
+
+ const fixedStyle: React.CSSProperties | undefined =
+ useFixedPlacement && fixedBox
+ ? {
+ position: "fixed",
+ top: fixedBox.top,
+ left: fixedBox.left,
+ width: fixedBox.width,
+ }
+ : undefined;
return (
<div
- className={cn("relative", compact && "flex justify-center")}
+ className={cn(!useFixedPlacement && "relative", className)}
ref={popoverRef}
>
- {compact ? (
- <StyledTooltip content={newConversationLabel} placement="right">
- {triggerButton}
- </StyledTooltip>
- ) : (
- triggerButton
- )}
+ <span ref={triggerWrapRef} className="inline-flex">
+ {trigger({
+ onClick: toggleOpen,
+ "aria-expanded": open,
+ "aria-haspopup": "menu",
+ disabled: isCreating,
+ })}
+ </span>
- {open && (
+ {showPopover && (
<div
- data-testid="new-conversation-popover"
+ data-testid={popoverTestId}
className={cn(
- "absolute z-30 top-full mt-2 p-1",
- "bg-[var(--oh-surface)] border border-[var(--oh-border-input)] rounded-lg shadow-xl",
- "flex flex-col gap-1",
- compact ? "left-0 w-[260px]" : "left-0 right-0",
+ NEW_CONVERSATION_DROPDOWN_SURFACE,
+ "gap-1",
+ !useFixedPlacement &&
+ cn("absolute top-full mt-0", popoverClassName),
)}
+ style={fixedStyle}
>
{providers.length > 1 && (
<div
@@ -258,10 +258,10 @@ export function CloudNewConversationButton({
data-testid={`cloud-provider-tab-${provider}`}
onClick={() => handleProviderChange(provider)}
className={cn(
- "flex items-center gap-1 px-2 py-1 rounded text-xs",
+ "flex items-center gap-1 rounded px-2 py-1 text-xs",
"border transition-colors",
isActive
- ? "bg-[var(--oh-interactive-hover)] border-[var(--oh-border-input)] text-white"
+ ? "border-[var(--oh-border-subtle)] bg-[var(--oh-interactive-hover)] text-white"
: "border-transparent text-[var(--oh-text-secondary)] hover:text-white",
)}
>
@@ -282,11 +282,10 @@ export function CloudNewConversationButton({
placeholder={t(I18nKey.COMMON$SEARCH_REPOSITORIES)}
disabled={!selectedProvider}
className={cn(
- "w-full px-2 py-1.5 text-sm rounded-md",
- "bg-[var(--oh-surface)] border border-[var(--oh-border)] text-white",
- "placeholder:text-[var(--oh-muted)] outline-none",
- "focus:border-[var(--oh-border-input)]",
- "disabled:opacity-60 disabled:cursor-not-allowed",
+ "w-full rounded-md border border-[var(--oh-border-subtle)] bg-[var(--oh-surface-raised)] px-2 py-1.5 text-sm text-white",
+ "outline-none placeholder:text-[var(--oh-muted)]",
+ "focus:border-[var(--oh-border-subtle)]",
+ "disabled:cursor-not-allowed disabled:opacity-60",
)}
/>
</div>
diff --git a/src/components/features/conversation-panel/compact-conversation-row.tsx b/src/components/features/conversation-panel/compact-conversation-row.tsx
index 740be69e0b..5075dccb45 100644
--- a/src/components/features/conversation-panel/compact-conversation-row.tsx
+++ b/src/components/features/conversation-panel/compact-conversation-row.tsx
@@ -20,6 +20,8 @@ interface CompactConversationRowProps {
isActive?: boolean;
onClose?: () => void;
showRepositoryMetadata?: boolean;
+ llmModel?: string | null;
+ showLlmProfiles?: boolean;
}
/**
@@ -39,6 +41,8 @@ export function CompactConversationRow({
isActive = false,
onClose,
showRepositoryMetadata = true,
+ llmModel = null,
+ showLlmProfiles = false,
}: CompactConversationRowProps) {
const disableAnimation = import.meta.env.MODE === "test";
@@ -61,6 +65,8 @@ export function CompactConversationRow({
executionStatus={executionStatus}
workspaceWorkingDir={workspaceWorkingDir}
showRepositoryMetadata={showRepositoryMetadata}
+ llmModel={llmModel}
+ showLlmModel={showLlmProfiles}
/>
</div>
);
diff --git a/src/components/features/conversation-panel/conversation-card/conversation-card-actions.tsx b/src/components/features/conversation-panel/conversation-card/conversation-card-actions.tsx
index a044038442..b4339b9c53 100644
--- a/src/components/features/conversation-panel/conversation-card/conversation-card-actions.tsx
+++ b/src/components/features/conversation-panel/conversation-card/conversation-card-actions.tsx
@@ -1,4 +1,5 @@
-import React from "react";
+import React, { useLayoutEffect, useReducer, useRef } from "react";
+import { createPortal } from "react-dom";
import { cn } from "#/utils/utils";
import { ExecutionStatus } from "#/types/agent-server/core/base/common";
import { isExecutionActive, isExecutionPaused } from "#/utils/status";
@@ -32,39 +33,92 @@ export function ConversationCardActions({
}: ConversationCardActionsProps) {
const isPaused = isExecutionPaused(executionStatus);
const isActive = isExecutionActive(executionStatus);
+ const anchorRef = useRef<HTMLButtonElement>(null);
+ const [, bumpPosition] = useReducer((i: number) => i + 1, 0);
+
+ useLayoutEffect(() => {
+ if (!contextMenuOpen) return undefined;
+ // Anchor ref is assigned after the ellipsis mounts; measure on the next frame.
+ bumpPosition();
+ // The scroll listener is in capture phase so it fires for nested scroll
+ // containers too. Coalesce bursts via rAF so fast scrolling triggers at
+ // most one reposition per paint frame instead of one per scroll event.
+ let frame = 0;
+ const update = () => {
+ if (frame) return;
+ frame = window.requestAnimationFrame(() => {
+ frame = 0;
+ bumpPosition();
+ });
+ };
+ window.addEventListener("resize", update);
+ window.addEventListener("scroll", update, true);
+ return () => {
+ if (frame) window.cancelAnimationFrame(frame);
+ window.removeEventListener("resize", update);
+ window.removeEventListener("scroll", update, true);
+ };
+ }, [contextMenuOpen]);
+
+ const floatingStyle: React.CSSProperties | undefined = (() => {
+ if (!contextMenuOpen || !anchorRef.current) return undefined;
+ const rect = anchorRef.current.getBoundingClientRect();
+ const vw = Number(window.innerWidth) || 0;
+ const vh = Number(window.innerHeight) || 0;
+ const bottom = Number(rect.bottom) || 0;
+ const rectRight = Number(rect.right) || 0;
+ // Conservative cap on this menu's intrinsic height (~7 items at
+ // ~36px + padding). When the anchor is so close to the viewport
+ // bottom that opening downward would clip the menu, flip it above
+ // the anchor instead. Slight over-estimate is fine — it just means
+ // we flip a few pixels earlier than strictly necessary.
+ const ESTIMATED_MENU_HEIGHT = 280;
+ const gutter = 8;
+ const overflowsDownward = bottom + ESTIMATED_MENU_HEIGHT + gutter > vh;
+ const top = overflowsDownward
+ ? Math.max(gutter, rect.top - ESTIMATED_MENU_HEIGHT - 4)
+ : bottom + 4;
+ return {
+ position: "fixed",
+ top,
+ right: Math.max(gutter, vw - rectRight),
+ zIndex: 100_000,
+ };
+ })();
+
+ const portalTarget = typeof document !== "undefined" ? document.body : null;
return (
- <div className="relative">
+ <>
<EllipsisButton
+ ref={anchorRef}
onClick={(event) => {
event.preventDefault();
event.stopPropagation();
onContextMenuToggle(!contextMenuOpen);
}}
- className={cn("translate-x-2.5", isPaused && "opacity-60")}
+ className={cn(isPaused && "opacity-60")}
/>
- <div
- className={cn(
- "relative",
- contextMenuOpen
- ? "opacity-100 visible z-[60]"
- : "opacity-0 invisible pointer-events-none",
- )}
- >
- <ConversationCardContextMenu
- onClose={() => onContextMenuToggle(false)}
- onDelete={onDelete}
- onStop={isActive ? onStop : undefined}
- onEdit={onEdit}
- onDownloadViaVSCode={
- conversationId && showOptions ? onDownloadViaVSCode : undefined
- }
- onDownloadConversation={
- conversationId ? onDownloadConversation : undefined
- }
- position="bottom"
- />
- </div>
- </div>
+ {contextMenuOpen && floatingStyle && portalTarget
+ ? createPortal(
+ <ConversationCardContextMenu
+ ignoreOutsideClickRef={anchorRef}
+ floatingStyle={floatingStyle}
+ onClose={() => onContextMenuToggle(false)}
+ onDelete={onDelete}
+ onStop={isActive ? onStop : undefined}
+ onEdit={onEdit}
+ onDownloadViaVSCode={
+ conversationId && showOptions ? onDownloadViaVSCode : undefined
+ }
+ onDownloadConversation={
+ conversationId ? onDownloadConversation : undefined
+ }
+ position="bottom"
+ />,
+ portalTarget,
+ )
+ : null}
+ </>
);
}
diff --git a/src/components/features/conversation-panel/conversation-card/conversation-card-context-menu.tsx b/src/components/features/conversation-panel/conversation-card/conversation-card-context-menu.tsx
index ee24f2cf45..b617d992f0 100644
--- a/src/components/features/conversation-panel/conversation-card/conversation-card-context-menu.tsx
+++ b/src/components/features/conversation-panel/conversation-card/conversation-card-context-menu.tsx
@@ -27,6 +27,12 @@ interface ConversationCardContextMenuProps {
onDownloadViaVSCode?: (event: React.MouseEvent<HTMLButtonElement>) => void;
onDownloadConversation?: (event: React.MouseEvent<HTMLButtonElement>) => void;
position?: "top" | "bottom";
+ /**
+ * Fixed coordinates for a portaled menu (conversation list overflow
+ * stacking). When set, theme/position switch to non-absolute layout.
+ */
+ floatingStyle?: React.CSSProperties;
+ ignoreOutsideClickRef?: React.RefObject<HTMLElement | null>;
}
const contextMenuListItemClassName =
@@ -43,10 +49,15 @@ export function ConversationCardContextMenu({
onDownloadViaVSCode,
onDownloadConversation,
position = "bottom",
+ floatingStyle,
+ ignoreOutsideClickRef,
}: ConversationCardContextMenuProps) {
const { t } = useTranslation("openhands");
const { backend } = useActiveBackend();
- const ref = useClickOutsideElement<HTMLUListElement>(onClose);
+ const ref = useClickOutsideElement<HTMLUListElement>(
+ onClose,
+ ignoreOutsideClickRef,
+ );
const stopLabelKey =
backend.kind === "cloud"
? I18nKey.COMMON$CLOSE_CONVERSATION_STOP_RUNTIME
@@ -71,13 +82,22 @@ export function ConversationCardContextMenu({
[],
);
+ const isPortaled = floatingStyle != null;
+
return (
<ContextMenu
ref={ref}
testId="context-menu"
- position={position}
- alignment="right"
- className="mt-0"
+ style={isPortaled ? floatingStyle : undefined}
+ theme={isPortaled ? "popover" : "default"}
+ position={isPortaled ? "none" : position}
+ alignment={isPortaled ? "none" : "right"}
+ spacing={isPortaled ? "none" : "default"}
+ className={
+ isPortaled
+ ? "mt-0 min-w-[200px] w-max max-w-[min(280px,100vw-16px)]"
+ : "z-[200] mt-0"
+ }
>
{generateSection(
[
diff --git a/src/components/features/conversation-panel/conversation-card/conversation-card-footer.tsx b/src/components/features/conversation-panel/conversation-card/conversation-card-footer.tsx
index 4c52b75537..60dcd575ac 100644
--- a/src/components/features/conversation-panel/conversation-card/conversation-card-footer.tsx
+++ b/src/components/features/conversation-panel/conversation-card/conversation-card-footer.tsx
@@ -16,6 +16,8 @@ interface ConversationCardFooterProps {
workspaceWorkingDir?: string | null;
showRepositoryMetadata?: boolean;
showTimestamp?: boolean;
+ llmModel?: string | null;
+ showLlmModel?: boolean;
}
export function ConversationCardFooter({
@@ -26,6 +28,8 @@ export function ConversationCardFooter({
workspaceWorkingDir,
showRepositoryMetadata = true,
showTimestamp = true,
+ llmModel,
+ showLlmModel = false,
}: ConversationCardFooterProps) {
const { t } = useTranslation("openhands");
@@ -34,27 +38,40 @@ export function ConversationCardFooter({
return (
<div
className={cn(
- // Left padding aligns the repo/workspace icon with the title text in
- // the header (status dot 10px + gap-2 8px = 18px).
- "flex flex-row items-center gap-2 mt-0.5 w-full min-w-0",
- showRepositoryMetadata && "pl-[18px]",
+ "flex flex-col gap-0.5 mt-0.5 w-full min-w-0",
isPaused && "opacity-60",
)}
>
- {showRepositoryMetadata &&
- (selectedRepository?.selected_repository ? (
- <ConversationRepoLink selectedRepository={selectedRepository} />
- ) : (
- <NoRepository workspaceWorkingDir={workspaceWorkingDir} />
- ))}
- <div className="flex items-center gap-2 shrink-0 ml-auto">
- {showTimestamp && (createdAt ?? lastUpdatedAt) && (
- <p className="text-xs text-[var(--oh-muted)] text-right">
- <time>
- {`${formatTimeDelta(lastUpdatedAt ?? createdAt)} ${t(I18nKey.CONVERSATION$AGO)}`}
- </time>
- </p>
+ {showLlmModel && llmModel ? (
+ <span
+ className="min-w-0 max-w-full truncate pl-[18px] text-xs text-[var(--oh-muted)]"
+ title={llmModel}
+ >
+ {llmModel}
+ </span>
+ ) : null}
+ <div
+ className={cn(
+ // Align repo/workspace row with the title (status dot + gap).
+ "flex flex-row items-center gap-2 w-full min-w-0",
+ showRepositoryMetadata && "pl-[18px]",
)}
+ >
+ {showRepositoryMetadata &&
+ (selectedRepository?.selected_repository ? (
+ <ConversationRepoLink selectedRepository={selectedRepository} />
+ ) : (
+ <NoRepository workspaceWorkingDir={workspaceWorkingDir} />
+ ))}
+ <div className="flex items-center gap-2 shrink-0 ml-auto">
+ {showTimestamp && (createdAt ?? lastUpdatedAt) && (
+ <p className="text-xs text-[var(--oh-muted)] text-right">
+ <time>
+ {`${formatTimeDelta(lastUpdatedAt ?? createdAt)} ${t(I18nKey.CONVERSATION$AGO)}`}
+ </time>
+ </p>
+ )}
+ </div>
</div>
</div>
);
diff --git a/src/components/features/conversation-panel/conversation-card/conversation-card-header.tsx b/src/components/features/conversation-panel/conversation-card/conversation-card-header.tsx
index 3af63c500b..c4bf39e85e 100644
--- a/src/components/features/conversation-panel/conversation-card/conversation-card-header.tsx
+++ b/src/components/features/conversation-panel/conversation-card/conversation-card-header.tsx
@@ -22,7 +22,7 @@ export function ConversationCardHeader({
return (
<div className="flex items-center gap-2 flex-1 min-w-0 overflow-hidden">
{executionStatus !== undefined && (
- <div className="flex items-center">
+ <div className="flex w-[18px] shrink-0 items-center justify-center">
<ConversationStatusDot
executionStatus={executionStatus}
sandboxStatus={sandboxStatus}
diff --git a/src/components/features/conversation-panel/conversation-card/conversation-card-skeleton.test.tsx b/src/components/features/conversation-panel/conversation-card/conversation-card-skeleton.test.tsx
index f09c765eda..288a098983 100644
--- a/src/components/features/conversation-panel/conversation-card/conversation-card-skeleton.test.tsx
+++ b/src/components/features/conversation-panel/conversation-card/conversation-card-skeleton.test.tsx
@@ -10,7 +10,7 @@ describe("ConversationCardSkeleton", () => {
).toBeInTheDocument();
});
- it("renders compact skeleton without text placeholders", () => {
+ it("renders compact skeleton without full-row placeholder", () => {
render(<ConversationCardSkeleton compact />);
expect(
screen.getByTestId("conversation-card-skeleton-compact"),
@@ -20,17 +20,23 @@ describe("ConversationCardSkeleton", () => {
).not.toBeInTheDocument();
});
- it("renders the same header slots a loaded conversation card shows: status dot, title, and timestamp", () => {
+ it("renders three skeleton rows with stagger wrapper", () => {
render(<ConversationCardSkeleton />);
- expect(
- screen.getByTestId("conversation-card-skeleton-status-dot"),
- ).toBeInTheDocument();
- expect(
- screen.getByTestId("conversation-card-skeleton-title"),
- ).toBeInTheDocument();
- expect(
- screen.getByTestId("conversation-card-skeleton-timestamp"),
- ).toBeInTheDocument();
+ const root = screen.getByTestId("conversation-card-skeleton");
+ expect(root).toHaveClass("skeleton-stagger");
+ const bars = root.querySelectorAll(":scope > div");
+ expect(bars.length).toBe(3);
+ bars.forEach((bar) => {
+ expect(bar).toHaveClass("skeleton");
+ });
+ });
+
+ it("renders three compact skeleton bars", () => {
+ render(<ConversationCardSkeleton compact />);
+ const root = screen.getByTestId("conversation-card-skeleton-compact");
+ expect(root).toHaveClass("skeleton-stagger");
+ const bars = root.querySelectorAll(":scope > div");
+ expect(bars.length).toBe(3);
});
});
diff --git a/src/components/features/conversation-panel/conversation-card/conversation-card-skeleton.tsx b/src/components/features/conversation-panel/conversation-card/conversation-card-skeleton.tsx
index 6556a9779d..d9ae3366b3 100644
--- a/src/components/features/conversation-panel/conversation-card/conversation-card-skeleton.tsx
+++ b/src/components/features/conversation-panel/conversation-card/conversation-card-skeleton.tsx
@@ -2,6 +2,11 @@ interface ConversationCardSkeletonProps {
compact?: boolean;
}
+/**
+ * Loading placeholders for the conversation list. Non-compact: three bars;
+ * compact: three small bars for the icon rail. Pulse stagger comes from
+ * `.skeleton-stagger` in `tailwind.css`.
+ */
export function ConversationCardSkeleton({
compact = false,
}: ConversationCardSkeletonProps) {
@@ -9,9 +14,15 @@ export function ConversationCardSkeleton({
return (
<div
data-testid="conversation-card-skeleton-compact"
- className="flex items-center justify-center px-2 py-2"
+ className="skeleton-stagger flex flex-col items-center gap-1.5 py-1"
+ aria-hidden
>
- <div className="skeleton-round h-2 w-2" />
+ {[0, 1, 2].map((i) => (
+ <div
+ key={`conversation-skeleton-compact-${i}`}
+ className="h-1.5 w-7 shrink-0 skeleton"
+ />
+ ))}
</div>
);
}
@@ -19,26 +30,15 @@ export function ConversationCardSkeleton({
return (
<div
data-testid="conversation-card-skeleton"
- className="relative h-auto w-full px-3 py-2 border-b border-[var(--oh-border-subtle)]"
+ className="skeleton-stagger flex flex-col gap-1.5 py-0.5"
+ aria-hidden
>
- <div className="flex items-center w-full min-w-0 h-6">
- <div className="flex items-center gap-2 flex-1 min-w-0">
- <div
- data-testid="conversation-card-skeleton-status-dot"
- className="skeleton-round h-2.5 w-2.5 shrink-0"
- />
- <div
- data-testid="conversation-card-skeleton-title"
- className="skeleton h-3 w-2/3 rounded"
- />
- </div>
- <div className="ml-auto pl-2 shrink-0">
- <div
- data-testid="conversation-card-skeleton-timestamp"
- className="skeleton h-2 w-8 rounded"
- />
- </div>
- </div>
+ {[0, 1, 2].map((i) => (
+ <div
+ key={`conversation-skeleton-row-${i}`}
+ className="h-6 min-h-6 w-full skeleton"
+ />
+ ))}
</div>
);
}
diff --git a/src/components/features/conversation-panel/conversation-card/conversation-card.tsx b/src/components/features/conversation-panel/conversation-card/conversation-card.tsx
index 224a09e90d..89660ff880 100644
--- a/src/components/features/conversation-panel/conversation-card/conversation-card.tsx
+++ b/src/components/features/conversation-panel/conversation-card/conversation-card.tsx
@@ -31,6 +31,8 @@ interface ConversationCardProps {
isActive?: boolean;
workspaceWorkingDir?: string | null;
showRepositoryMetadata?: boolean;
+ llmModel?: string | null;
+ showLlmProfiles?: boolean;
}
export function ConversationCard({
@@ -51,6 +53,8 @@ export function ConversationCard({
isActive = false,
workspaceWorkingDir,
showRepositoryMetadata = true,
+ llmModel = null,
+ showLlmProfiles = false,
}: ConversationCardProps) {
const posthog = usePostHog();
const [titleMode, setTitleMode] = React.useState<"view" | "edit">("view");
@@ -123,7 +127,8 @@ export function ConversationCard({
};
const hasContextMenu = !!(onDelete || onChangeTitle || showOptions);
- const shouldRenderFooter = showRepositoryMetadata;
+ const shouldRenderFooter =
+ showRepositoryMetadata || (!!llmModel && showLlmProfiles);
return (
<div
@@ -132,10 +137,9 @@ export function ConversationCard({
data-active={isActive ? "true" : "false"}
onClick={onClick}
className={cn(
- "group relative h-auto w-full rounded-md px-3 pt-1 pb-1 cursor-pointer transition-colors",
+ "group relative h-auto w-full cursor-pointer rounded-md py-1 pl-2 pr-1 transition-colors",
"data-[context-menu-open=false]:hover:bg-[var(--oh-surface)]",
"data-[active=true]:bg-[var(--oh-surface)]",
- "data-[context-menu-open=true]:z-20",
)}
>
<div className="flex items-center w-full min-w-0">
@@ -160,7 +164,7 @@ export function ConversationCard({
{(createdAt ?? lastUpdatedAt) && (
<p
className={cn(
- "text-xs text-[var(--oh-muted)] text-right whitespace-nowrap transition-opacity",
+ "text-xs text-[var(--oh-muted)] text-right whitespace-nowrap transition-opacity -translate-x-1.5",
hasContextMenu &&
"group-hover:opacity-0 group-focus-within:opacity-0",
contextMenuOpen && "opacity-0",
@@ -175,7 +179,7 @@ export function ConversationCard({
className={cn(
"absolute right-0 top-1/2 -translate-y-1/2 transition-opacity",
"opacity-0 invisible group-hover:opacity-100 group-hover:visible",
- contextMenuOpen && "opacity-100 visible z-[60]",
+ contextMenuOpen && "visible opacity-100",
)}
>
<ConversationCardActions
@@ -204,6 +208,8 @@ export function ConversationCard({
workspaceWorkingDir={workspaceWorkingDir}
showRepositoryMetadata={showRepositoryMetadata}
showTimestamp={false}
+ llmModel={llmModel}
+ showLlmModel={showLlmProfiles}
/>
)}
</div>
diff --git a/src/components/features/conversation-panel/conversation-panel-filter-menu.tsx b/src/components/features/conversation-panel/conversation-panel-filter-menu.tsx
new file mode 100644
index 0000000000..b385518e9c
--- /dev/null
+++ b/src/components/features/conversation-panel/conversation-panel-filter-menu.tsx
@@ -0,0 +1,363 @@
+import React from "react";
+import { useTranslation } from "react-i18next";
+import {
+ Bot,
+ CalendarArrowDown,
+ Check,
+ Clock3,
+ ClockArrowDown,
+ Folder,
+ GitBranch,
+ ListFilter,
+ MessageCircle,
+ Star,
+} from "lucide-react";
+import { I18nKey } from "#/i18n/declaration";
+import type { BackendKind } from "#/api/backend-registry/types";
+import { cn } from "#/utils/utils";
+import type {
+ ConversationSortField,
+ OrganizeMode,
+ ThreadScope,
+} from "./conversation-panel-list-helpers";
+
+const capitalizeLabel = (label: string) =>
+ label.length > 0 ? label.charAt(0).toUpperCase() + label.slice(1) : label;
+
+function MenuHeading({ children }: { children: React.ReactNode }) {
+ return (
+ <div
+ role="presentation"
+ className="px-2 py-1 text-[11px] font-semibold uppercase tracking-wide text-[var(--oh-muted)]"
+ >
+ {children}
+ </div>
+ );
+}
+
+function MenuSeparator() {
+ return (
+ <div
+ className="-mx-1 my-1 h-px shrink-0 bg-[var(--oh-border)]"
+ role="separator"
+ />
+ );
+}
+
+function MenuRow({
+ icon: Icon,
+ label,
+ selected,
+ onClick,
+ testId,
+}: {
+ icon: React.ComponentType<{ className?: string; "aria-hidden"?: boolean }>;
+ label: string;
+ selected?: boolean;
+ onClick: () => void;
+ testId?: string;
+}) {
+ // Rows that show a selection checkmark are toggleable preferences, so
+ // they get `role="menuitemradio"` when they're part of a selectable
+ // group and `role="menuitemcheckbox"` when they're a standalone toggle.
+ // For simplicity we use `menuitemradio` whenever `selected` is provided
+ // (every selectable row in this menu is part of a mutually exclusive
+ // group in practice) and fall back to plain `menuitem` otherwise.
+ const role = selected === undefined ? "menuitem" : "menuitemradio";
+ return (
+ <button
+ type="button"
+ role={role}
+ aria-checked={selected === undefined ? undefined : Boolean(selected)}
+ data-testid={testId}
+ onClick={onClick}
+ className={cn(
+ "flex w-full items-center gap-2 rounded px-2 py-2 text-left text-sm text-white",
+ "hover:bg-[var(--oh-interactive-hover)]",
+ )}
+ >
+ <Icon
+ className="h-3.5 w-3.5 shrink-0 text-[var(--oh-muted)]"
+ aria-hidden
+ />
+ <span className="min-w-0 flex-1 truncate">{label}</span>
+ {selected ? (
+ <Check className="ml-auto h-3.5 w-3.5 shrink-0" aria-hidden />
+ ) : null}
+ </button>
+ );
+}
+
+export interface ConversationPanelFilterMenuProps {
+ filterMenuOpen: boolean;
+ setFilterMenuOpen: (open: boolean) => void;
+ menuRef: React.RefObject<HTMLDivElement | null>;
+ backendKind: BackendKind;
+ organizeMode: OrganizeMode;
+ setOrganizeMode: (mode: OrganizeMode) => void;
+ conversationSort: ConversationSortField;
+ setConversationSort: (sort: ConversationSortField) => void;
+ threadScope: ThreadScope;
+ setThreadScope: (scope: ThreadScope) => void;
+ showOlderConversations: boolean;
+ toggleShowOlderConversations: () => void;
+ showRepoBranchMetadata: boolean;
+ toggleShowRepoBranchMetadata: () => void;
+ showLlmProfiles: boolean;
+ toggleShowLlmProfiles: () => void;
+ totalConversationsCount: number;
+ onRequestDeleteAll: () => void;
+}
+
+export function ConversationPanelFilterMenu({
+ filterMenuOpen,
+ setFilterMenuOpen,
+ menuRef,
+ backendKind,
+ organizeMode,
+ setOrganizeMode,
+ conversationSort,
+ setConversationSort,
+ threadScope,
+ setThreadScope,
+ showOlderConversations,
+ toggleShowOlderConversations,
+ showRepoBranchMetadata,
+ toggleShowRepoBranchMetadata,
+ showLlmProfiles,
+ toggleShowLlmProfiles,
+ totalConversationsCount,
+ onRequestDeleteAll,
+}: ConversationPanelFilterMenuProps) {
+ const { t } = useTranslation("openhands");
+
+ const groupedLabel =
+ backendKind === "local"
+ ? t(I18nKey.CONVERSATION_PANEL$BY_WORKSPACE)
+ : t(I18nKey.CONVERSATION_PANEL$BY_REPOSITORY);
+
+ const triggerRef = React.useRef<HTMLButtonElement>(null);
+ const menuContentRef = React.useRef<HTMLDivElement>(null);
+
+ // When the menu opens, move keyboard focus into it so screen-reader /
+ // keyboard-only users can interact with the options immediately. When
+ // it closes, return focus to the trigger so Tab order picks up where
+ // the user left off.
+ const wasOpenRef = React.useRef(filterMenuOpen);
+ React.useEffect(() => {
+ if (filterMenuOpen) {
+ const firstItem =
+ menuContentRef.current?.querySelector<HTMLButtonElement>(
+ '[role="menuitem"], [role="menuitemradio"]',
+ );
+ firstItem?.focus();
+ } else if (wasOpenRef.current) {
+ // Only return focus on a real open→close transition (not the
+ // mount-with-open=false case).
+ triggerRef.current?.focus();
+ }
+ wasOpenRef.current = filterMenuOpen;
+ }, [filterMenuOpen]);
+
+ // Roving Arrow Up/Down + Escape across the menu items. Tab still works
+ // natively; Escape closes the menu and returns focus to the trigger
+ // (via the effect above).
+ const handleMenuKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {
+ if (event.key === "Escape") {
+ event.preventDefault();
+ setFilterMenuOpen(false);
+ return;
+ }
+ if (event.key !== "ArrowDown" && event.key !== "ArrowUp") return;
+ const container = menuContentRef.current;
+ if (!container) return;
+ const items = Array.from(
+ container.querySelectorAll<HTMLButtonElement>(
+ '[role="menuitem"], [role="menuitemradio"]',
+ ),
+ ).filter((el) => !el.disabled);
+ if (items.length === 0) return;
+ const currentIdx = items.indexOf(
+ document.activeElement as HTMLButtonElement,
+ );
+ const delta = event.key === "ArrowDown" ? 1 : -1;
+ const start = currentIdx === -1 ? 0 : currentIdx;
+ const nextIdx = (start + delta + items.length) % items.length;
+ event.preventDefault();
+ items[nextIdx]?.focus();
+ };
+
+ return (
+ <div ref={menuRef} className="relative shrink-0 pr-0.5">
+ <button
+ ref={triggerRef}
+ type="button"
+ data-testid="older-conversations-filter-toggle"
+ aria-label={t(I18nKey.CONVERSATION_PANEL$FILTER_LABEL)}
+ aria-haspopup="menu"
+ aria-expanded={filterMenuOpen}
+ onClick={() => setFilterMenuOpen(!filterMenuOpen)}
+ className="inline-flex h-7 w-7 items-center justify-center rounded-md text-[var(--oh-muted)] hover:text-white hover:bg-[var(--oh-surface-raised)] transition-colors"
+ >
+ <ListFilter
+ className="lucide lucide-list-filter shrink-0"
+ width={14}
+ height={14}
+ strokeWidth={2}
+ aria-hidden
+ />
+ </button>
+
+ {filterMenuOpen ? (
+ <div
+ ref={menuContentRef}
+ role="menu"
+ aria-orientation="vertical"
+ aria-label={t(I18nKey.CONVERSATION_PANEL$FILTER_LABEL)}
+ // `role="menu"` is an interactive ARIA role, so the container
+ // must be focusable to satisfy jsx-a11y. `-1` keeps it out of
+ // the natural Tab order (the menu items themselves are
+ // `<button>`s and tabbable on their own) but still allows the
+ // open-effect to focus it / its children programmatically.
+ tabIndex={-1}
+ data-testid="older-conversations-filter-menu"
+ onKeyDown={handleMenuKeyDown}
+ className="absolute right-0 top-full z-50 mt-0 w-64 rounded-md border border-[var(--oh-border-subtle)] bg-tertiary px-1 py-1 text-white shadow-lg"
+ >
+ <MenuHeading>{t(I18nKey.CONVERSATION_PANEL$ORGANIZE)}</MenuHeading>
+ <MenuRow
+ icon={Folder}
+ label={groupedLabel}
+ selected={organizeMode === "grouped"}
+ onClick={() => {
+ setOrganizeMode("grouped");
+ setFilterMenuOpen(false);
+ }}
+ />
+ <MenuRow
+ icon={Clock3}
+ label={t(I18nKey.CONVERSATION_PANEL$CHRONOLOGICAL)}
+ selected={organizeMode === "chronological"}
+ onClick={() => {
+ setOrganizeMode("chronological");
+ setFilterMenuOpen(false);
+ }}
+ />
+
+ <MenuSeparator />
+ <MenuHeading>{t(I18nKey.CONVERSATION_PANEL$SORT_BY)}</MenuHeading>
+ <MenuRow
+ icon={CalendarArrowDown}
+ label={t(I18nKey.CONVERSATION_PANEL$SORT_CREATED)}
+ selected={conversationSort === "created"}
+ onClick={() => {
+ setConversationSort("created");
+ setFilterMenuOpen(false);
+ }}
+ />
+ <MenuRow
+ icon={ClockArrowDown}
+ label={t(I18nKey.CONVERSATION_PANEL$SORT_UPDATED)}
+ selected={conversationSort === "updated"}
+ onClick={() => {
+ setConversationSort("updated");
+ setFilterMenuOpen(false);
+ }}
+ />
+
+ <MenuSeparator />
+ <MenuHeading>{t(I18nKey.CONVERSATION_PANEL$SHOW)}</MenuHeading>
+ <MenuRow
+ icon={MessageCircle}
+ label={t(I18nKey.CONVERSATION_PANEL$ALL_THREADS)}
+ selected={threadScope === "all"}
+ onClick={() => {
+ setThreadScope("all");
+ setFilterMenuOpen(false);
+ }}
+ />
+ <MenuRow
+ icon={Star}
+ label={t(I18nKey.CONVERSATION_PANEL$RELEVANT_THREADS)}
+ selected={threadScope === "relevant"}
+ onClick={() => {
+ setThreadScope("relevant");
+ setFilterMenuOpen(false);
+ }}
+ />
+
+ <MenuSeparator />
+ <MenuHeading>{t(I18nKey.CONVERSATION_PANEL$METADATA)}</MenuHeading>
+ <MenuRow
+ icon={Bot}
+ label={t(I18nKey.CONVERSATION_PANEL$LLM_MODEL)}
+ selected={showLlmProfiles}
+ testId="toggle-llm-profiles"
+ onClick={() => {
+ toggleShowLlmProfiles();
+ setFilterMenuOpen(false);
+ }}
+ />
+ <MenuRow
+ icon={GitBranch}
+ label={t(I18nKey.CONVERSATION_PANEL$REPO_BRANCH)}
+ selected={showRepoBranchMetadata}
+ testId="toggle-repo-branch-metadata"
+ onClick={() => {
+ toggleShowRepoBranchMetadata();
+ setFilterMenuOpen(false);
+ }}
+ />
+
+ <MenuSeparator />
+ <div
+ role="presentation"
+ className="flex items-baseline justify-between gap-2 px-2 py-1"
+ >
+ <span className="min-w-0 truncate text-left text-[11px] font-semibold uppercase tracking-wide text-[var(--oh-muted)]">
+ {t(I18nKey.CONVERSATION_PANEL$OLDER_SECTION)}
+ </span>
+ <span className="shrink-0 text-right text-[10px] font-medium normal-case tracking-normal text-[var(--oh-muted)]/70">
+ {t(I18nKey.CONVERSATION_PANEL$OLDER_OVER_ONE_HOUR)}
+ </span>
+ </div>
+ <button
+ type="button"
+ role="menuitem"
+ data-testid="toggle-older-conversations"
+ onClick={() => {
+ toggleShowOlderConversations();
+ setFilterMenuOpen(false);
+ }}
+ className="block w-full rounded px-2 py-2 text-left text-sm text-white hover:bg-[var(--oh-interactive-hover)]"
+ >
+ {showOlderConversations
+ ? capitalizeLabel(t(I18nKey.CONVERSATION$HIDE))
+ : capitalizeLabel(t(I18nKey.CONVERSATION$SHOW_ALL))}
+ </button>
+
+ <MenuSeparator />
+ <button
+ type="button"
+ role="menuitem"
+ data-testid="delete-all-conversations"
+ disabled={totalConversationsCount === 0}
+ onClick={() => {
+ if (totalConversationsCount === 0) return;
+ onRequestDeleteAll();
+ setFilterMenuOpen(false);
+ }}
+ className={cn(
+ "block w-full rounded px-2 py-2 text-left text-sm hover:bg-[var(--oh-interactive-hover)]",
+ totalConversationsCount === 0
+ ? "cursor-not-allowed text-[var(--oh-muted)]"
+ : "text-danger",
+ )}
+ >
+ {capitalizeLabel(t(I18nKey.CONVERSATION$DELETE_ALL))}
+ </button>
+ </div>
+ ) : null}
+ </div>
+ );
+}
diff --git a/src/components/features/conversation-panel/conversation-panel-list-helpers.ts b/src/components/features/conversation-panel/conversation-panel-list-helpers.ts
new file mode 100644
index 0000000000..04747cd46c
--- /dev/null
+++ b/src/components/features/conversation-panel/conversation-panel-list-helpers.ts
@@ -0,0 +1,173 @@
+import type { AppConversation } from "#/api/conversation-service/agent-server-conversation-service.types";
+import type { BackendKind } from "#/api/backend-registry/types";
+import type { Provider } from "#/types/settings";
+
+export type ConversationSortField = "created" | "updated";
+export type ThreadScope = "all" | "relevant";
+export type OrganizeMode = "grouped" | "chronological";
+
+/** Subset of `useCreateConversation` variables for launching from a group row */
+export type ConversationGroupLaunch = {
+ workingDir?: string;
+ repository?: {
+ name: string;
+ gitProvider: Provider;
+ branch?: string;
+ };
+};
+
+function buildGroupLaunch(
+ id: string,
+ backendKind: BackendKind,
+ conversations: AppConversation[],
+): ConversationGroupLaunch {
+ if (backendKind === "local") {
+ if (id === "__none_workspace") {
+ return {};
+ }
+ if (id.startsWith("ws:")) {
+ return { workingDir: id.slice(3) };
+ }
+ return {};
+ }
+
+ if (id === "__none_repo") {
+ return {};
+ }
+ if (id.startsWith("repo:")) {
+ const name = id.slice(5);
+ const sample = conversations[0];
+ const gitProvider = (sample?.git_provider ?? "github") as Provider;
+ const branch = sample?.selected_branch ?? "main";
+ return {
+ repository: {
+ name,
+ gitProvider,
+ branch,
+ },
+ };
+ }
+
+ return {};
+}
+
+export function parseConversationTimeMs(iso: string | undefined): number {
+ if (!iso) return 0;
+ const t = Date.parse(iso);
+ return Number.isFinite(t) ? t : 0;
+}
+
+export function sortConversationsByField(
+ items: readonly AppConversation[],
+ field: ConversationSortField,
+): AppConversation[] {
+ const key = field === "created" ? "created_at" : "updated_at";
+ return [...items].sort(
+ (a, b) => parseConversationTimeMs(b[key]) - parseConversationTimeMs(a[key]),
+ );
+}
+
+function workspaceGroup(conversation: AppConversation): {
+ id: string;
+ label: string;
+} {
+ // Group by the user-selected workspace (a stable identifier shared by
+ // every conversation launched from the same picker selection), not
+ // `workspace.working_dir` — that field holds the per-conversation
+ // worktree path the agent-server creates, which is unique per
+ // conversation and would fragment the grouping.
+ //
+ // Normalize first, then check emptiness: inputs like "/", "///", or
+ // " ///" trim+strip to "" and must fall back to the "no workspace"
+ // bucket rather than producing a stray `ws:` group with no label.
+ const normalized = conversation.selected_workspace
+ ?.trim()
+ .replace(/\/+$/, "");
+ if (!normalized) {
+ return { id: "__none_workspace", label: "" };
+ }
+ const label = normalized.split("/").filter(Boolean).pop() ?? normalized;
+ return { id: `ws:${normalized}`, label };
+}
+
+function repositoryGroup(conversation: AppConversation): {
+ id: string;
+ label: string;
+} {
+ // Mirror `workspaceGroup`'s normalize-then-check order so "/", "///",
+ // and trailing-slash variants of the same repo all collapse to one
+ // group instead of producing a stray `repo:/` bucket.
+ const normalized = conversation.selected_repository
+ ?.trim()
+ .replace(/\/+$/, "");
+ if (!normalized) {
+ return { id: "__none_repo", label: "" };
+ }
+ const parts = normalized.split("/").filter(Boolean);
+ const label = parts.length
+ ? (parts[parts.length - 1] ?? normalized).replace(/\.git$/, "")
+ : normalized.replace(/\.git$/, "");
+ return { id: `repo:${normalized}`, label };
+}
+
+export function groupConversations(
+ items: readonly AppConversation[],
+ backendKind: BackendKind,
+ sortField: ConversationSortField,
+ labels: { emptyWorkspace: string; emptyRepository: string },
+): {
+ id: string;
+ label: string;
+ conversations: AppConversation[];
+ launch: ConversationGroupLaunch;
+}[] {
+ const byId = new Map<
+ string,
+ { label: string; conversations: AppConversation[] }
+ >();
+
+ for (const c of items) {
+ const { id, label: rawLabel } =
+ backendKind === "local" ? workspaceGroup(c) : repositoryGroup(c);
+ const label =
+ id === "__none_workspace"
+ ? labels.emptyWorkspace
+ : id === "__none_repo"
+ ? labels.emptyRepository
+ : rawLabel;
+ const bucket = byId.get(id);
+ if (bucket) {
+ bucket.conversations.push(c);
+ } else {
+ byId.set(id, { label, conversations: [c] });
+ }
+ }
+
+ const groups = [...byId.entries()].map(([id, g]) => {
+ const conversations = sortConversationsByField(g.conversations, sortField);
+ return {
+ id,
+ label: g.label,
+ conversations,
+ launch: buildGroupLaunch(id, backendKind, conversations),
+ };
+ });
+
+ // Use reduce instead of `Math.max(...arr)` — the spread form would push
+ // every conversation onto the call stack as a separate argument, which
+ // hits JS engines' ~100k-arg limit on very large buckets.
+ const groupOrderKey = (g: (typeof groups)[number]) =>
+ g.conversations.reduce(
+ (max, c) =>
+ Math.max(
+ max,
+ parseConversationTimeMs(
+ sortField === "created" ? c.created_at : c.updated_at,
+ ),
+ ),
+ 0,
+ );
+
+ groups.sort((a, b) => groupOrderKey(b) - groupOrderKey(a));
+ return groups;
+}
diff --git a/src/components/features/conversation-panel/conversation-panel-new-thread-picker.tsx b/src/components/features/conversation-panel/conversation-panel-new-thread-picker.tsx
new file mode 100644
index 0000000000..c575c67031
--- /dev/null
+++ b/src/components/features/conversation-panel/conversation-panel-new-thread-picker.tsx
@@ -0,0 +1,89 @@
+import { useTranslation } from "react-i18next";
+import { FolderPlus } from "lucide-react";
+import { I18nKey } from "#/i18n/declaration";
+import type { BackendKind } from "#/api/backend-registry/types";
+import { cn } from "#/utils/utils";
+import { LocalNewConversationMenu } from "./local-new-conversation-menu";
+import { CloudNewConversationMenu } from "./cloud-new-conversation-menu";
+
+const triggerClassName = cn(
+ "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md",
+ "text-[var(--oh-muted)] transition-colors",
+ "hover:bg-[var(--oh-surface-raised)] hover:text-white",
+ "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[var(--oh-border)]",
+ "disabled:cursor-not-allowed disabled:opacity-50",
+);
+
+/**
+ * Compact "new thread folder" control for the conversation panel header.
+ * Opens the same workspace (local) or repository (cloud) picker as the
+ * sidebar new-conversation flows.
+ */
+export function ConversationPanelNewThreadPicker({
+ backendKind,
+}: {
+ backendKind: BackendKind;
+}) {
+ const { t } = useTranslation("openhands");
+ const ariaLabel = t(I18nKey.CONVERSATION_PANEL$NEW_THREAD_FOLDER_ARIA);
+
+ const triggerIcon = (
+ <FolderPlus className="h-4 w-4 shrink-0" aria-hidden strokeWidth={2} />
+ );
+
+ if (backendKind === "local") {
+ return (
+ <LocalNewConversationMenu
+ useFixedPlacement
+ popoverTestId="conversation-panel-new-thread-popover"
+ popoverClassName=""
+ trigger={({
+ onClick,
+ "aria-expanded": expanded,
+ disabled,
+ "aria-haspopup": hasPopup,
+ }) => (
+ <button
+ type="button"
+ className={triggerClassName}
+ aria-label={ariaLabel}
+ aria-expanded={expanded}
+ aria-haspopup={hasPopup}
+ disabled={disabled}
+ data-testid="conversation-panel-new-thread-picker"
+ onClick={onClick}
+ >
+ {triggerIcon}
+ </button>
+ )}
+ />
+ );
+ }
+
+ return (
+ <CloudNewConversationMenu
+ useFixedPlacement
+ popoverTestId="conversation-panel-new-thread-popover"
+ popoverClassName=""
+ trigger={({
+ onClick,
+ "aria-expanded": expanded,
+ disabled,
+ "aria-haspopup": hasPopup,
+ }) => (
+ <button
+ type="button"
+ className={triggerClassName}
+ aria-label={ariaLabel}
+ aria-expanded={expanded}
+ aria-haspopup={hasPopup}
+ disabled={disabled}
+ data-testid="conversation-panel-new-thread-picker"
+ onClick={onClick}
+ >
+ {triggerIcon}
+ </button>
+ )}
+ />
+ );
+}
diff --git a/src/components/features/conversation-panel/conversation-panel.tsx b/src/components/features/conversation-panel/conversation-panel.tsx
index 53413e8dc1..804501e24c 100644
--- a/src/components/features/conversation-panel/conversation-panel.tsx
+++ b/src/components/features/conversation-panel/conversation-panel.tsx
@@ -1,8 +1,9 @@
import React from "react";
import { useTranslation } from "react-i18next";
-import { ListFilter } from "lucide-react";
+import { Folder, Plus } from "lucide-react";
import { I18nKey } from "#/i18n/declaration";
import { useNavigation } from "#/context/navigation-context";
+import { useActiveBackend } from "#/contexts/active-backend-context";
import { usePaginatedConversations } from "#/hooks/query/use-paginated-conversations";
import { useStartTasks } from "#/hooks/query/use-start-tasks";
import { useDeleteConversation } from "#/hooks/mutation/use-delete-conversation";
@@ -20,12 +21,21 @@ import {
displaySuccessToast,
} from "#/utils/custom-toast-handlers";
import { isExecutionActive } from "#/utils/status";
+import { useCreateConversation } from "#/hooks/mutation/use-create-conversation";
+import { useIsCreatingConversation } from "#/hooks/use-is-creating-conversation";
import { ConversationCard } from "./conversation-card/conversation-card";
import { StartTaskCard } from "./start-task-card/start-task-card";
import { ConversationCardSkeleton } from "./conversation-card/conversation-card-skeleton";
import { CompactConversationRow } from "./compact-conversation-row";
import { useConversationPanelPreferencesStore } from "#/stores/conversation-panel-preferences-store";
import { cn } from "#/utils/utils";
+import { ConversationPanelFilterMenu } from "./conversation-panel-filter-menu";
+import { ConversationPanelNewThreadPicker } from "./conversation-panel-new-thread-picker";
+import {
+ groupConversations,
+ sortConversationsByField,
+ type ConversationGroupLaunch,
+} from "./conversation-panel-list-helpers";
interface ConversationPanelProps {
onClose?: () => void;
@@ -40,8 +50,6 @@ interface ConversationPanelProps {
const noop = () => {};
const ONE_HOUR_MS = 60 * 60 * 1000;
-const capitalizeLabel = (label: string) =>
- label.length > 0 ? label.charAt(0).toUpperCase() + label.slice(1) : label;
const partitionByCutoff = <T extends { updated_at: string }>(
items: readonly T[],
@@ -71,6 +79,7 @@ export function ConversationPanel({
}: ConversationPanelProps) {
const { t } = useTranslation("openhands");
const { conversationId: currentConversationId, navigate } = useNavigation();
+ const { backend: activeBackend } = useActiveBackend();
// Click-outside is only relevant in the legacy drawer mode where an
// onClose handler is provided. When the panel is rendered inline (e.g.
// as the always-visible conversation list pane), clicking outside should
@@ -85,11 +94,8 @@ export function ConversationPanel({
confirmExitConversationModalVisible,
setConfirmExitConversationModalVisible,
] = React.useState(false);
- const [confirmDeleteOlderVisible, setConfirmDeleteOlderVisible] =
+ const [confirmDeleteAllVisible, setConfirmDeleteAllVisible] =
React.useState(false);
- // Filter-menu toggles persist across reloads via the preferences store —
- // the menu's open/closed state stays transient (React.useState) since
- // users expect a dropdown to start closed every time they revisit.
const showOlderConversations = useConversationPanelPreferencesStore(
(state) => state.showOlderConversations,
);
@@ -102,11 +108,56 @@ export function ConversationPanel({
const toggleShowRepoBranchMetadata = useConversationPanelPreferencesStore(
(state) => state.toggleShowRepoBranchMetadata,
);
- const [olderFilterMenuOpen, setOlderFilterMenuOpen] = React.useState(false);
+ const showLlmProfiles = useConversationPanelPreferencesStore(
+ (state) => state.showLlmProfiles,
+ );
+ const toggleShowLlmProfiles = useConversationPanelPreferencesStore(
+ (state) => state.toggleShowLlmProfiles,
+ );
+ const organizeMode = useConversationPanelPreferencesStore(
+ (state) => state.organizeMode,
+ );
+ const setOrganizeMode = useConversationPanelPreferencesStore(
+ (state) => state.setOrganizeMode,
+ );
+ const conversationSort = useConversationPanelPreferencesStore(
+ (state) => state.conversationSort,
+ );
+ const setConversationSort = useConversationPanelPreferencesStore(
+ (state) => state.setConversationSort,
+ );
+ const threadScope = useConversationPanelPreferencesStore(
+ (state) => state.threadScope,
+ );
+ const setThreadScope = useConversationPanelPreferencesStore(
+ (state) => state.setThreadScope,
+ );
+ const [filterMenuOpen, setFilterMenuOpen] = React.useState(false);
const [isListScrolled, setIsListScrolled] = React.useState(false);
- const olderFilterMenuRef = useClickOutsideElement<HTMLDivElement>(() => {
- setOlderFilterMenuOpen(false);
+ const filterMenuRef = useClickOutsideElement<HTMLDivElement>(() => {
+ setFilterMenuOpen(false);
});
+ const [collapsedGroupIds, setCollapsedGroupIds] = React.useState<
+ ReadonlySet<string>
+ >(() => new Set());
+
+ const toggleGroupCollapsed = React.useCallback((groupId: string) => {
+ setCollapsedGroupIds((prev) => {
+ const next = new Set(prev);
+ if (next.has(groupId)) {
+ next.delete(groupId);
+ } else {
+ next.add(groupId);
+ }
+ return next;
+ });
+ }, []);
+
+ React.useEffect(() => {
+ if (organizeMode !== "grouped") {
+ setCollapsedGroupIds(new Set());
+ }
+ }, [organizeMode]);
const scrollContainerRef = React.useRef<HTMLDivElement>(null);
const [selectedConversationId, setSelectedConversationId] = React.useState<
string | null
@@ -128,16 +179,86 @@ export function ConversationPanel({
[data],
);
- const { recent: recentConversations, older: olderConversations } =
- React.useMemo(() => partitionByCutoff(conversations), [conversations]);
+ const scopedConversations = React.useMemo(() => {
+ if (threadScope === "relevant") {
+ return conversations.filter((c) => isExecutionActive(c.execution_status));
+ }
+ return conversations;
+ }, [conversations, threadScope]);
+
+ const { recent: recentScoped, older: olderScoped } = React.useMemo(
+ () => partitionByCutoff(scopedConversations),
+ [scopedConversations],
+ );
+
+ const sortedRecent = React.useMemo(
+ () => sortConversationsByField(recentScoped, conversationSort),
+ [recentScoped, conversationSort],
+ );
+
+ const sortedOlder = React.useMemo(
+ () => sortConversationsByField(olderScoped, conversationSort),
+ [olderScoped, conversationSort],
+ );
+
+ const groupLabels = React.useMemo(
+ () => ({
+ emptyWorkspace: t(I18nKey.CONVERSATION_PANEL$NO_WORKSPACE),
+ emptyRepository: t(I18nKey.CONVERSATION_PANEL$NO_REPOSITORY),
+ }),
+ [t],
+ );
+
+ const conversationGroups = React.useMemo(() => {
+ if (compact || organizeMode !== "grouped") {
+ return null;
+ }
+ // Use the unsorted partitions: groupConversations sorts each bucket
+ // internally by `sortField`, so pre-sorting the merged input is wasted
+ // work in grouped mode (the per-group sort overrides any global order).
+ const merged = [
+ ...recentScoped,
+ ...(showOlderConversations ? olderScoped : []),
+ ];
+ return groupConversations(
+ merged,
+ activeBackend.kind,
+ conversationSort,
+ groupLabels,
+ );
+ }, [
+ activeBackend.kind,
+ compact,
+ conversationSort,
+ groupLabels,
+ olderScoped,
+ organizeMode,
+ recentScoped,
+ showOlderConversations,
+ ]);
+
const compactVisibleConversations = React.useMemo(
() =>
- recentConversations.filter((conversation) =>
- isExecutionActive(conversation.execution_status),
+ sortConversationsByField(
+ recentScoped.filter((conversation) =>
+ isExecutionActive(conversation.execution_status),
+ ),
+ conversationSort,
),
- [recentConversations],
+ [conversationSort, recentScoped],
);
+ const visibleFlatCount =
+ sortedRecent.length +
+ (!compact && showOlderConversations ? sortedOlder.length : 0);
+
+ const visibleGroupedCount = React.useMemo(() => {
+ if (!conversationGroups) {
+ return 0;
+ }
+ return conversationGroups.reduce((n, g) => n + g.conversations.length, 0);
+ }, [conversationGroups]);
+
const { mutate: deleteConversation, mutateAsync: deleteConversationAsync } =
useDeleteConversation();
const { mutate: pauseConversation } = useUnifiedPauseConversation();
@@ -147,11 +268,32 @@ export function ConversationPanel({
// more" link rendered at the end of the list — there is no scroll-driven
// pagination, which previously caused the panel to feel like it had stray
// scrollable space at the bottom.
- const olderHidden = olderConversations.length > 0 && !showOlderConversations;
+ const olderHidden = olderScoped.length > 0 && !showOlderConversations;
// Compact mode also hides "Load more" — paginating into archived
// conversations contradicts the "active only" intent of the icon rail.
const showLoadMore = !!hasNextPage && !olderHidden && !compact;
+ const { mutate: createConversation } = useCreateConversation();
+ const isCreatingConversationFlow = useIsCreatingConversation();
+
+ const launchFromGroup = React.useCallback(
+ (launch: ConversationGroupLaunch) => {
+ if (isCreatingConversationFlow) return;
+ createConversation(
+ {
+ workingDir: launch.workingDir,
+ repository: launch.repository,
+ },
+ {
+ onSuccess: (data) => {
+ navigate(`/conversations/${data.conversation_id}`);
+ },
+ },
+ );
+ },
+ [createConversation, isCreatingConversationFlow, navigate],
+ );
+
const handleDeleteProject = React.useCallback(
(conversationId: string, title: string) => {
setConfirmDeleteModalVisible(true);
@@ -203,8 +345,8 @@ export function ConversationPanel({
}
};
- const handleConfirmDeleteOlder = async () => {
- const idsToDelete = olderConversations.map((c) => c.id);
+ const handleConfirmDeleteAll = async () => {
+ const idsToDelete = conversations.map((c) => c.id);
const results = await Promise.allSettled(
idsToDelete.map((conversationId) =>
deleteConversationAsync({ conversationId }),
@@ -247,10 +389,15 @@ export function ConversationPanel({
sandboxStatus={conversation.sandbox_status}
lastUpdatedAt={conversation.updated_at}
createdAt={conversation.created_at}
- workspaceWorkingDir={conversation.workspace?.working_dir}
+ workspaceWorkingDir={
+ conversation.selected_workspace ??
+ conversation.workspace?.working_dir
+ }
isActive={conversation.id === currentConversationId}
onClose={onClose}
showRepositoryMetadata={showRepoBranchMetadata}
+ llmModel={conversation.llm_model}
+ showLlmProfiles={showLlmProfiles}
/>
);
}
@@ -259,7 +406,7 @@ export function ConversationPanel({
key={conversation.id}
to={`/conversations/${conversation.id}`}
onClick={onClose}
- className="block px-2 py-0.5"
+ className="block py-0.5"
>
<ConversationCard
onDelete={() =>
@@ -285,8 +432,13 @@ export function ConversationPanel({
setOpenContextMenuId(isOpen ? conversation.id : null)
}
isActive={conversation.id === currentConversationId}
- workspaceWorkingDir={conversation.workspace?.working_dir}
+ workspaceWorkingDir={
+ conversation.selected_workspace ??
+ conversation.workspace?.working_dir
+ }
showRepositoryMetadata={showRepoBranchMetadata}
+ llmModel={conversation.llm_model}
+ showLlmProfiles={showLlmProfiles}
/>
</NavigationLink>
);
@@ -300,6 +452,7 @@ export function ConversationPanel({
onClose,
openContextMenuId,
showRepoBranchMetadata,
+ showLlmProfiles,
],
);
@@ -312,84 +465,60 @@ export function ConversationPanel({
// background refetch, causing the skeleton/empty-state to flicker when
// the list is empty.
const showInitialSkeleton = isLoading;
+ const listIsEffectivelyEmpty =
+ organizeMode === "grouped" && !compact
+ ? visibleGroupedCount === 0
+ : visibleFlatCount === 0;
const showEmptyState =
- !isLoading && conversations.length === 0 && !startTasks?.length;
- const showSummaryBar = !compact && olderConversations.length > 0;
+ !isLoading && !compact && listIsEffectivelyEmpty && !startTasks?.length;
+
+ const showConversationHeader = !compact;
return (
<div
ref={ref}
data-testid="conversation-panel"
- className="w-full h-full flex flex-col"
+ className="flex h-full min-h-0 w-full flex-col"
>
- {showSummaryBar && (
+ {showConversationHeader && (
<div
- data-testid="older-conversations-summary"
className={cn(
- "pl-4 pr-3 py-2 text-[var(--oh-muted)] flex flex-wrap items-center gap-x-2 gap-y-1",
- isListScrolled && "border-b border-[var(--oh-border-subtle)]",
+ "-mx-2 border-b",
+ isListScrolled ? "border-[var(--oh-border)]" : "border-transparent",
)}
>
- <span className="text-sm font-medium text-[var(--oh-muted)]">
- {t(I18nKey.SIDEBAR$CONVERSATIONS)}
- </span>
- <div ref={olderFilterMenuRef} className="relative ml-auto">
- <button
- type="button"
- data-testid="older-conversations-filter-toggle"
- aria-label="Older conversations filter"
- aria-expanded={olderFilterMenuOpen}
- onClick={() => setOlderFilterMenuOpen((open) => !open)}
- className="inline-flex items-center justify-center rounded-md p-1 text-[var(--oh-muted)] hover:text-white hover:bg-[var(--oh-surface-raised)] transition-colors"
- >
- <ListFilter size={14} />
- </button>
-
- {olderFilterMenuOpen && (
- <div
- data-testid="older-conversations-filter-menu"
- className="absolute right-0 top-full mt-0 z-50 min-w-[168px] overflow-hidden rounded-[6px] bg-tertiary px-1 py-[6px] text-white context-menu-box-shadow"
- >
- <button
- type="button"
- data-testid="toggle-older-conversations"
- onClick={() => {
- toggleShowOlderConversations();
- setOlderFilterMenuOpen(false);
- }}
- className="block w-full rounded px-2 py-2 text-left text-sm text-white hover:bg-[var(--oh-interactive-hover)]"
- >
- {showOlderConversations
- ? capitalizeLabel(t(I18nKey.CONVERSATION$HIDE))
- : capitalizeLabel(t(I18nKey.CONVERSATION$SHOW_ALL))}
- </button>
- <button
- type="button"
- data-testid="delete-older-conversations"
- onClick={() => {
- setConfirmDeleteOlderVisible(true);
- setOlderFilterMenuOpen(false);
- }}
- className="block w-full rounded px-2 py-2 text-left text-sm text-danger hover:bg-[var(--oh-interactive-hover)]"
- >
- {capitalizeLabel(t(I18nKey.CONVERSATION$DELETE_ALL))}
- </button>
- <div className="my-1 h-[1px] w-full bg-[var(--oh-border)]" />
- <button
- type="button"
- data-testid="toggle-repo-branch-metadata"
- onClick={() => {
- toggleShowRepoBranchMetadata();
- setOlderFilterMenuOpen(false);
- }}
- className="block w-full rounded px-2 py-2 text-left text-sm text-white hover:bg-[var(--oh-interactive-hover)]"
- >
- {showRepoBranchMetadata
- ? "Hide Repo/Branch"
- : "Show Repo/Branch"}
- </button>
- </div>
- )}
+ <div
+ data-testid="older-conversations-summary"
+ className="flex flex-wrap items-center gap-x-2 gap-y-1 py-2 pl-4 pr-2 text-[var(--oh-muted)]"
+ >
+ <span className="text-sm font-medium text-[var(--oh-muted)]">
+ {t(I18nKey.SIDEBAR$CONVERSATIONS)}
+ </span>
+ <div className="ml-auto flex shrink-0 items-center gap-0.5">
+ <ConversationPanelNewThreadPicker
+ backendKind={activeBackend.kind}
+ />
+ <ConversationPanelFilterMenu
+ filterMenuOpen={filterMenuOpen}
+ setFilterMenuOpen={setFilterMenuOpen}
+ menuRef={filterMenuRef}
+ backendKind={activeBackend.kind}
+ organizeMode={organizeMode}
+ setOrganizeMode={setOrganizeMode}
+ conversationSort={conversationSort}
+ setConversationSort={setConversationSort}
+ threadScope={threadScope}
+ setThreadScope={setThreadScope}
+ showOlderConversations={showOlderConversations}
+ toggleShowOlderConversations={toggleShowOlderConversations}
+ showRepoBranchMetadata={showRepoBranchMetadata}
+ toggleShowRepoBranchMetadata={toggleShowRepoBranchMetadata}
+ showLlmProfiles={showLlmProfiles}
+ toggleShowLlmProfiles={toggleShowLlmProfiles}
+ totalConversationsCount={conversations.length}
+ onRequestDeleteAll={() => setConfirmDeleteAllVisible(true)}
+ />
+ </div>
</div>
</div>
)}
@@ -399,20 +528,12 @@ export function ConversationPanel({
onScroll={(event) => {
setIsListScrolled(event.currentTarget.scrollTop > 0);
}}
- className="flex-1 min-h-0 overflow-y-auto overflow-x-hidden overscroll-contain custom-scrollbar-always"
+ className="flex min-h-0 flex-1 flex-col overflow-y-auto overflow-x-hidden overscroll-contain custom-scrollbar-always"
>
- {showInitialSkeleton && (
- <div>
- {Array.from({ length: 5 }).map((_, index) => (
- <div key={index} className={compact ? "" : "block px-2 py-0.5"}>
- <ConversationCardSkeleton compact={compact} />
- </div>
- ))}
- </div>
- )}
+ {showInitialSkeleton && <ConversationCardSkeleton compact={compact} />}
{!compact && showEmptyState && (
- <div className="flex flex-col items-center justify-center h-full">
+ <div className="flex min-h-0 flex-1 flex-col items-center justify-center px-4 py-8">
<p className="text-[var(--oh-muted)]">
{t(I18nKey.CONVERSATION$NO_CONVERSATIONS)}
</p>
@@ -433,16 +554,90 @@ export function ConversationPanel({
</NavigationLink>
))}
- {/* Recent conversations (last_updated within the past hour) */}
- {(compact ? compactVisibleConversations : recentConversations).map(
- renderConversationCard,
- )}
-
- {/* Older conversations render by default; users can hide them from the
- summary's filter menu. Compact mode still omits the summary row. */}
- {!compact &&
- showOlderConversations &&
- olderConversations.map(renderConversationCard)}
+ {!showInitialSkeleton && compact
+ ? compactVisibleConversations.map(renderConversationCard)
+ : null}
+
+ {!showInitialSkeleton &&
+ !compact &&
+ organizeMode === "grouped" &&
+ conversationGroups &&
+ conversationGroups.length > 0 ? (
+ <nav
+ aria-label={t(I18nKey.SIDEBAR$CONVERSATIONS)}
+ className="space-y-1 md:space-y-0.5 pb-1"
+ >
+ {conversationGroups.map((group) => {
+ const headingId = `thread-folder-${group.id.replace(/[^a-zA-Z0-9_-]/g, "-")}`;
+ const expanded = !collapsedGroupIds.has(group.id);
+ return (
+ <section key={group.id} aria-labelledby={headingId}>
+ <div
+ className={cn(
+ "flex h-8 w-full min-w-0 items-center gap-0.5 rounded-md pl-2 pr-1 text-sm font-medium",
+ "text-[var(--oh-muted)] transition-colors",
+ "hover:bg-[var(--oh-surface-raised)] hover:text-white",
+ )}
+ >
+ <button
+ type="button"
+ id={headingId}
+ aria-expanded={expanded}
+ onClick={() => toggleGroupCollapsed(group.id)}
+ className="flex min-h-8 min-w-0 flex-1 items-center gap-2 rounded-md py-1 text-left text-inherit outline-none transition-colors focus-visible:ring-1 focus-visible:ring-[var(--oh-border)]"
+ >
+ <Folder className="h-4 w-4 shrink-0" aria-hidden />
+ <span className="truncate">{group.label}</span>
+ </button>
+ <button
+ type="button"
+ className={cn(
+ "inline-flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded-md",
+ "text-inherit transition-colors",
+ "hover:bg-white/10 hover:text-white",
+ "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[var(--oh-border)]",
+ "disabled:cursor-not-allowed disabled:opacity-50",
+ )}
+ disabled={isCreatingConversationFlow}
+ aria-label={t(
+ I18nKey.CONVERSATION_PANEL$ADD_CONVERSATION_TO_GROUP,
+ { label: group.label },
+ )}
+ data-testid={`add-conversation-to-group-${group.id.replace(/[^a-zA-Z0-9_-]/g, "-")}`}
+ onClick={(e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ launchFromGroup(group.launch);
+ }}
+ >
+ <Plus
+ className="h-3.5 w-3.5 shrink-0"
+ aria-hidden
+ strokeWidth={2}
+ />
+ </button>
+ </div>
+ {expanded ? (
+ <div className="mt-0.5 space-y-0.5">
+ {group.conversations.map(renderConversationCard)}
+ </div>
+ ) : null}
+ </section>
+ );
+ })}
+ </nav>
+ ) : null}
+
+ {!showInitialSkeleton &&
+ !compact &&
+ organizeMode === "chronological" ? (
+ <>
+ {sortedRecent.map(renderConversationCard)}
+ {showOlderConversations
+ ? sortedOlder.map(renderConversationCard)
+ : null}
+ </>
+ ) : null}
{/* Explicit "Load more" trigger. Only shown when more pages exist
*and* the older list is currently visible (or there are no older
@@ -481,17 +676,17 @@ export function ConversationPanel({
/>
)}
- {confirmDeleteOlderVisible && (
+ {confirmDeleteAllVisible && (
<ConfirmDeleteModal
- title={t(I18nKey.CONVERSATION$CONFIRM_DELETE_OLDER_TITLE)}
- description={t(I18nKey.CONVERSATION$CONFIRM_DELETE_OLDER_DESC, {
- count: olderConversations.length,
+ title={t(I18nKey.CONVERSATION$CONFIRM_DELETE_ALL_TITLE)}
+ description={t(I18nKey.CONVERSATION$CONFIRM_DELETE_ALL_DESC, {
+ count: conversations.length,
})}
onConfirm={async () => {
- await handleConfirmDeleteOlder();
- setConfirmDeleteOlderVisible(false);
+ await handleConfirmDeleteAll();
+ setConfirmDeleteAllVisible(false);
}}
- onCancel={() => setConfirmDeleteOlderVisible(false)}
+ onCancel={() => setConfirmDeleteAllVisible(false)}
/>
)}
diff --git a/src/components/features/conversation-panel/new-conversation-button-local.tsx b/src/components/features/conversation-panel/local-new-conversation-menu.tsx
similarity index 64%
rename from src/components/features/conversation-panel/new-conversation-button-local.tsx
rename to src/components/features/conversation-panel/local-new-conversation-menu.tsx
index 5759b43053..7d116b856c 100644
--- a/src/components/features/conversation-panel/new-conversation-button-local.tsx
+++ b/src/components/features/conversation-panel/local-new-conversation-menu.tsx
@@ -1,6 +1,5 @@
import React from "react";
import { useTranslation } from "react-i18next";
-import { Plus } from "lucide-react";
import { useCreateConversation } from "#/hooks/mutation/use-create-conversation";
import { useNavigation } from "#/context/navigation-context";
@@ -10,36 +9,57 @@ import { useResolvedWorkspaces } from "#/hooks/query/use-resolved-workspaces";
import { I18nKey } from "#/i18n/declaration";
import { cn } from "#/utils/utils";
import RepoIcon from "#/icons/repo.svg?react";
-import { StyledTooltip } from "#/components/shared/buttons/styled-tooltip";
import { FolderBrowserModal } from "#/components/features/home/workspace-dropdown/folder-browser-modal";
import { ManageWorkspacesModal } from "#/components/features/home/workspace-dropdown/manage-workspaces-modal";
-interface LocalNewConversationButtonProps {
+import { NEW_CONVERSATION_DROPDOWN_SURFACE } from "./new-conversation-dropdown-styles";
+import { usePopoverFixedPlacement } from "#/hooks/use-popover-fixed-placement";
+
+export type LocalNewConversationMenuTriggerProps = {
+ onClick: () => void;
+ "aria-expanded": boolean;
+ "aria-haspopup": "menu";
+ disabled?: boolean;
+};
+
+export interface LocalNewConversationMenuProps {
+ trigger: (props: LocalNewConversationMenuTriggerProps) => React.ReactNode;
+ /** Root wrapper class (e.g. `relative` + alignment in header row) */
+ className?: string;
+ /** Panel positioning / dimensions when using absolute placement (sidebar) */
+ popoverClassName: string;
+ /** Optional test id for the popover surface */
+ popoverTestId?: string;
/**
- * Render the trigger as a "+" icon-only button (used by the collapsed
- * sidebar). The popover content is unchanged; only the trigger pill
- * collapses.
+ * Use `position: fixed` from the trigger rect so the menu is not clipped by
+ * sidebar overflow (conversation panel header).
*/
- compact?: boolean;
+ useFixedPlacement?: boolean;
}
/**
- * Local-backend variant of the sidebar "+ New Conversation" trigger.
- *
- * Opens an inline popover on top of the conversation list. The popover is a
- * flat list: each entry (including a leading "No workspace" option)
- * immediately starts a conversation when clicked. The sticky footer still
- * exposes "+ Add Workspace" / "Manage Workspaces" entries.
+ * Workspace/repo picker + launch flow for local agent-server backends.
+ * Shared by the sidebar "+ New conversation" control and the conversation
+ * panel "new thread folder" control.
*/
-export function LocalNewConversationButton({
- compact = false,
-}: LocalNewConversationButtonProps = {}) {
+export function LocalNewConversationMenu({
+ trigger,
+ className,
+ popoverClassName,
+ popoverTestId = "new-conversation-popover",
+ useFixedPlacement = false,
+}: LocalNewConversationMenuProps) {
const { t } = useTranslation("openhands");
const { navigate } = useNavigation();
const [open, setOpen] = React.useState(false);
const popoverRef = React.useRef<HTMLDivElement>(null);
+ const triggerWrapRef = React.useRef<HTMLSpanElement>(null);
+ const fixedBox = usePopoverFixedPlacement(triggerWrapRef, {
+ open,
+ enabled: useFixedPlacement,
+ });
const {
workspaceParents,
@@ -54,14 +74,8 @@ export function LocalNewConversationButton({
const { mutate: createConversation, isPending } = useCreateConversation();
const isCreatingElsewhere = useIsCreatingConversation();
- // `isCreatingElsewhere` already covers in-flight mutations and the
- // post-submit navigation window (`isNavigating`). We deliberately do not
- // include `isSuccess` here: this component stays mounted across navigation,
- // so a sticky `isSuccess` would lock the button as disabled forever.
const isCreating = isPending || isCreatingElsewhere;
- // Close the popover on outside click. Modal-based children portal out of
- // the popover, so we ignore clicks while a modal is showing.
React.useEffect(() => {
if (!open || browserOpen || manageOpen) return undefined;
const onDown = (e: MouseEvent) => {
@@ -101,9 +115,9 @@ export function LocalNewConversationButton({
};
const itemClass = cn(
- "flex items-center gap-2 w-full px-2 py-2 text-sm text-white text-left cursor-pointer",
- "hover:bg-[var(--oh-interactive-hover)] rounded-md transition-colors duration-150 font-normal",
- "disabled:opacity-60 disabled:cursor-not-allowed",
+ "flex w-full cursor-pointer items-center gap-2 rounded px-2 py-2 text-left text-sm text-white",
+ "font-normal transition-colors hover:bg-[var(--oh-interactive-hover)]",
+ "disabled:cursor-not-allowed disabled:opacity-60",
);
const keepPopoverOpenOnMouseDown = React.useCallback(
@@ -114,53 +128,47 @@ export function LocalNewConversationButton({
[],
);
- const newConversationLabel = t(I18nKey.SIDEBAR$NEW_CONVERSATION);
-
- const triggerButton = (
- <button
- type="button"
- data-testid="new-conversation-button"
- onClick={() => setOpen((o) => !o)}
- aria-expanded={open}
- aria-label={compact ? newConversationLabel : undefined}
- className={cn(
- "flex items-center rounded-md cursor-pointer transition-colors",
- "text-sm font-medium text-white bg-[var(--oh-surface)]/60 hover:bg-[var(--oh-surface-raised)]",
- "border border-[var(--oh-border)]",
- compact
- ? "justify-center w-10 h-10 p-0 mx-auto"
- : "gap-1.5 w-full px-3 py-2",
- )}
- >
- <Plus width={16} height={16} className="shrink-0" />
- {!compact && newConversationLabel}
- </button>
- );
+ const toggleOpen = React.useCallback(() => {
+ setOpen((o) => !o);
+ }, []);
+
+ const showPopover = open && (!useFixedPlacement || fixedBox !== null);
+
+ const fixedStyle: React.CSSProperties | undefined =
+ useFixedPlacement && fixedBox
+ ? {
+ position: "fixed",
+ top: fixedBox.top,
+ left: fixedBox.left,
+ width: fixedBox.width,
+ }
+ : undefined;
return (
<div
- className={cn("relative", compact && "flex justify-center")}
+ className={cn(!useFixedPlacement && "relative", className)}
ref={popoverRef}
>
- {compact ? (
- <StyledTooltip content={newConversationLabel} placement="right">
- {triggerButton}
- </StyledTooltip>
- ) : (
- triggerButton
- )}
-
- {open && (
+ <span ref={triggerWrapRef} className="inline-flex">
+ {trigger({
+ onClick: toggleOpen,
+ "aria-expanded": open,
+ "aria-haspopup": "menu",
+ disabled: isCreating,
+ })}
+ </span>
+
+ {showPopover && (
<div
- data-testid="new-conversation-popover"
+ data-testid={popoverTestId}
className={cn(
- "absolute z-30 top-full mt-2 p-1",
- "bg-[var(--oh-surface)] border border-[var(--oh-border-input)] rounded-lg shadow-xl",
- "flex flex-col",
- compact ? "left-0 w-[260px]" : "left-0 right-0",
+ NEW_CONVERSATION_DROPDOWN_SURFACE,
+ !useFixedPlacement &&
+ cn("absolute top-full mt-0", popoverClassName),
)}
+ style={fixedStyle}
>
- <ul className="flex flex-col max-h-[40vh] sm:max-h-[280px] overflow-y-auto">
+ <ul className="flex max-h-[40vh] flex-col overflow-y-auto sm:max-h-[280px]">
<li>
<button
type="button"
@@ -169,7 +177,7 @@ export function LocalNewConversationButton({
onClick={() => launch()}
className={itemClass}
>
- <span className="italic text-[var(--oh-muted)]">
+ <span className="text-[var(--oh-muted)]">
{t(I18nKey.HOME$NO_WORKSPACE_OPTION)}
</span>
</button>
@@ -191,7 +199,7 @@ export function LocalNewConversationButton({
))}
</ul>
- <div className="flex flex-col border-t border-[var(--oh-border)] mt-1 pt-1">
+ <div className="mt-1 flex flex-col pt-1">
<button
type="button"
data-testid="add-workspaces-button"
diff --git a/src/components/features/conversation-panel/new-conversation-button.tsx b/src/components/features/conversation-panel/new-conversation-button.tsx
index ef016b88a1..d2613e256d 100644
--- a/src/components/features/conversation-panel/new-conversation-button.tsx
+++ b/src/components/features/conversation-panel/new-conversation-button.tsx
@@ -1,7 +1,20 @@
+import React from "react";
+import { useTranslation } from "react-i18next";
+import { Plus } from "lucide-react";
+
+import { I18nKey } from "#/i18n/declaration";
+import { cn } from "#/utils/utils";
+import { StyledTooltip } from "#/components/shared/buttons/styled-tooltip";
import { useActiveBackend } from "#/contexts/active-backend-context";
-import { CloudNewConversationButton } from "./new-conversation-button-cloud";
-import { LocalNewConversationButton } from "./new-conversation-button-local";
+import {
+ CloudNewConversationMenu,
+ type CloudNewConversationMenuTriggerProps,
+} from "./cloud-new-conversation-menu";
+import {
+ LocalNewConversationMenu,
+ type LocalNewConversationMenuTriggerProps,
+} from "./local-new-conversation-menu";
interface NewConversationButtonProps {
/**
@@ -18,12 +31,70 @@ interface NewConversationButtonProps {
* The popover content depends on the active backend: local backends operate
* on workspace folders so we surface the workspace picker, while cloud
* backends operate on git repositories so we surface a repository picker.
+ *
+ * The trigger pill (the "+" button itself) is identical for both variants;
+ * only the menu component differs. Both `Cloud/LocalNewConversationMenu`
+ * accept structurally identical trigger props, so a single `renderTrigger`
+ * callback can satisfy either menu's type signature.
*/
export function NewConversationButton({
compact = false,
}: NewConversationButtonProps = {}) {
+ const { t } = useTranslation("openhands");
+ const newConversationLabel = t(I18nKey.SIDEBAR$NEW_CONVERSATION);
const isCloud = useActiveBackend().backend.kind === "cloud";
- if (isCloud) return <CloudNewConversationButton compact={compact} />;
- return <LocalNewConversationButton compact={compact} />;
+ const renderTrigger = React.useCallback(
+ (
+ tp:
+ | CloudNewConversationMenuTriggerProps
+ | LocalNewConversationMenuTriggerProps,
+ ) => {
+ const triggerButton = (
+ <button
+ type="button"
+ data-testid="new-conversation-button"
+ {...tp}
+ aria-label={compact ? newConversationLabel : undefined}
+ className={cn(
+ "flex items-center rounded-md cursor-pointer transition-colors",
+ "text-sm font-medium text-white bg-[var(--oh-surface)]/60 hover:bg-[var(--oh-surface-raised)]",
+ "border border-[var(--oh-border)]",
+ compact
+ ? "justify-center w-10 h-10 p-0 mx-auto"
+ : "gap-1.5 w-full px-3 py-2",
+ )}
+ >
+ <Plus width={16} height={16} className="shrink-0" />
+ {!compact && newConversationLabel}
+ </button>
+ );
+
+ return compact ? (
+ <StyledTooltip content={newConversationLabel} placement="right">
+ {triggerButton}
+ </StyledTooltip>
+ ) : (
+ triggerButton
+ );
+ },
+ [compact, newConversationLabel],
+ );
+
+ const wrapperClassName = cn(compact && "flex justify-center");
+ const popoverClassName = compact ? "left-0 w-[260px]" : "left-0 right-0";
+
+ return isCloud ? (
+ <CloudNewConversationMenu
+ className={wrapperClassName}
+ popoverClassName={popoverClassName}
+ trigger={renderTrigger}
+ />
+ ) : (
+ <LocalNewConversationMenu
+ className={wrapperClassName}
+ popoverClassName={popoverClassName}
+ trigger={renderTrigger}
+ />
+ );
}
diff --git a/src/components/features/conversation-panel/new-conversation-dropdown-styles.ts b/src/components/features/conversation-panel/new-conversation-dropdown-styles.ts
new file mode 100644
index 0000000000..861780f8cd
--- /dev/null
+++ b/src/components/features/conversation-panel/new-conversation-dropdown-styles.ts
@@ -0,0 +1,6 @@
+import { cn } from "#/utils/utils";
+
+/** Match conversation panel filter and other sidebar menus */
+export const NEW_CONVERSATION_DROPDOWN_SURFACE = cn(
+ "z-50 flex flex-col rounded-md border border-[var(--oh-border-subtle)] bg-tertiary px-1 py-1 text-white shadow-lg",
+);
diff --git a/src/components/features/sidebar/sidebar-conversation-list.tsx b/src/components/features/sidebar/sidebar-conversation-list.tsx
index c26c067900..f3a37df2c7 100644
--- a/src/components/features/sidebar/sidebar-conversation-list.tsx
+++ b/src/components/features/sidebar/sidebar-conversation-list.tsx
@@ -1,6 +1,5 @@
import { ConversationPanel } from "#/components/features/conversation-panel/conversation-panel";
import { useSidebarCollapsed } from "./sidebar-collapse-context";
-import { cn } from "#/utils/utils";
/**
* Conversation list section rendered inside the sidebar nav. The list itself
@@ -8,6 +7,9 @@ import { cn } from "#/utils/utils";
*
* In the collapsed sidebar variant the list reduces each row to a status
* indicator + hover-preview.
+ *
+ * Stays within the aside's horizontal padding so row hovers (group headers,
+ * conversation cards) align with {@link SidebarNavLink} items above.
*/
export function SidebarConversationList() {
const collapsed = useSidebarCollapsed();
@@ -17,10 +19,11 @@ export function SidebarConversationList() {
}
return (
- <div
- className={cn("hidden md:flex md:flex-col md:flex-1 md:min-h-0", "-mx-2")}
- >
- <div className="flex-1 min-h-0 overflow-hidden w-full">
+ <div className="hidden md:flex md:flex-col md:flex-1 md:min-h-0">
+ {/* Avoid overflow-hidden here: ConversationPanel's header uses `-mx-2` to
+ full-bleed the scroll divider to the aside edges; clipping would inset
+ the border. Scrolling stays contained on the panel's inner list. */}
+ <div className="flex min-h-0 w-full flex-1 flex-col">
<ConversationPanel />
</div>
</div>
diff --git a/src/hooks/use-click-outside-element.ts b/src/hooks/use-click-outside-element.ts
index a6d572c4ad..5bb69be83f 100644
--- a/src/hooks/use-click-outside-element.ts
+++ b/src/hooks/use-click-outside-element.ts
@@ -6,20 +6,29 @@ import React from "react";
*/
export const useClickOutsideElement = <T extends HTMLElement>(
callback: () => void,
+ ignoreOutsideClickRef?: React.RefObject<HTMLElement | null>,
) => {
const ref = React.useRef<T>(null);
+ // Hold the latest callback in a ref so the listener effect doesn't
+ // re-register every render when callers pass an inline arrow function.
+ const callbackRef = React.useRef(callback);
+ React.useEffect(() => {
+ callbackRef.current = callback;
+ }, [callback]);
React.useEffect(() => {
const handleClickOutside = (event: MouseEvent) => {
- if (ref.current && !ref.current.contains(event.target as Node)) {
- callback();
- }
+ const target = event.target as Node;
+ if (!ref.current) return;
+ if (ref.current.contains(target)) return;
+ if (ignoreOutsideClickRef?.current?.contains(target)) return;
+ callbackRef.current();
};
document.addEventListener("click", handleClickOutside);
return () => document.removeEventListener("click", handleClickOutside);
- }, [callback]);
+ }, [ignoreOutsideClickRef]);
return ref;
};
diff --git a/src/hooks/use-popover-fixed-placement.ts b/src/hooks/use-popover-fixed-placement.ts
new file mode 100644
index 0000000000..ef73ce3f2d
--- /dev/null
+++ b/src/hooks/use-popover-fixed-placement.ts
@@ -0,0 +1,56 @@
+import React from "react";
+
+export interface FixedPlacementBox {
+ top: number;
+ left: number;
+ width: number;
+}
+
+/**
+ * Position a popover with `position: fixed`, anchored below the trigger and
+ * clamped within the viewport. Used by the conversation-panel "+ New
+ * conversation" menus when they're rendered inside an overflow-hidden
+ * sidebar and would otherwise be clipped.
+ *
+ * Returns the measured `{ top, left, width }` box (or `null` when the
+ * popover is closed or fixed placement is disabled). The hook also wires
+ * up window resize + capture-phase scroll listeners so the box follows the
+ * trigger as the page moves.
+ */
+export function usePopoverFixedPlacement(
+ triggerRef: React.RefObject<HTMLElement | null>,
+ options: { open: boolean; enabled: boolean; targetWidth?: number },
+): FixedPlacementBox | null {
+ const { open, enabled, targetWidth = 16 * 16 } = options;
+ const [box, setBox] = React.useState<FixedPlacementBox | null>(null);
+
+ const measure = React.useCallback(() => {
+ const el = triggerRef.current;
+ if (!el) return;
+ const r = el.getBoundingClientRect();
+ const gutter = 8;
+ const width = Math.min(targetWidth, window.innerWidth - gutter * 2);
+ let left = r.right - width;
+ if (left < gutter) left = gutter;
+ if (left + width > window.innerWidth - gutter) {
+ left = Math.max(gutter, window.innerWidth - gutter - width);
+ }
+ setBox({ top: r.bottom + 4, left, width });
+ }, [triggerRef, targetWidth]);
+
+ React.useLayoutEffect(() => {
+ if (!open || !enabled) {
+ setBox(null);
+ return undefined;
+ }
+ measure();
+ window.addEventListener("resize", measure);
+ window.addEventListener("scroll", measure, true);
+ return () => {
+ window.removeEventListener("resize", measure);
+ window.removeEventListener("scroll", measure, true);
+ };
+ }, [open, enabled, measure]);
+
+ return box;
+}
diff --git a/src/i18n/translation.json b/src/i18n/translation.json
index 796ec7013f..815aefb3b3 100644
--- a/src/i18n/translation.json
+++ b/src/i18n/translation.json
@@ -14262,39 +14262,379 @@
"tr": "tümünü sil",
"uk": "видалити всі"
},
- "CONVERSATION$CONFIRM_DELETE_OLDER_TITLE": {
- "en": "Delete older conversations",
- "ja": "古い会話を削除",
- "zh-CN": "删除较早的会话",
- "zh-TW": "刪除較舊的對話",
- "ko-KR": "이전 대화 삭제",
- "no": "Slett eldre samtaler",
- "ar": "حذف المحادثات الأقدم",
- "de": "Ältere Unterhaltungen löschen",
- "fr": "Supprimer les anciennes conversations",
- "it": "Elimina conversazioni più vecchie",
- "pt": "Excluir conversas mais antigas",
- "es": "Eliminar conversaciones anteriores",
- "ca": "Esborra les converses anteriors",
- "tr": "Eski sohbetleri sil",
- "uk": "Видалити старіші розмови"
- },
- "CONVERSATION$CONFIRM_DELETE_OLDER_DESC": {
- "en": "Are you sure you want to delete {{count}} older conversations? This action cannot be undone.",
- "ja": "{{count}} 件の古い会話を削除してもよろしいですか?この操作は取り消せません。",
- "zh-CN": "确定要删除 {{count}} 条较早的会话吗?此操作无法撤销。",
- "zh-TW": "確定要刪除 {{count}} 則較舊的對話嗎?此動作無法復原。",
- "ko-KR": "이전 대화 {{count}}개를 삭제하시겠습니까? 이 작업은 되돌릴 수 없습니다.",
- "no": "Er du sikker på at du vil slette {{count}} eldre samtaler? Denne handlingen kan ikke angres.",
- "ar": "هل أنت متأكد من حذف {{count}} محادثة أقدم؟ لا يمكن التراجع عن هذا الإجراء.",
- "de": "Möchten Sie wirklich {{count}} ältere Unterhaltungen löschen? Diese Aktion kann nicht rückgängig gemacht werden.",
- "fr": "Voulez-vous vraiment supprimer {{count}} anciennes conversations ? Cette action est irréversible.",
- "it": "Sei sicuro di voler eliminare {{count}} conversazioni più vecchie? Questa azione non può essere annullata.",
- "pt": "Tem certeza de que deseja excluir {{count}} conversas mais antigas? Esta ação não pode ser desfeita.",
- "es": "¿Seguro que quieres eliminar {{count}} conversaciones anteriores? Esta acción no se puede deshacer.",
- "ca": "Segur que voleu esborrar {{count}} converses anteriors? Aquesta acció no es pot desfer.",
- "tr": "{{count}} eski sohbeti silmek istediğinize emin misiniz? Bu işlem geri alınamaz.",
- "uk": "Видалити {{count}} старіших розмов? Цю дію не можна скасувати."
+ "CONVERSATION_PANEL$FILTER_LABEL": {
+ "en": "Filter conversations",
+ "ja": "会話をフィルター",
+ "zh-CN": "筛选会话",
+ "zh-TW": "篩選對話",
+ "ko-KR": "대화 필터",
+ "no": "Filtrer samtaler",
+ "ar": "تصفية المحادثات",
+ "de": "Unterhaltungen filtern",
+ "fr": "Filtrer les conversations",
+ "it": "Filtra conversazioni",
+ "pt": "Filtrar conversas",
+ "es": "Filtrar conversaciones",
+ "ca": "Filtra converses",
+ "tr": "Konuşmaları filtrele",
+ "uk": "Фільтрувати розмови"
+ },
+ "CONVERSATION_PANEL$ORGANIZE": {
+ "en": "Organize",
+ "ja": "整理",
+ "zh-CN": "整理",
+ "zh-TW": "整理",
+ "ko-KR": "정리",
+ "no": "Organiser",
+ "ar": "تنظيم",
+ "de": "Anordnen",
+ "fr": "Organiser",
+ "it": "Organizza",
+ "pt": "Organizar",
+ "es": "Organizar",
+ "ca": "Organitza",
+ "tr": "Düzenle",
+ "uk": "Упорядкувати"
+ },
+ "CONVERSATION_PANEL$BY_WORKSPACE": {
+ "en": "By workspace",
+ "ja": "ワークスペース別",
+ "zh-CN": "按工作区",
+ "zh-TW": "依工作區",
+ "ko-KR": "워크스페이스별",
+ "no": "Etter arbeidsområde",
+ "ar": "حسب مساحة العمل",
+ "de": "Nach Arbeitsbereich",
+ "fr": "Par espace de travail",
+ "it": "Per area di lavoro",
+ "pt": "Por workspace",
+ "es": "Por espacio de trabajo",
+ "ca": "Per espai de treball",
+ "tr": "Çalışma alanına göre",
+ "uk": "За робочим простором"
+ },
+ "CONVERSATION_PANEL$BY_REPOSITORY": {
+ "en": "By repository",
+ "ja": "リポジトリ別",
+ "zh-CN": "按仓库",
+ "zh-TW": "依存放庫",
+ "ko-KR": "리포지토리별",
+ "no": "Etter repository",
+ "ar": "حسب المستودع",
+ "de": "Nach Repository",
+ "fr": "Par dépôt",
+ "it": "Per repository",
+ "pt": "Por repositório",
+ "es": "Por repositorio",
+ "ca": "Per repositori",
+ "tr": "Depoya göre",
+ "uk": "За репозиторієм"
+ },
+ "CONVERSATION_PANEL$CHRONOLOGICAL": {
+ "en": "Chronological list",
+ "ja": "時系列リスト",
+ "zh-CN": "按时间顺序",
+ "zh-TW": "時間序列清單",
+ "ko-KR": "시간순 목록",
+ "no": "Kronologisk liste",
+ "ar": "قائمة زمنية",
+ "de": "Chronologische Liste",
+ "fr": "Liste chronologique",
+ "it": "Elenco cronologico",
+ "pt": "Lista cronológica",
+ "es": "Lista cronológica",
+ "ca": "Llista cronològica",
+ "tr": "Kronolojik liste",
+ "uk": "Хронологічний список"
+ },
+ "CONVERSATION_PANEL$SORT_BY": {
+ "en": "Sort by",
+ "ja": "並べ替え",
+ "zh-CN": "排序方式",
+ "zh-TW": "排序依據",
+ "ko-KR": "정렬",
+ "no": "Sorter etter",
+ "ar": "فرز حسب",
+ "de": "Sortieren nach",
+ "fr": "Trier par",
+ "it": "Ordina per",
+ "pt": "Ordenar por",
+ "es": "Ordenar por",
+ "ca": "Ordena per",
+ "tr": "Sırala",
+ "uk": "Сортувати за"
+ },
+ "CONVERSATION_PANEL$SORT_CREATED": {
+ "en": "Created",
+ "ja": "作成日",
+ "zh-CN": "创建时间",
+ "zh-TW": "建立時間",
+ "ko-KR": "생성일",
+ "no": "Opprettet",
+ "ar": "تاريخ الإنشاء",
+ "de": "Erstellt",
+ "fr": "Création",
+ "it": "Creato",
+ "pt": "Criado",
+ "es": "Creado",
+ "ca": "Creat",
+ "tr": "Oluşturulma",
+ "uk": "Створено"
+ },
+ "CONVERSATION_PANEL$SORT_UPDATED": {
+ "en": "Updated",
+ "ja": "更新日",
+ "zh-CN": "更新时间",
+ "zh-TW": "更新時間",
+ "ko-KR": "업데이트",
+ "no": "Oppdatert",
+ "ar": "محدّث",
+ "de": "Aktualisiert",
+ "fr": "Mis à jour",
+ "it": "Aggiornato",
+ "pt": "Atualizado",
+ "es": "Actualizado",
+ "ca": "Actualitzat",
+ "tr": "Güncellendi",
+ "uk": "Оновлено"
+ },
+ "CONVERSATION_PANEL$OLDER_SECTION": {
+ "en": "Older conversations",
+ "ja": "以前の会話",
+ "zh-CN": "较早的会话",
+ "zh-TW": "較舊的對話",
+ "ko-KR": "이전 대화",
+ "no": "Eldre samtaler",
+ "ar": "محادثات أقدم",
+ "de": "Ältere Unterhaltungen",
+ "fr": "Anciennes conversations",
+ "it": "Conversazioni più vecchie",
+ "pt": "Conversas mais antigas",
+ "es": "Conversaciones anteriores",
+ "ca": "Converses anteriors",
+ "tr": "Eski sohbetler",
+ "uk": "Старі розмови"
+ },
+ "CONVERSATION_PANEL$OLDER_OVER_ONE_HOUR": {
+ "en": "Over 1 hour",
+ "ja": "1時間以上前",
+ "zh-CN": "超过 1 小时",
+ "zh-TW": "超過 1 小時",
+ "ko-KR": "1시간 이상 지남",
+ "no": "Mer enn 1 time",
+ "ar": "أكثر من ساعة",
+ "de": "Über 1 Stunde",
+ "fr": "Plus d’1 h",
+ "it": "Oltre 1 ora",
+ "pt": "Há mais de 1 hora",
+ "es": "Más de 1 hora",
+ "ca": "Fa més d’1 hora",
+ "tr": "1 saati aşkın",
+ "uk": "Понад 1 годину"
+ },
+ "CONVERSATION_PANEL$SHOW": {
+ "en": "Show",
+ "ja": "表示",
+ "zh-CN": "显示",
+ "zh-TW": "顯示",
+ "ko-KR": "표시",
+ "no": "Vis",
+ "ar": "عرض",
+ "de": "Anzeigen",
+ "fr": "Afficher",
+ "it": "Mostra",
+ "pt": "Mostrar",
+ "es": "Mostrar",
+ "ca": "Mostra",
+ "tr": "Göster",
+ "uk": "Показати"
+ },
+ "CONVERSATION_PANEL$ALL_THREADS": {
+ "en": "All threads",
+ "ja": "すべてのスレッド",
+ "zh-CN": "所有会话",
+ "zh-TW": "所有對話串",
+ "ko-KR": "모든 스레드",
+ "no": "Alle tråder",
+ "ar": "كل المحادثات",
+ "de": "Alle Threads",
+ "fr": "Tous les fils",
+ "it": "Tutti i thread",
+ "pt": "Todas as threads",
+ "es": "Todos los hilos",
+ "ca": "Tots els fils",
+ "tr": "Tüm konular",
+ "uk": "Усі потоки"
+ },
+ "CONVERSATION_PANEL$RELEVANT_THREADS": {
+ "en": "Relevant (active)",
+ "ja": "関連(アクティブ)",
+ "zh-CN": "相关(进行中)",
+ "zh-TW": "相關(進行中)",
+ "ko-KR": "관련(활성)",
+ "no": "Relevante (aktive)",
+ "ar": "ذات صلة (نشطة)",
+ "de": "Relevant (aktiv)",
+ "fr": "Pertinent (actif)",
+ "it": "Rilevanti (attive)",
+ "pt": "Relevantes (ativas)",
+ "es": "Relevantes (activas)",
+ "ca": "Rellevants (actives)",
+ "tr": "İlgili (etkin)",
+ "uk": "Релевантні (активні)"
+ },
+ "CONVERSATION_PANEL$METADATA": {
+ "en": "Metadata",
+ "ja": "メタデータ",
+ "zh-CN": "元数据",
+ "zh-TW": "中繼資料",
+ "ko-KR": "메타데이터",
+ "no": "Metadata",
+ "ar": "البيانات الوصفية",
+ "de": "Metadaten",
+ "fr": "Métadonnées",
+ "it": "Metadati",
+ "pt": "Metadados",
+ "es": "Metadatos",
+ "ca": "Metadades",
+ "tr": "Üst veri",
+ "uk": "Метадані"
+ },
+ "CONVERSATION_PANEL$LLM_MODEL": {
+ "en": "LLM model",
+ "ja": "LLMモデル",
+ "zh-CN": "大语言模型",
+ "zh-TW": "LLM 模型",
+ "ko-KR": "LLM 모델",
+ "no": "LLM-modell",
+ "ar": "نموذج LLM",
+ "de": "LLM-Modell",
+ "fr": "Modèle LLM",
+ "it": "Modello LLM",
+ "pt": "Modelo LLM",
+ "es": "Modelo LLM",
+ "ca": "Model LLM",
+ "tr": "LLM modeli",
+ "uk": "Модель LLM"
+ },
+ "CONVERSATION_PANEL$REPO_BRANCH": {
+ "en": "Repo and branch",
+ "ja": "リポジトリとブランチ",
+ "zh-CN": "仓库与分支",
+ "zh-TW": "存放庫與分支",
+ "ko-KR": "리포지토리와 브랜치",
+ "no": "Repo og gren",
+ "ar": "المستودع والفرع",
+ "de": "Repo und Branch",
+ "fr": "Dépôt et branche",
+ "it": "Repo e branch",
+ "pt": "Repositório e branch",
+ "es": "Repositorio y rama",
+ "ca": "Repo i branca",
+ "tr": "Depo ve dal",
+ "uk": "Репозиторій і гілка"
+ },
+ "CONVERSATION_PANEL$NO_WORKSPACE": {
+ "en": "No workspace",
+ "ja": "ワークスペースなし",
+ "zh-CN": "无工作区",
+ "zh-TW": "無工作區",
+ "ko-KR": "워크스페이스 없음",
+ "no": "Ingen arbeidsområde",
+ "ar": "لا توجد مساحة عمل",
+ "de": "Kein Arbeitsbereich",
+ "fr": "Aucun espace de travail",
+ "it": "Nessuna area di lavoro",
+ "pt": "Sem workspace",
+ "es": "Sin espacio de trabajo",
+ "ca": "Sense espai de treball",
+ "tr": "Çalışma alanı yok",
+ "uk": "Немає робочого простору"
+ },
+ "CONVERSATION_PANEL$NO_REPOSITORY": {
+ "en": "No repository",
+ "ja": "リポジトリなし",
+ "zh-CN": "无仓库",
+ "zh-TW": "無存放庫",
+ "ko-KR": "리포지토리 없음",
+ "no": "Ingen repository",
+ "ar": "لا يوجد مستودع",
+ "de": "Kein Repository",
+ "fr": "Aucun dépôt",
+ "it": "Nessun repository",
+ "pt": "Sem repositório",
+ "es": "Sin repositorio",
+ "ca": "Sense repositori",
+ "tr": "Depo yok",
+ "uk": "Немає репозиторію"
+ },
+ "CONVERSATION_PANEL$NEW_THREAD_FOLDER_ARIA": {
+ "en": "Create thread folder — choose workspace or repository",
+ "ja": "スレッドフォルダを作成 — ワークスペースまたはリポジトリを選択",
+ "zh-CN": "创建对话文件夹 — 选择工作区或仓库",
+ "zh-TW": "建立對話資料夾 — 選擇工作區或存放庫",
+ "ko-KR": "스레드 폴더 만들기 — 워크스페이스 또는 리포지토리 선택",
+ "no": "Opprett trådmappe — velg arbeidsområde eller repository",
+ "ar": "إنشاء مجلد سلاسل — اختر مساحة العمل أو المستودع",
+ "de": "Unterhaltungsordner anlegen — Arbeitsbereich oder Repository wählen",
+ "fr": "Créer un dossier de fils — choisir l’espace de travail ou le dépôt",
+ "it": "Crea cartella thread — scegli workspace o repository",
+ "pt": "Criar pasta de tópicos — escolha workspace ou repositório",
+ "es": "Crear carpeta de hilos — elige espacio de trabajo o repositorio",
+ "ca": "Crea carpeta de fils — tria espai de treball o repositori",
+ "tr": "Konu klasörü oluştur — çalışma alanı veya depo seçin",
+ "uk": "Створити папку тредів — оберіть робочий простір або репозиторій"
+ },
+ "CONVERSATION_PANEL$ADD_CONVERSATION_TO_GROUP": {
+ "en": "Start new conversation in {{label}}",
+ "ja": "{{label}} で新しい会話を開始",
+ "zh-CN": "在 {{label}} 中开始新对话",
+ "zh-TW": "在 {{label}} 中開始新對話",
+ "ko-KR": "{{label}}에서 새 대화 시작",
+ "no": "Start ny samtale i {{label}}",
+ "ar": "بدء محادثة جديدة في {{label}}",
+ "de": "Neue Unterhaltung in {{label}} starten",
+ "fr": "Démarrer une conversation dans {{label}}",
+ "it": "Avvia nuova conversazione in {{label}}",
+ "pt": "Iniciar nova conversa em {{label}}",
+ "es": "Iniciar conversación nueva en {{label}}",
+ "ca": "Inicia una conversa nova a {{label}}",
+ "tr": "{{label}} içinde yeni sohbet başlat",
+ "uk": "Почати нову розмову в {{label}}"
+ },
+ "CONVERSATION$CONFIRM_DELETE_ALL_TITLE": {
+ "en": "Delete all conversations",
+ "ja": "すべての会話を削除",
+ "zh-CN": "删除所有会话",
+ "zh-TW": "刪除所有對話",
+ "ko-KR": "모든 대화 삭제",
+ "no": "Slett alle samtaler",
+ "ar": "حذف جميع المحادثات",
+ "de": "Alle Unterhaltungen löschen",
+ "fr": "Supprimer toutes les conversations",
+ "it": "Elimina tutte le conversazioni",
+ "pt": "Excluir todas as conversas",
+ "es": "Eliminar todas las conversaciones",
+ "ca": "Esborra totes les converses",
+ "tr": "Tüm sohbetleri sil",
+ "uk": "Видалити всі розмови"
+ },
+ "CONVERSATION$CONFIRM_DELETE_ALL_DESC": {
+ "en": "Are you sure you want to delete {{count}} conversations? This action cannot be undone.",
+ "ja": "{{count}} 件の会話を削除してもよろしいですか?この操作は取り消せません。",
+ "zh-CN": "确定要删除 {{count}} 条会话吗?此操作无法撤销。",
+ "zh-TW": "確定要刪除 {{count}} 則對話嗎?此動作無法復原。",
+ "ko-KR": "대화 {{count}}개를 삭제하시겠습니까? 이 작업은 되돌릴 수 없습니다.",
+ "no": "Er du sikker på at du vil slette {{count}} samtaler? Denne handlingen kan ikke angres.",
+ "ar": "هل أنت متأكد من حذف {{count}} محادثة؟ لا يمكن التراجع عن هذا الإجراء.",
+ "de": "Möchten Sie wirklich {{count}} Unterhaltungen löschen? Diese Aktion kann nicht rückgängig gemacht werden.",
+ "fr": "Voulez-vous vraiment supprimer {{count}} conversations ? Cette action est irréversible.",
+ "it": "Sei sicuro di voler eliminare {{count}} conversazioni? Questa azione non può essere annullata.",
+ "pt": "Tem certeza de que deseja excluir {{count}} conversas? Esta ação não pode ser desfeita.",
+ "es": "¿Seguro que quieres eliminar {{count}} conversaciones? Esta acción no se puede deshacer.",
+ "ca": "Segur que voleu esborrar {{count}} converses? Aquesta acció no es pot desfer.",
+ "tr": "{{count}} sohbeti silmek istediğinize emin misiniz? Bu işlem geri alınamaz.",
+ "uk": "Видалити {{count}} розмов? Цю дію не можна скасувати."
},
"CONVERSATION$LOAD_MORE": {
"en": "Load more",
diff --git a/src/stores/conversation-panel-preferences-store.ts b/src/stores/conversation-panel-preferences-store.ts
index c63803a30e..e70f29607b 100644
--- a/src/stores/conversation-panel-preferences-store.ts
+++ b/src/stores/conversation-panel-preferences-store.ts
@@ -1,5 +1,10 @@
import { create } from "zustand";
import { persist, createJSONStorage } from "zustand/middleware";
+import type {
+ ConversationSortField,
+ OrganizeMode,
+ ThreadScope,
+} from "#/components/features/conversation-panel/conversation-panel-list-helpers";
/**
* User-toggleable display preferences for the sidebar conversation list
@@ -17,6 +22,10 @@ import { persist, createJSONStorage } from "zustand/middleware";
interface ConversationPanelPreferencesState {
showOlderConversations: boolean;
showRepoBranchMetadata: boolean;
+ showLlmProfiles: boolean;
+ organizeMode: OrganizeMode;
+ conversationSort: ConversationSortField;
+ threadScope: ThreadScope;
}
interface ConversationPanelPreferencesActions {
@@ -24,6 +33,11 @@ interface ConversationPanelPreferencesActions {
toggleShowOlderConversations: () => void;
setShowRepoBranchMetadata: (value: boolean) => void;
toggleShowRepoBranchMetadata: () => void;
+ setShowLlmProfiles: (value: boolean) => void;
+ toggleShowLlmProfiles: () => void;
+ setOrganizeMode: (value: OrganizeMode) => void;
+ setConversationSort: (value: ConversationSortField) => void;
+ setThreadScope: (value: ThreadScope) => void;
}
type ConversationPanelPreferencesStore = ConversationPanelPreferencesState &
@@ -32,6 +46,10 @@ type ConversationPanelPreferencesStore = ConversationPanelPreferencesState &
const initialState: ConversationPanelPreferencesState = {
showOlderConversations: true,
showRepoBranchMetadata: false,
+ showLlmProfiles: false,
+ organizeMode: "chronological",
+ conversationSort: "updated",
+ threadScope: "all",
};
export const useConversationPanelPreferencesStore =
@@ -53,6 +71,17 @@ export const useConversationPanelPreferencesStore =
set((state) => ({
showRepoBranchMetadata: !state.showRepoBranchMetadata,
})),
+
+ setShowLlmProfiles: (value) => set(() => ({ showLlmProfiles: value })),
+ toggleShowLlmProfiles: () =>
+ set((state) => ({
+ showLlmProfiles: !state.showLlmProfiles,
+ })),
+
+ setOrganizeMode: (value) => set(() => ({ organizeMode: value })),
+ setConversationSort: (value) =>
+ set(() => ({ conversationSort: value })),
+ setThreadScope: (value) => set(() => ({ threadScope: value })),
}),
{
name: "conversation-panel-preferences",
@@ -61,6 +90,10 @@ export const useConversationPanelPreferencesStore =
partialize: (state): ConversationPanelPreferencesState => ({
showOlderConversations: state.showOlderConversations,
showRepoBranchMetadata: state.showRepoBranchMetadata,
+ showLlmProfiles: state.showLlmProfiles,
+ organizeMode: state.organizeMode,
+ conversationSort: state.conversationSort,
+ threadScope: state.threadScope,
}),
},
),
diff --git a/src/tailwind.css b/src/tailwind.css
index bd3b024bdd..df8e162a31 100644
--- a/src/tailwind.css
+++ b/src/tailwind.css
@@ -159,11 +159,34 @@
}
.skeleton {
- @apply bg-gray-400 rounded-md animate-pulse;
+ @apply bg-neutral-700 rounded-md animate-pulse motion-reduce:animate-none;
}
.skeleton-round {
- @apply bg-gray-400 rounded-full animate-pulse;
+ @apply bg-neutral-700 rounded-full animate-pulse motion-reduce:animate-none;
+}
+
+/**
+ * Stagger pulse in a 3-step wave for sibling groups (same rhythm as the
+ * conversation list loading rows).
+ */
+.skeleton-stagger > :nth-child(3n + 1) .skeleton,
+.skeleton-stagger > :nth-child(3n + 1) .skeleton-round,
+.skeleton-stagger > :nth-child(3n + 1).skeleton,
+.skeleton-stagger > :nth-child(3n + 1).skeleton-round {
+ animation-delay: 0ms;
+}
+.skeleton-stagger > :nth-child(3n + 2) .skeleton,
+.skeleton-stagger > :nth-child(3n + 2) .skeleton-round,
+.skeleton-stagger > :nth-child(3n + 2).skeleton,
+.skeleton-stagger > :nth-child(3n + 2).skeleton-round {
+ animation-delay: 180ms;
+}
+.skeleton-stagger > :nth-child(3n + 3) .skeleton,
+.skeleton-stagger > :nth-child(3n + 3) .skeleton-round,
+.skeleton-stagger > :nth-child(3n + 3).skeleton,
+.skeleton-stagger > :nth-child(3n + 3).skeleton-round {
+ animation-delay: 360ms;
}
.heading {
diff --git a/src/ui/context-menu.tsx b/src/ui/context-menu.tsx
index be93c99026..f98e5f6ab3 100644
--- a/src/ui/context-menu.tsx
+++ b/src/ui/context-menu.tsx
@@ -8,6 +8,9 @@ const contextMenuVariants = cva("text-white overflow-hidden z-50", {
default:
"absolute bg-tertiary rounded-[6px] context-menu-box-shadow py-[6px] px-1",
naked: "relative",
+ /** In document-body portal; coordinates come from inline `style`. */
+ popover:
+ "relative bg-tertiary rounded-[6px] context-menu-box-shadow py-[6px] px-1",
},
size: {
compact: "py-1 px-1",
@@ -19,6 +22,7 @@ const contextMenuVariants = cva("text-white overflow-hidden z-50", {
position: {
top: "bottom-full",
bottom: "top-full",
+ none: "",
},
spacing: {
default: "mt-2",
@@ -27,6 +31,7 @@ const contextMenuVariants = cva("text-white overflow-hidden z-50", {
alignment: {
left: "left-0",
right: "right-0",
+ none: "",
},
},
compoundVariants: [
@@ -48,6 +53,7 @@ interface ContextMenuProps {
testId?: string;
children: React.ReactNode;
className?: React.HTMLAttributes<HTMLUListElement>["className"];
+ style?: React.CSSProperties;
theme?: VariantProps<typeof contextMenuVariants>["theme"];
size?: VariantProps<typeof contextMenuVariants>["size"];
layout?: VariantProps<typeof contextMenuVariants>["layout"];
@@ -60,6 +66,7 @@ export function ContextMenu({
testId,
children,
className,
+ style,
ref,
theme,
size,
@@ -73,6 +80,7 @@ export function ContextMenu({
data-testid={testId}
data-position={position}
ref={ref}
+ style={style}
className={cn(
contextMenuVariants({
theme,