🙌 OpenHands: AI-Driven Development
Enhance conversation sidebar with pinned section and grouped organization (#1144)
FraterCCCLXIIIa55a0305ffca
diff --git a/__tests__/components/features/conversation-panel/conversation-card.test.tsx b/__tests__/components/features/conversation-panel/conversation-card.test.tsxindex 0b4c5b663c..69d0e5efd6 100644--- a/__tests__/components/features/conversation-panel/conversation-card.test.tsx+++ b/__tests__/components/features/conversation-panel/conversation-card.test.tsx@@ -39,6 +39,8 @@ vi.mock("react-i18next", async () => {CONVERSATION$UPDATED: "Updated",COMMON$NO_REPOSITORY: "No repository",CONVERSATION$ACP_AGENT_GENERIC: "ACP",+ CONVERSATION_PANEL$PIN_CONVERSATION: "Pin conversation",+ CONVERSATION_PANEL$UNPIN_CONVERSATION: "Unpin conversation",};return translations[key] || key;},@@ -799,4 +801,47 @@ describe("ConversationCard", () => {).not.toBeInTheDocument();});});++ it("calls onTogglePin when the pin button is clicked", async () => {+ const onTogglePin = vi.fn();+ const user = userEvent.setup();++ renderWithProviders(+ <ConversationCard+ title="Conversation 1"+ selectedRepository={null}+ lastUpdatedAt="2021-10-01T12:00:00Z"+ conversationId="conversation-1"+ onDelete={vi.fn()}+ onTogglePin={onTogglePin}+ />,+ );++ const card = screen.getByTestId("conversation-card");+ await user.hover(card);+ await user.click(+ screen.getByTestId("conversation-pin-toggle-conversation-1"),+ );+ expect(onTogglePin).toHaveBeenCalledTimes(1);+ });++ it("keeps the pin icon visible without hover when alwaysShowPinIcon is set", () => {+ renderWithProviders(+ <ConversationCard+ title="Conversation 1"+ selectedRepository={null}+ lastUpdatedAt="2021-10-01T12:00:00Z"+ conversationId="conversation-1"+ onDelete={vi.fn()}+ onTogglePin={vi.fn()}+ isPinned+ alwaysShowPinIcon+ />,+ );++ expect(+ screen.getByTestId("conversation-pin-toggle-conversation-1"),+ ).toBeVisible();+ expect(screen.getByRole("time")).toBeInTheDocument();+ });});diff --git a/__tests__/components/features/conversation-panel/conversation-panel-filter-menu.test.tsx b/__tests__/components/features/conversation-panel/conversation-panel-filter-menu.test.tsxindex ff71dd9523..d2a389b831 100644--- a/__tests__/components/features/conversation-panel/conversation-panel-filter-menu.test.tsx+++ b/__tests__/components/features/conversation-panel/conversation-panel-filter-menu.test.tsx@@ -32,6 +32,8 @@ function renderFilterMenu(toggleShowRepoBranchMetadata: vi.fn(),showLlmProfiles: false,toggleShowLlmProfiles: vi.fn(),+ showHoverMetadata: false,+ toggleShowHoverMetadata: vi.fn(),totalConversationsCount: 5,onRequestDeleteAll: vi.fn(),...overrides,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.tsindex d688fec639..3526f7a08a 100644--- a/__tests__/components/features/conversation-panel/conversation-panel-list-helpers.test.ts+++ b/__tests__/components/features/conversation-panel/conversation-panel-list-helpers.test.ts@@ -1,9 +1,12 @@import { describe, expect, it } from "vitest";import {+ applyGroupFolderOrder,getGroupConversationPreview,groupConversations,GROUP_CONVERSATIONS_PREVIEW_LIMIT,parseConversationTimeMs,+ moveGroupFolderOrder,+ resolvePinnedConversations,sortConversationsByField,} from "#/components/features/conversation-panel/conversation-panel-list-helpers";import type { AppConversation } from "#/api/conversation-service/agent-server-conversation-service.types";@@ -252,6 +255,20 @@ describe("conversation-panel-list-helpers", () => {expect(GROUP_CONVERSATIONS_PREVIEW_LIMIT).toBe(5);});+ it("resolvePinnedConversations preserves pin order and drops missing ids", () => {+ const conversations = [+ { ...base, id: "a", title: "A" },+ { ...base, id: "b", title: "B" },+ { ...base, id: "c", title: "C" },+ ] as AppConversation[];++ expect(+ resolvePinnedConversations(["c", "missing", "a"], conversations).map(+ (conversation) => conversation.id,+ ),+ ).toEqual(["c", "a"]);+ });+it("groups local conversations by selected_workspace, collapsing per-conversation worktree paths", () => {// Two worktree-mode conversations launched against the same workspace must// end up in a single group keyed off the user-selected workspace, not split@@ -365,4 +382,36 @@ describe("conversation-panel-list-helpers", () => {},});});++ it("applies a persisted folder order and moves folders via drag-and-drop", () => {+ const groups = [+ { id: "ws:/workspace/alpha", label: "alpha" },+ { id: "ws:/workspace/beta", label: "beta" },+ { id: "ws:/workspace/gamma", label: "gamma" },+ ];++ expect(+ applyGroupFolderOrder(groups, [+ "ws:/workspace/gamma",+ "ws:/workspace/alpha",+ ]).map((group) => group.id),+ ).toEqual([+ "ws:/workspace/gamma",+ "ws:/workspace/alpha",+ "ws:/workspace/beta",+ ]);++ expect(+ moveGroupFolderOrder(+ ["ws:/workspace/gamma", "ws:/workspace/alpha"],+ groups.map((group) => group.id),+ "ws:/workspace/alpha",+ "ws:/workspace/beta",+ ),+ ).toEqual([+ "ws:/workspace/gamma",+ "ws:/workspace/beta",+ "ws:/workspace/alpha",+ ]);+ });});diff --git a/__tests__/components/features/conversation-panel/conversation-panel.test.tsx b/__tests__/components/features/conversation-panel/conversation-panel.test.tsxindex 283bc5f53b..a7fef6733a 100644--- a/__tests__/components/features/conversation-panel/conversation-panel.test.tsx+++ b/__tests__/components/features/conversation-panel/conversation-panel.test.tsx@@ -1,4 +1,4 @@-import { act, render, screen, waitFor, within } from "@testing-library/react";+import { act, fireEvent, render, screen, waitFor, within } from "@testing-library/react";import { QueryClient, QueryClientProvider } from "@tanstack/react-query";import { I18nextProvider } from "react-i18next";import i18n from "i18next";@@ -18,6 +18,7 @@ import React from "react";import { renderWithProviders } from "test-utils";import { ConversationPanel } from "#/components/features/conversation-panel/conversation-panel";import { useConversationPanelPreferencesStore } from "#/stores/conversation-panel-preferences-store";+import { usePinnedConversationsStore } from "#/stores/pinned-conversations-store";import AgentServerConversationService from "#/api/conversation-service/agent-server-conversation-service.api";import { AppConversation } from "#/api/conversation-service/agent-server-conversation-service.types";import { ExecutionStatus } from "#/types/agent-server/core";@@ -109,6 +110,8 @@ describe("ConversationPanel", () => {beforeEach(() => {vi.clearAllMocks();mockStopConversationMutate.mockClear();+ _mockConversationCounter = 0;+ usePinnedConversationsStore.setState({ pinsByBackendId: {} });// Setup default mock for searchConversationsvi.spyOn(AgentServerConversationService,@@ -1719,4 +1722,182 @@ describe("ConversationPanel", () => {});});});++ it("reorders grouped folders via drag and drop", async () => {+ useConversationPanelPreferencesStore.setState({+ organizeMode: "grouped",+ groupFolderOrder: [],+ });++ vi.spyOn(+ AgentServerConversationService,+ "searchConversations",+ ).mockResolvedValue({+ items: [+ createMockConversation({+ id: "alpha-chat",+ title: "Alpha Chat",+ selected_workspace: "/workspace/alpha",+ }),+ createMockConversation({+ id: "beta-chat",+ title: "Beta Chat",+ selected_workspace: "/workspace/beta",+ }),+ ],+ next_page_id: null,+ });++ renderConversationPanel();++ const alphaFolder = await screen.findByTestId(+ "thread-folder-ws--workspace-alpha",+ );+ const betaFolder = screen.getByTestId("thread-folder-ws--workspace-beta");+ expect(alphaFolder.compareDocumentPosition(betaFolder)).toBe(+ Node.DOCUMENT_POSITION_FOLLOWING,+ );++ const dragHandle = screen.getByTestId(+ "thread-folder-drag-ws--workspace-alpha",+ );+ const dataTransfer = {+ effectAllowed: "move",+ dropEffect: "move",+ data: {} as Record<string, string>,+ setData(format: string, value: string) {+ this.data[format] = value;+ },+ getData(format: string) {+ return this.data[format];+ },+ };+ fireEvent.dragStart(dragHandle, { dataTransfer });+ fireEvent.dragOver(betaFolder, { dataTransfer });+ fireEvent.drop(betaFolder, { dataTransfer });++ const reorderedAlpha = screen.getByTestId(+ "thread-folder-ws--workspace-alpha",+ );+ const reorderedBeta = screen.getByTestId("thread-folder-ws--workspace-beta");+ expect(reorderedBeta.compareDocumentPosition(reorderedAlpha)).toBe(+ Node.DOCUMENT_POSITION_FOLLOWING,+ );+ expect(+ useConversationPanelPreferencesStore.getState().groupFolderOrder,+ ).toEqual(["ws:/workspace/beta", "ws:/workspace/alpha"]);+ });++ it("shows a pinned section above the conversations list when pins exist", async () => {+ usePinnedConversationsStore+ .getState()+ .pinConversation("default-local", "2");++ renderConversationPanel();++ const pinnedSection = await screen.findByTestId(+ "conversation-panel-pinned-section",+ );+ expect(+ within(pinnedSection).getByText("CONVERSATION_PANEL$PINNED"),+ ).toBeInTheDocument();+ expect(+ within(pinnedSection).getAllByTestId("conversation-card"),+ ).toHaveLength(1);+ expect(+ within(pinnedSection).getByTestId("conversation-pin-toggle-2"),+ ).toBeInTheDocument();+ });++ it("renders pinned conversations only in the pinned section in chronological mode", async () => {+ usePinnedConversationsStore+ .getState()+ .pinConversation("default-local", "2");++ renderConversationPanel();++ const pinnedSection = await screen.findByTestId(+ "conversation-panel-pinned-section",+ );+ expect(within(pinnedSection).getAllByTestId("conversation-card")).toHaveLength(+ 1,+ );+ expect(await screen.findAllByTestId("conversation-card")).toHaveLength(3);+ expect(screen.getAllByText("Conversation 2")).toHaveLength(1);+ });++ it("renders pinned conversations only in the pinned section in grouped mode", async () => {+ useConversationPanelPreferencesStore.setState({ organizeMode: "grouped" });+ usePinnedConversationsStore+ .getState()+ .pinConversation("default-local", "2");++ renderConversationPanel();++ const pinnedSection = await screen.findByTestId(+ "conversation-panel-pinned-section",+ );+ expect(within(pinnedSection).getAllByTestId("conversation-card")).toHaveLength(+ 1,+ );+ expect(await screen.findAllByTestId("conversation-card")).toHaveLength(3);+ expect(screen.getAllByText("Conversation 2")).toHaveLength(1);+ });++ it("hides the pinned section after the last pin is removed", async () => {+ usePinnedConversationsStore+ .getState()+ .pinConversation("default-local", "2");++ const user = userEvent.setup();+ renderConversationPanel();++ const pinnedSection = await screen.findByTestId(+ "conversation-panel-pinned-section",+ );+ const pinnedCard = within(pinnedSection).getByTestId("conversation-card");+ await user.hover(pinnedCard);+ await user.click(+ within(pinnedSection).getByTestId("conversation-pin-toggle-2"),+ );++ await waitFor(() => {+ expect(+ screen.queryByTestId("conversation-panel-pinned-section"),+ ).not.toBeInTheDocument();+ });+ });++ it("shows only five pinned conversations before a More control", async () => {+ const manyConversations = Array.from({ length: 6 }, (_, index) =>+ createMockConversation({+ id: String(index + 1),+ title: `Conversation ${index + 1}`,+ }),+ );+ vi.spyOn(+ AgentServerConversationService,+ "searchConversations",+ ).mockResolvedValue({+ items: manyConversations,+ next_page_id: null,+ });+ for (const conversation of manyConversations) {+ usePinnedConversationsStore+ .getState()+ .pinConversation("default-local", conversation.id);+ }++ renderConversationPanel();++ const pinnedSection = await screen.findByTestId(+ "conversation-panel-pinned-section",+ );+ expect(+ within(pinnedSection).getAllByTestId("conversation-card"),+ ).toHaveLength(5);+ expect(+ within(pinnedSection).getByTestId("conversation-panel-pinned-view-more"),+ ).toHaveTextContent("CONVERSATION_PANEL$MORE");+ });});diff --git a/__tests__/stores/conversation-panel-preferences-store.test.ts b/__tests__/stores/conversation-panel-preferences-store.test.tsindex a909f4d607..e33e25bc9a 100644--- a/__tests__/stores/conversation-panel-preferences-store.test.ts+++ b/__tests__/stores/conversation-panel-preferences-store.test.ts@@ -71,7 +71,9 @@ describe("conversation-panel-preferences store", () => {);expect(Object.keys(persisted.state).sort()).toEqual(["conversationSort",+ "groupFolderOrder","organizeMode",+ "showHoverMetadata","showLlmProfiles","showOlderConversations","showRepoBranchMetadata",diff --git a/__tests__/stores/pinned-conversations-store.test.ts b/__tests__/stores/pinned-conversations-store.test.tsnew file mode 100644index 0000000000..d806e0d7a4--- /dev/null+++ b/__tests__/stores/pinned-conversations-store.test.ts@@ -0,0 +1,77 @@+import { beforeEach, describe, expect, it } from "vitest";+import { usePinnedConversationsStore } from "#/stores/pinned-conversations-store";++const STORAGE_KEY = "pinned-conversations";+const BACKEND_ID = "default-local";++describe("pinned-conversations store", () => {+ beforeEach(() => {+ window.localStorage.clear();+ usePinnedConversationsStore.setState({ pinsByBackendId: {} });+ });++ it("pins a conversation at the front of the backend list", () => {+ usePinnedConversationsStore+ .getState()+ .pinConversation(BACKEND_ID, "conversation-a");+ usePinnedConversationsStore+ .getState()+ .pinConversation(BACKEND_ID, "conversation-b");++ expect(+ usePinnedConversationsStore.getState().pinsByBackendId[BACKEND_ID],+ ).toEqual(["conversation-b", "conversation-a"]);+ });++ it("does not duplicate pins for the same conversation", () => {+ usePinnedConversationsStore+ .getState()+ .pinConversation(BACKEND_ID, "conversation-a");+ usePinnedConversationsStore+ .getState()+ .pinConversation(BACKEND_ID, "conversation-a");++ expect(+ usePinnedConversationsStore.getState().pinsByBackendId[BACKEND_ID],+ ).toEqual(["conversation-a"]);+ });++ it("toggles pin state", () => {+ usePinnedConversationsStore+ .getState()+ .togglePin(BACKEND_ID, "conversation-a");+ expect(+ usePinnedConversationsStore.getState().pinsByBackendId[BACKEND_ID],+ ).toEqual(["conversation-a"]);++ usePinnedConversationsStore+ .getState()+ .togglePin(BACKEND_ID, "conversation-a");+ expect(+ usePinnedConversationsStore.getState().pinsByBackendId[BACKEND_ID],+ ).toEqual([]);+ });++ it("prunes missing conversations and persists pin order", () => {+ usePinnedConversationsStore+ .getState()+ .pinConversation(BACKEND_ID, "conversation-a");+ usePinnedConversationsStore+ .getState()+ .pinConversation(BACKEND_ID, "conversation-b");+ usePinnedConversationsStore+ .getState()+ .pruneMissingConversations(BACKEND_ID, ["conversation-b"]);++ expect(+ usePinnedConversationsStore.getState().pinsByBackendId[BACKEND_ID],+ ).toEqual(["conversation-b"]);++ const persisted = JSON.parse(+ window.localStorage.getItem(STORAGE_KEY) ?? "{}",+ );+ expect(persisted.state.pinsByBackendId[BACKEND_ID]).toEqual([+ "conversation-b",+ ]);+ });+});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.tsxindex eb1cf67399..1113367967 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@@ -27,6 +27,7 @@ export function ConversationCardHeader({<ConversationStatusDotexecutionStatus={executionStatus}sandboxStatus={sandboxStatus}+ showTooltip={false}/></div>)}diff --git a/src/components/features/conversation-panel/conversation-card/conversation-card-preview.tsx b/src/components/features/conversation-panel/conversation-card/conversation-card-preview.tsxnew file mode 100644index 0000000000..f033b7923f--- /dev/null+++ b/src/components/features/conversation-panel/conversation-card/conversation-card-preview.tsx@@ -0,0 +1,134 @@+import type { ReactNode } from "react";+import { Folder } from "lucide-react";+import { FaBitbucket, FaGithub, FaGitlab } from "react-icons/fa6";+import { FaCodeBranch } from "react-icons/fa";+import type { IconType } from "react-icons/lib";+import { useTranslation } from "react-i18next";+import { I18nKey } from "#/i18n/declaration";+import type { RepositorySelection } from "#/api/open-hands.types";+import type { Provider } from "#/types/settings";+import type { ExecutionStatus } from "#/types/agent-server/core/base/common";+import type { SandboxStatus } from "#/api/conversation-service/agent-server-conversation-service.types";+import AzureDevOpsLogo from "#/assets/branding/azure-devops-logo.svg?react";+import { ConversationStatusDot } from "../conversation-status-dot";++interface ConversationCardPreviewProps {+ title: string;+ executionStatus?: ExecutionStatus | null;+ sandboxStatus?: SandboxStatus | null;+ selectedRepository: RepositorySelection | null;+ workspaceWorkingDir?: string | null;+ llmModel?: string | null;+ createdAt?: string;+}++const providerIcon: Partial<Record<Provider, IconType>> = {+ bitbucket: FaBitbucket,+ bitbucket_data_center: FaBitbucket,+ github: FaGithub,+ gitlab: FaGitlab,+};++interface PreviewRowProps {+ label: string;+ children: ReactNode;+}++function PreviewRow({ label, children }: PreviewRowProps) {+ return (+ <div className="flex items-start gap-2 text-xs">+ <span className="w-20 shrink-0 text-[var(--oh-muted)]">{label}</span>+ <span className="min-w-0 flex-1 break-words text-[var(--oh-foreground)]">+ {children}+ </span>+ </div>+ );+}++export function ConversationCardPreview({+ title,+ executionStatus,+ sandboxStatus,+ selectedRepository,+ workspaceWorkingDir,+ llmModel,+ createdAt,+}: ConversationCardPreviewProps) {+ const { t } = useTranslation("openhands");++ const repository = selectedRepository?.selected_repository ?? null;+ const branch = selectedRepository?.selected_branch ?? null;+ const provider = selectedRepository?.git_provider ?? null;+ const ProviderIcon = provider ? providerIcon[provider] : null;++ const createdLabel = createdAt+ ? new Date(createdAt).toLocaleString(undefined, {+ dateStyle: "medium",+ timeStyle: "short",+ })+ : null;++ return (+ <div className="flex w-[280px] flex-col gap-3 p-3">+ <div className="flex items-start gap-2">+ {executionStatus !== undefined ? (+ <div className="mt-0.5">+ <ConversationStatusDot+ executionStatus={executionStatus}+ sandboxStatus={sandboxStatus}+ showTooltip={false}+ />+ </div>+ ) : null}+ <span className="break-words text-sm font-medium text-white">+ {title}+ </span>+ </div>++ <dl className="flex flex-col gap-1.5">+ {repository ? (+ <>+ <PreviewRow label={t(I18nKey.CONVERSATION$REPOSITORY)}>+ <span className="inline-flex min-w-0 items-start gap-1.5">+ {ProviderIcon ? (+ <ProviderIcon size={12} className="mt-0.5 shrink-0" />+ ) : null}+ {provider === "azure_devops" ? (+ <AzureDevOpsLogo className="mt-0.5 h-3 w-3 shrink-0" />+ ) : null}+ <span className="break-all">{repository}</span>+ </span>+ </PreviewRow>+ {branch ? (+ <PreviewRow label={t(I18nKey.CONVERSATION$BRANCH)}>+ <span className="inline-flex min-w-0 items-start gap-1.5">+ <FaCodeBranch size={11} className="mt-0.5 shrink-0" />+ <span className="break-all">{branch}</span>+ </span>+ </PreviewRow>+ ) : null}+ </>+ ) : workspaceWorkingDir ? (+ <PreviewRow label={t(I18nKey.CONVERSATION_PANEL$PREVIEW_DIRECTORY)}>+ <span className="inline-flex min-w-0 items-start gap-1.5">+ <Folder size={12} className="mt-0.5 shrink-0" />+ <span className="break-all">{workspaceWorkingDir}</span>+ </span>+ </PreviewRow>+ ) : null}++ {llmModel ? (+ <PreviewRow label={t(I18nKey.CONVERSATION_PANEL$PREVIEW_MODEL)}>+ <span className="break-all">{llmModel}</span>+ </PreviewRow>+ ) : null}++ {createdLabel ? (+ <PreviewRow label={t(I18nKey.CONVERSATION$CREATED)}>+ {createdLabel}+ </PreviewRow>+ ) : null}+ </dl>+ </div>+ );+}diff --git a/src/components/features/conversation-panel/conversation-card/conversation-card-title.tsx b/src/components/features/conversation-panel/conversation-card/conversation-card-title.tsxindex 901c93ab5f..eaa2d8948a 100644--- a/src/components/features/conversation-panel/conversation-card/conversation-card-title.tsx+++ b/src/components/features/conversation-panel/conversation-card/conversation-card-title.tsx@@ -52,7 +52,6 @@ export function ConversationCardTitle({"text-xs leading-6 font-semibold bg-transparent truncate overflow-hidden",isConversationArchived && "opacity-60",)}- title={title}>{title}</p>diff --git a/src/components/features/conversation-panel/conversation-card/conversation-card.tsx b/src/components/features/conversation-panel/conversation-card/conversation-card.tsxindex 3dc84d874a..13499b978f 100644--- a/src/components/features/conversation-panel/conversation-card/conversation-card.tsx+++ b/src/components/features/conversation-panel/conversation-card/conversation-card.tsx@@ -1,6 +1,9 @@import React from "react";+import { Pin } from "lucide-react";+import { useTranslation } from "react-i18next";import { useTracking } from "#/hooks/use-tracking";import { cn } from "#/utils/utils";+import { I18nKey } from "#/i18n/declaration";import { transformVSCodeUrl } from "#/utils/vscode-url-helper";import ConversationService from "#/api/conversation-service/conversation-service.api";import { ExecutionStatus } from "#/types/agent-server/core/base/common";@@ -35,6 +38,10 @@ interface ConversationCardProps {showLlmProfiles?: boolean;agentKind?: "openhands" | "acp" | null;acpServer?: string | null;+ isPinned?: boolean;+ onTogglePin?: () => void;+ /** When true and pinned, keep the pin icon visible without hovering. */+ alwaysShowPinIcon?: boolean;}export function ConversationCard({@@ -59,7 +66,11 @@ export function ConversationCard({showLlmProfiles = false,agentKind = null,acpServer = null,+ isPinned = false,+ onTogglePin,+ alwaysShowPinIcon = false,}: ConversationCardProps) {+ const { t } = useTranslation("openhands");const { trackDownloadVsCodeButtonClicked } = useTracking();const [titleMode, setTitleMode] = React.useState<"view" | "edit">("view");const { mutateAsync: downloadConversation } = useDownloadConversation();@@ -130,7 +141,42 @@ export function ConversationCard({onContextMenuToggle?.(false);};+ const handleTogglePin = (event: React.MouseEvent<HTMLButtonElement>) => {+ event.preventDefault();+ event.stopPropagation();+ onTogglePin?.();+ };++ const renderPinButton = () => (+ <button+ type="button"+ data-testid={+ conversationId+ ? `conversation-pin-toggle-${conversationId}`+ : "conversation-pin-toggle"+ }+ aria-pressed={isPinned}+ aria-label={+ isPinned+ ? t(I18nKey.CONVERSATION_PANEL$UNPIN_CONVERSATION)+ : t(I18nKey.CONVERSATION_PANEL$PIN_CONVERSATION)+ }+ onClick={handleTogglePin}+ className={cn(+ "flex shrink-0 cursor-pointer items-center justify-center rounded-md p-1",+ "text-[var(--oh-muted)] hover:bg-white/10 hover:text-white",+ )}+ >+ <Pin+ className={cn("h-3.5 w-3.5", isPinned && "fill-current")}+ aria-hidden+ />+ </button>+ );+const hasContextMenu = !!(onDelete || onChangeTitle || showOptions);+ const hasHoverActions = hasContextMenu || !!onTogglePin;+ const showPersistentPinIcon = alwaysShowPinIcon && isPinned && !!onTogglePin;const shouldRenderFooter =showRepositoryMetadata ||(showLlmProfiles && (agentKind === "acp" || !!llmModel));@@ -143,8 +189,8 @@ export function ConversationCard({onClick={onClick}className={cn("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)]",+ !contextMenuOpen && "hover:bg-[var(--oh-surface)]",+ (isActive || contextMenuOpen) && "bg-[var(--oh-surface)]",)}><div className="flex items-center w-full min-w-0">@@ -159,12 +205,25 @@ export function ConversationCard({{sandboxStatus === "ERROR" && <ConversationStatusBadges />}</div>- <div className="relative ml-auto pl-2 flex items-center justify-end shrink-0">- {(createdAt ?? lastUpdatedAt) && (+ <div+ className={cn(+ "relative ml-auto pl-2 flex items-center justify-end shrink-0",+ // The hover action overlay (pin + ellipsis) is absolutely+ // positioned, so reserve its width so the flex-1 title truncates+ // instead of colliding with the buttons. Pinned cards keep the pin+ // visible at rest, so reserve the width always for those.+ showPersistentPinIcon+ ? "min-w-[3.75rem]"+ : hasHoverActions &&+ "group-hover:min-w-[3.75rem] group-focus-within:min-w-[3.75rem]",+ contextMenuOpen && "min-w-[3.75rem]",+ )}+ >+ {!showPersistentPinIcon && (createdAt ?? lastUpdatedAt) && (<pclassName={cn("text-xs text-[var(--oh-muted)] text-right whitespace-nowrap transition-opacity -translate-x-1.5",- hasContextMenu &&+ hasHoverActions &&"group-hover:opacity-0 group-focus-within:opacity-0",contextMenuOpen && "opacity-0",)}@@ -173,28 +232,72 @@ export function ConversationCard({</p>)}- {hasContextMenu && (+ {hasHoverActions ? (<divclassName={cn(- "absolute right-0 top-1/2 -translate-y-1/2 transition-opacity",- "opacity-0 invisible group-hover:opacity-100 group-hover:visible",- contextMenuOpen && "visible opacity-100",+ "absolute right-0 top-1/2 flex -translate-y-1/2 items-center gap-0.5 transition-opacity",+ showPersistentPinIcon+ ? "pointer-events-auto visible opacity-100"+ : cn(+ "pointer-events-none opacity-0 invisible",+ "group-hover:pointer-events-auto group-hover:opacity-100 group-hover:visible",+ "group-focus-within:pointer-events-auto group-focus-within:opacity-100 group-focus-within:visible",+ ),+ contextMenuOpen && "pointer-events-auto visible opacity-100",)}>- <ConversationCardActions- contextMenuOpen={contextMenuOpen}- onContextMenuToggle={onContextMenuToggle || (() => {})}- onDelete={onDelete && handleDelete}- onStop={onStop && handleStop}- onEdit={onChangeTitle && handleEdit}- onDownloadViaVSCode={handleDownloadViaVSCode}- onDownloadConversation={handleDownloadConversation}- executionStatus={executionStatus}- conversationId={conversationId}- showOptions={showOptions}- />+ {onTogglePin ? renderPinButton() : null}+ {showPersistentPinIcon &&+ (createdAt ?? lastUpdatedAt) &&+ hasContextMenu ? (+ <div className="relative shrink-0">+ <div+ className={cn(+ !contextMenuOpen &&+ "invisible pointer-events-none group-hover:visible group-hover:pointer-events-auto group-focus-within:visible group-focus-within:pointer-events-auto",+ )}+ >+ <ConversationCardActions+ contextMenuOpen={contextMenuOpen}+ onContextMenuToggle={onContextMenuToggle || (() => {})}+ onDelete={onDelete && handleDelete}+ onStop={onStop && handleStop}+ onEdit={onChangeTitle && handleEdit}+ onDownloadViaVSCode={handleDownloadViaVSCode}+ onDownloadConversation={handleDownloadConversation}+ executionStatus={executionStatus}+ conversationId={conversationId}+ showOptions={showOptions}+ />+ </div>+ <p+ className={cn(+ "pointer-events-none absolute inset-0 flex items-center justify-end",+ "text-xs text-[var(--oh-muted)] whitespace-nowrap -translate-x-1.5",+ "group-hover:hidden group-focus-within:hidden",+ contextMenuOpen && "hidden",+ )}+ >+ <time>{formatTimeDelta(lastUpdatedAt ?? createdAt)}</time>+ </p>+ </div>+ ) : null}+ {!showPersistentPinIcon && hasContextMenu ? (+ <ConversationCardActions+ contextMenuOpen={contextMenuOpen}+ onContextMenuToggle={onContextMenuToggle || (() => {})}+ onDelete={onDelete && handleDelete}+ onStop={onStop && handleStop}+ onEdit={onChangeTitle && handleEdit}+ onDownloadViaVSCode={handleDownloadViaVSCode}+ onDownloadConversation={handleDownloadConversation}+ executionStatus={executionStatus}+ conversationId={conversationId}+ showOptions={showOptions}+ />+ ) : null}</div>- )}+ ) : null}</div></div>diff --git a/src/components/features/conversation-panel/conversation-group-folder-list.tsx b/src/components/features/conversation-panel/conversation-group-folder-list.tsxnew file mode 100644index 0000000000..e71549b4f6--- /dev/null+++ b/src/components/features/conversation-panel/conversation-group-folder-list.tsx@@ -0,0 +1,188 @@+import {+ useCallback,+ useEffect,+ useRef,+ useState,+ type DragEvent,+ type ReactNode,+} from "react";+import { useTranslation } from "react-i18next";+import type { AppConversation } from "#/api/conversation-service/agent-server-conversation-service.types";+import { I18nKey } from "#/i18n/declaration";+import { ConversationGroupFolderRow } from "./conversation-group-folder-row";+import {+ moveGroupFolderOrder,+ type ConversationGroupLaunch,+ type GroupFolderDropPosition,+} from "./conversation-panel-list-helpers";++interface ConversationGroup {+ id: string;+ label: string;+ conversations: AppConversation[];+ launch: ConversationGroupLaunch;+}++interface ConversationGroupFolderListProps {+ groups: ConversationGroup[];+ groupIds: readonly string[];+ groupFolderOrder: readonly string[];+ setGroupFolderOrder: (order: readonly string[]) => void;+ collapsedGroupIds: ReadonlySet<string>;+ expandedGroupPreviewIds: ReadonlySet<string>;+ onToggleGroupCollapsed: (groupId: string) => void;+ onToggleGroupPreviewExpanded: (groupId: string) => void;+ isCreatingConversationFlow: boolean;+ activeConversationId?: string | null;+ onLaunchFromGroup: (launch: ConversationGroupLaunch) => void;+ renderConversationCard: (conversation: AppConversation) => ReactNode;+}++export function ConversationGroupFolderList({+ groups,+ groupIds,+ groupFolderOrder,+ setGroupFolderOrder,+ collapsedGroupIds,+ expandedGroupPreviewIds,+ onToggleGroupCollapsed,+ onToggleGroupPreviewExpanded,+ isCreatingConversationFlow,+ activeConversationId,+ onLaunchFromGroup,+ renderConversationCard,+}: ConversationGroupFolderListProps) {+ const { t } = useTranslation("openhands");+ const [draggedGroupId, setDraggedGroupId] = useState<string | null>(null);+ const [dropTargetGroupId, setDropTargetGroupId] = useState<string | null>(+ null,+ );+ const [dropPosition, setDropPosition] =+ useState<GroupFolderDropPosition | null>(null);+ // Layout animation is only enabled around a drag-and-drop reorder so that+ // expand/collapse clicks don't trigger sibling repositioning animations.+ const [animateLayout, setAnimateLayout] = useState(false);+ const animateLayoutTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(+ null,+ );++ useEffect(+ () => () => {+ if (animateLayoutTimeoutRef.current) {+ clearTimeout(animateLayoutTimeoutRef.current);+ }+ },+ [],+ );++ const stopAnimatingLayoutSoon = useCallback(() => {+ if (animateLayoutTimeoutRef.current) {+ clearTimeout(animateLayoutTimeoutRef.current);+ }+ animateLayoutTimeoutRef.current = setTimeout(() => {+ setAnimateLayout(false);+ animateLayoutTimeoutRef.current = null;+ }, 300);+ }, []);++ const resetDragState = useCallback(() => {+ setDraggedGroupId(null);+ setDropTargetGroupId(null);+ setDropPosition(null);+ }, []);++ const computeDropPosition = useCallback(+ (event: DragEvent<HTMLElement>): GroupFolderDropPosition => {+ const rect = event.currentTarget.getBoundingClientRect();+ return event.clientY < rect.top + rect.height / 2 ? "before" : "after";+ },+ [],+ );++ const handleDrop = useCallback(+ (targetGroupId: string, position: GroupFolderDropPosition) => {+ if (!draggedGroupId || draggedGroupId === targetGroupId) {+ resetDragState();+ stopAnimatingLayoutSoon();+ return;+ }++ setGroupFolderOrder(+ moveGroupFolderOrder(+ groupFolderOrder,+ groupIds,+ draggedGroupId,+ targetGroupId,+ position,+ ),+ );+ resetDragState();+ // Keep layout animation active across the reorder render, then disable+ // it once the spring settles.+ stopAnimatingLayoutSoon();+ },+ [+ draggedGroupId,+ groupFolderOrder,+ groupIds,+ resetDragState,+ setGroupFolderOrder,+ stopAnimatingLayoutSoon,+ ],+ );++ return (+ <nav+ aria-label={t(I18nKey.SIDEBAR$CONVERSATIONS)}+ className="space-y-1 md:space-y-0.5 pb-1"+ >+ {groups.map((group) => (+ <ConversationGroupFolderRow+ key={group.id}+ group={group}+ expanded={!collapsedGroupIds.has(group.id)}+ previewExpanded={expandedGroupPreviewIds.has(group.id)}+ isDragging={draggedGroupId === group.id}+ dropIndicatorPosition={+ dropTargetGroupId === group.id && draggedGroupId !== group.id+ ? dropPosition+ : null+ }+ animateLayout={animateLayout}+ isCreatingConversationFlow={isCreatingConversationFlow}+ activeConversationId={activeConversationId}+ onToggleExpanded={() => onToggleGroupCollapsed(group.id)}+ onDragStart={() => {+ setAnimateLayout(true);+ setDraggedGroupId(group.id);+ }}+ onDragEnd={() => {+ resetDragState();+ stopAnimatingLayoutSoon();+ }}+ onDragOver={(event) => {+ event.preventDefault();+ const { dataTransfer } = event;+ if (dataTransfer) {+ dataTransfer.dropEffect = "move";+ }+ setDropTargetGroupId(group.id);+ setDropPosition(computeDropPosition(event));+ }}+ onDragLeave={() => {+ setDropTargetGroupId((current) =>+ current === group.id ? null : current,+ );+ }}+ onDrop={(event) => {+ event.preventDefault();+ handleDrop(group.id, computeDropPosition(event));+ }}+ onTogglePreviewExpanded={() => onToggleGroupPreviewExpanded(group.id)}+ onLaunchFromGroup={() => onLaunchFromGroup(group.launch)}+ renderConversationCard={renderConversationCard}+ />+ ))}+ </nav>+ );+}diff --git a/src/components/features/conversation-panel/conversation-group-folder-row.tsx b/src/components/features/conversation-panel/conversation-group-folder-row.tsxnew file mode 100644index 0000000000..edff1e42bf--- /dev/null+++ b/src/components/features/conversation-panel/conversation-group-folder-row.tsx@@ -0,0 +1,239 @@+import { motion } from "framer-motion";+import { Folder, FolderOpen, Plus } from "lucide-react";+import { useRef, type DragEvent, type ReactNode } from "react";+import { useTranslation } from "react-i18next";+import type { AppConversation } from "#/api/conversation-service/agent-server-conversation-service.types";+import { I18nKey } from "#/i18n/declaration";+import { cn } from "#/utils/utils";+import type {+ ConversationGroupLaunch,+ GroupFolderDropPosition,+} from "./conversation-panel-list-helpers";+import { getGroupConversationPreview } from "./conversation-panel-list-helpers";++interface ConversationGroup {+ id: string;+ label: string;+ conversations: AppConversation[];+ launch: ConversationGroupLaunch;+}++interface ConversationGroupFolderRowProps {+ group: ConversationGroup;+ expanded: boolean;+ previewExpanded: boolean;+ isDragging: boolean;+ dropIndicatorPosition: GroupFolderDropPosition | null;+ animateLayout: boolean;+ isCreatingConversationFlow: boolean;+ activeConversationId?: string | null;+ onToggleExpanded: () => void;+ onDragStart: () => void;+ onDragEnd: () => void;+ onDragOver: (event: DragEvent<HTMLElement>) => void;+ onDragLeave: () => void;+ onDrop: (event: DragEvent<HTMLElement>) => void;+ onTogglePreviewExpanded: () => void;+ onLaunchFromGroup: () => void;+ renderConversationCard: (conversation: AppConversation) => ReactNode;+}++export function ConversationGroupFolderRow({+ group,+ expanded,+ previewExpanded,+ isDragging,+ dropIndicatorPosition,+ animateLayout,+ isCreatingConversationFlow,+ activeConversationId,+ onToggleExpanded,+ onDragStart,+ onDragEnd,+ onDragOver,+ onDragLeave,+ onDrop,+ onTogglePreviewExpanded,+ onLaunchFromGroup,+ renderConversationCard,+}: ConversationGroupFolderRowProps) {+ const { t } = useTranslation("openhands");+ const sectionRef = useRef<HTMLElement>(null);+ const headingId = `thread-folder-${group.id.replace(/[^a-zA-Z0-9_-]/g, "-")}`;+ const groupTestIdSuffix = group.id.replace(/[^a-zA-Z0-9_-]/g, "-");+ const { visibleConversations, isPreviewTruncated, isShowingAll } =+ getGroupConversationPreview(group.conversations, {+ expanded: previewExpanded,+ activeConversationId,+ });++ return (+ <motion.section+ ref={sectionRef}+ layout={animateLayout ? "position" : false}+ transition={{ type: "spring", stiffness: 600, damping: 45 }}+ aria-labelledby={headingId}+ data-testid={`thread-folder-${groupTestIdSuffix}`}+ onDragOver={onDragOver}+ onDragLeave={onDragLeave}+ onDrop={onDrop}+ className="relative rounded-md"+ >+ {dropIndicatorPosition ? (+ <div+ aria-hidden+ data-testid={`thread-folder-drop-indicator-${groupTestIdSuffix}`}+ className={cn(+ "pointer-events-none absolute inset-x-0 z-10 h-0.5 rounded-full bg-[var(--oh-accent)]",+ dropIndicatorPosition === "before" ? "-top-0.5" : "-bottom-0.5",+ )}+ />+ ) : null}+ {/* Keep the row's footprint (height) while dragging but hide its+ content so the original slot reads as an empty placeholder. Use+ opacity (not visibility/display) because hiding the drag source+ synchronously during dragstart cancels the native drag in Chrome. */}+ <div className={cn(isDragging && "opacity-0")}>+ <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-normal",+ "text-[var(--oh-muted)] transition-colors hover:bg-[var(--oh-surface-raised)] hover:text-white",+ )}+ >+ <button+ type="button"+ draggable+ id={headingId}+ aria-expanded={expanded}+ aria-controls={`thread-folder-content-${groupTestIdSuffix}`}+ data-testid={`thread-folder-drag-${groupTestIdSuffix}`}+ aria-label={+ expanded+ ? t(I18nKey.CONVERSATION_PANEL$COLLAPSE_FOLDER, {+ label: group.label,+ })+ : t(I18nKey.CONVERSATION_PANEL$EXPAND_FOLDER, {+ label: group.label,+ })+ }+ onClick={onToggleExpanded}+ onDragStart={(event) => {+ event.stopPropagation();+ const { dataTransfer } = event;+ if (dataTransfer) {+ dataTransfer.effectAllowed = "move";+ dataTransfer.setData("text/plain", group.id);+ const node = sectionRef.current;+ if (node && typeof dataTransfer.setDragImage === "function") {+ const rect = node.getBoundingClientRect();+ // Render the floating preview from an off-screen clone so we+ // can give it a rounded, surfaced background without altering+ // the in-list row, and anchor it to the exact grab point.+ const dragImage = node.cloneNode(true) as HTMLElement;+ dragImage.style.position = "fixed";+ dragImage.style.top = "0";+ dragImage.style.left = "-9999px";+ dragImage.style.width = `${rect.width}px`;+ dragImage.style.margin = "0";+ dragImage.style.pointerEvents = "none";+ dragImage.style.borderRadius = "0.5rem";+ dragImage.style.padding = "0.25rem";+ dragImage.style.backgroundColor = "var(--oh-surface-raised)";+ dragImage.style.boxShadow = "0 8px 24px rgba(0, 0, 0, 0.35)";+ document.body.appendChild(dragImage);+ dataTransfer.setDragImage(+ dragImage,+ event.clientX - rect.left,+ event.clientY - rect.top,+ );+ // Remove after the browser has rasterized the drag image.+ window.setTimeout(() => dragImage.remove(), 0);+ }+ }+ onDragStart();+ }}+ onDragEnd={(event) => {+ event.stopPropagation();+ onDragEnd();+ }}+ className={cn(+ "group/folder flex min-h-8 min-w-0 flex-1 cursor-grab items-center gap-2 rounded-md py-1 text-left text-inherit outline-none active:cursor-grabbing",+ "focus-visible:ring-1 focus-visible:ring-[var(--oh-border)]",+ )}+ >+ <Folder+ className={cn(+ "h-4 w-4 shrink-0",+ expanded+ ? "hidden group-hover/folder:block"+ : "block group-hover/folder:hidden",+ )}+ aria-hidden+ />+ <FolderOpen+ className={cn(+ "h-4 w-4 shrink-0",+ expanded+ ? "block group-hover/folder:hidden"+ : "hidden group-hover/folder:block",+ )}+ 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-${groupTestIdSuffix}`}+ onClick={(event) => {+ event.preventDefault();+ event.stopPropagation();+ onLaunchFromGroup();+ }}+ >+ <Plus+ className="h-3.5 w-3.5 shrink-0"+ aria-hidden+ strokeWidth={2}+ />+ </button>+ </div>+ {expanded ? (+ <div+ id={`thread-folder-content-${groupTestIdSuffix}`}+ className="mt-0.5 space-y-0.5"+ >+ {visibleConversations.map(renderConversationCard)}+ {isPreviewTruncated ? (+ <div className="pl-2">+ <button+ type="button"+ data-testid={`thread-folder-view-more-${groupTestIdSuffix}`}+ onClick={onTogglePreviewExpanded}+ className="cursor-pointer text-xs text-[var(--oh-text-dim)] hover:text-white"+ >+ {isShowingAll+ ? t(I18nKey.CONVERSATION_PANEL$LESS)+ : t(I18nKey.CONVERSATION_PANEL$MORE)}+ </button>+ </div>+ ) : null}+ </div>+ ) : null}+ </div>+ </motion.section>+ );+}diff --git a/src/components/features/conversation-panel/conversation-panel-filter-menu.tsx b/src/components/features/conversation-panel/conversation-panel-filter-menu.tsxindex 7d45a89789..208a137179 100644--- a/src/components/features/conversation-panel/conversation-panel-filter-menu.tsx+++ b/src/components/features/conversation-panel/conversation-panel-filter-menu.tsx@@ -11,6 +11,7 @@ import {GitBranch,ListFilter,MessageCircle,+ MousePointerClick,Star,Trash2,} from "lucide-react";@@ -51,6 +52,8 @@ export interface ConversationPanelFilterMenuProps {toggleShowRepoBranchMetadata: () => void;showLlmProfiles: boolean;toggleShowLlmProfiles: () => void;+ showHoverMetadata: boolean;+ toggleShowHoverMetadata: () => void;totalConversationsCount: number;onRequestDeleteAll: () => void;}@@ -72,6 +75,8 @@ export function ConversationPanelFilterMenu({toggleShowRepoBranchMetadata,showLlmProfiles,toggleShowLlmProfiles,+ showHoverMetadata,+ toggleShowHoverMetadata,totalConversationsCount,onRequestDeleteAll,}: ConversationPanelFilterMenuProps) {@@ -261,6 +266,16 @@ export function ConversationPanelFilterMenu({setFilterMenuOpen(false);}}/>+ <MenuRow+ icon={MousePointerClick}+ label={t(I18nKey.CONVERSATION_PANEL$HOVER_METADATA)}+ selected={showHoverMetadata}+ testId="toggle-hover-metadata"+ onClick={() => {+ toggleShowHoverMetadata();+ setFilterMenuOpen(false);+ }}+ /><MenuSeparator /><MenuHeadingdiff --git a/src/components/features/conversation-panel/conversation-panel-list-helpers.ts b/src/components/features/conversation-panel/conversation-panel-list-helpers.tsindex 7420c7e8a6..ef82893efd 100644--- a/src/components/features/conversation-panel/conversation-panel-list-helpers.ts+++ b/src/components/features/conversation-panel/conversation-panel-list-helpers.ts@@ -57,6 +57,34 @@ export function getGroupConversationPreview(};}+export function resolvePinnedConversations(+ pinnedIds: readonly string[],+ conversations: readonly AppConversation[],+): AppConversation[] {+ const byId = new Map(+ conversations.map((conversation) => [conversation.id, conversation]),+ );+ return pinnedIds+ .map((id) => byId.get(id))+ .filter(+ (conversation): conversation is AppConversation => conversation != null,+ );+}++export function filterOutPinnedConversations(+ conversations: readonly AppConversation[],+ pinnedIds: readonly string[],+): AppConversation[] {+ if (pinnedIds.length === 0) {+ return [...conversations];+ }++ const pinnedSet = new Set(pinnedIds);+ return conversations.filter(+ (conversation) => !pinnedSet.has(conversation.id),+ );+}+/** Subset of `useCreateConversation` variables for launching from a group row */export type ConversationGroupLaunch = {workingDir?: string;@@ -222,3 +250,64 @@ export function groupConversations(groups.sort((a, b) => groupOrderKey(b) - groupOrderKey(a));return groups;}++export function applyGroupFolderOrder<T extends { id: string }>(+ groups: readonly T[],+ order: readonly string[],+): T[] {+ if (order.length === 0) {+ return [...groups];+ }++ const byId = new Map(groups.map((group) => [group.id, group]));+ const ordered: T[] = [];+ const seen = new Set<string>();++ for (const id of order) {+ const group = byId.get(id);+ if (group) {+ ordered.push(group);+ seen.add(id);+ }+ }++ for (const group of groups) {+ if (!seen.has(group.id)) {+ ordered.push(group);+ }+ }++ return ordered;+}++export type GroupFolderDropPosition = "before" | "after";++export function moveGroupFolderOrder(+ order: readonly string[],+ groupIds: readonly string[],+ activeGroupId: string,+ targetGroupId: string,+ position: GroupFolderDropPosition = "after",+): string[] {+ if (activeGroupId === targetGroupId) {+ return [...order];+ }++ const effectiveOrder = applyGroupFolderOrder(+ groupIds.map((id) => ({ id })),+ order,+ ).map((group) => group.id);+ const fromIndex = effectiveOrder.indexOf(activeGroupId);+ const toIndex = effectiveOrder.indexOf(targetGroupId);+ if (fromIndex < 0 || toIndex < 0) {+ return [...order];+ }++ const nextOrder = [...effectiveOrder];+ nextOrder.splice(fromIndex, 1);+ const adjustedTargetIndex = nextOrder.indexOf(targetGroupId);+ const insertIndex =+ position === "before" ? adjustedTargetIndex : adjustedTargetIndex + 1;+ nextOrder.splice(insertIndex, 0, activeGroupId);+ return nextOrder;+}diff --git a/src/components/features/conversation-panel/conversation-panel-pinned-section.tsx b/src/components/features/conversation-panel/conversation-panel-pinned-section.tsxnew file mode 100644index 0000000000..fac8302693--- /dev/null+++ b/src/components/features/conversation-panel/conversation-panel-pinned-section.tsx@@ -0,0 +1,71 @@+import React from "react";+import { Pin } from "lucide-react";+import { useTranslation } from "react-i18next";+import { I18nKey } from "#/i18n/declaration";+import type { AppConversation } from "#/api/conversation-service/agent-server-conversation-service.types";+import { cn } from "#/utils/utils";+import {+ getGroupConversationPreview,+ GROUP_CONVERSATIONS_PREVIEW_LIMIT,+} from "./conversation-panel-list-helpers";++interface ConversationPanelPinnedSectionProps {+ pinnedConversations: readonly AppConversation[];+ isPreviewExpanded: boolean;+ onTogglePreviewExpanded: () => void;+ activeConversationId: string | null;+ showDivider?: boolean;+ renderConversationCard: (conversation: AppConversation) => React.ReactNode;+}++export function ConversationPanelPinnedSection({+ pinnedConversations,+ isPreviewExpanded,+ onTogglePreviewExpanded,+ activeConversationId,+ showDivider = false,+ renderConversationCard,+}: ConversationPanelPinnedSectionProps) {+ const { t } = useTranslation("openhands");++ const { visibleConversations, isPreviewTruncated, isShowingAll } =+ getGroupConversationPreview(pinnedConversations, {+ limit: GROUP_CONVERSATIONS_PREVIEW_LIMIT,+ expanded: isPreviewExpanded,+ activeConversationId,+ });++ return (+ <section+ data-testid="conversation-panel-pinned-section"+ className={cn(+ "pt-1",+ showDivider+ ? "mb-2 border-b border-[var(--oh-border-subtle)] pb-2"+ : "pb-2",+ )}+ >+ <h3 className="flex items-center gap-1.5 py-1.5 pl-2 text-sm font-normal text-[var(--oh-muted)]">+ <Pin className="h-3.5 w-3.5 shrink-0" aria-hidden />+ {t(I18nKey.CONVERSATION_PANEL$PINNED)}+ </h3>+ <div className="space-y-0.5">+ {visibleConversations.map(renderConversationCard)}+ </div>+ {isPreviewTruncated ? (+ <div className="pl-2 pt-0.5">+ <button+ type="button"+ data-testid="conversation-panel-pinned-view-more"+ onClick={onTogglePreviewExpanded}+ className="cursor-pointer text-xs text-[var(--oh-text-dim)] hover:text-white"+ >+ {isShowingAll+ ? t(I18nKey.CONVERSATION_PANEL$LESS)+ : t(I18nKey.CONVERSATION_PANEL$MORE)}+ </button>+ </div>+ ) : null}+ </section>+ );+}diff --git a/src/components/features/conversation-panel/conversation-panel.tsx b/src/components/features/conversation-panel/conversation-panel.tsxindex 38d5c3dbd6..a2b407f1e3 100644--- a/src/components/features/conversation-panel/conversation-panel.tsx+++ b/src/components/features/conversation-panel/conversation-panel.tsx@@ -1,6 +1,6 @@import React from "react";+import { Tooltip } from "@heroui/react";import { useTranslation } from "react-i18next";-import { Folder, Plus } from "lucide-react";import { I18nKey } from "#/i18n/declaration";import { useNavigation } from "#/context/navigation-context";import { useActiveBackend } from "#/contexts/active-backend-context";@@ -10,7 +10,6 @@ import { useDeleteConversation } from "#/hooks/mutation/use-delete-conversation"import { useUnifiedPauseConversation } from "#/hooks/mutation/use-unified-stop-conversation";import { ConfirmDeleteModal } from "./confirm-delete-modal";import { ConfirmStopModal } from "./confirm-stop-modal";-import { LoadingSpinner } from "#/components/shared/loading-spinner";import { NavigationLink } from "#/components/shared/navigation-link";import { ExitConversationModal } from "./exit-conversation-modal";import { useClickOutsideElement } from "#/hooks/use-click-outside-element";@@ -24,6 +23,7 @@ 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 { ConversationCardPreview } from "./conversation-card/conversation-card-preview";import { StartTaskCard } from "./start-task-card/start-task-card";import { ConversationCardSkeleton } from "./conversation-card/conversation-card-skeleton";import { CompactConversationRow } from "./compact-conversation-row";@@ -31,12 +31,17 @@ import { useConversationPanelPreferencesStore } from "#/stores/conversation-paneimport { cn } from "#/utils/utils";import { ConversationPanelFilterMenu } from "./conversation-panel-filter-menu";import { ConversationPanelNewThreadPicker } from "./conversation-panel-new-thread-picker";+import { ConversationGroupFolderList } from "./conversation-group-folder-list";+import { ConversationPanelPinnedSection } from "./conversation-panel-pinned-section";import {+ applyGroupFolderOrder,+ filterOutPinnedConversations,groupConversations,- getGroupConversationPreview,+ resolvePinnedConversations,sortConversationsByField,type ConversationGroupLaunch,} from "./conversation-panel-list-helpers";+import { usePinnedConversationsStore } from "#/stores/pinned-conversations-store";interface ConversationPanelProps {onClose?: () => void;@@ -50,6 +55,8 @@ interface ConversationPanelProps {const noop = () => {};+const EMPTY_PINNED_CONVERSATION_IDS: readonly string[] = [];+const ONE_HOUR_MS = 60 * 60 * 1000;const partitionByCutoff = <T extends { updated_at: string }>(@@ -115,6 +122,12 @@ export function ConversationPanel({const toggleShowLlmProfiles = useConversationPanelPreferencesStore((state) => state.toggleShowLlmProfiles,);+ const showHoverMetadata = useConversationPanelPreferencesStore(+ (state) => state.showHoverMetadata,+ );+ const toggleShowHoverMetadata = useConversationPanelPreferencesStore(+ (state) => state.toggleShowHoverMetadata,+ );const organizeMode = useConversationPanelPreferencesStore((state) => state.organizeMode,);@@ -133,6 +146,12 @@ export function ConversationPanel({const setThreadScope = useConversationPanelPreferencesStore((state) => state.setThreadScope,);+ const groupFolderOrder = useConversationPanelPreferencesStore(+ (state) => state.groupFolderOrder,+ );+ const setGroupFolderOrder = useConversationPanelPreferencesStore(+ (state) => state.setGroupFolderOrder,+ );const [filterMenuOpen, setFilterMenuOpen] = React.useState(false);const [isListScrolled, setIsListScrolled] = React.useState(false);const filterMenuRef = useClickOutsideElement<HTMLDivElement>(() => {@@ -144,6 +163,17 @@ export function ConversationPanel({const [expandedGroupPreviewIds, setExpandedGroupPreviewIds] = React.useState<ReadonlySet<string>>(() => new Set());+ const [expandedPinnedPreview, setExpandedPinnedPreview] =+ React.useState(false);++ const pinnedIds = usePinnedConversationsStore(+ (state) =>+ state.pinsByBackendId[activeBackend.id] ?? EMPTY_PINNED_CONVERSATION_IDS,+ );+ const togglePin = usePinnedConversationsStore((state) => state.togglePin);+ const pruneMissingPinnedConversations = usePinnedConversationsStore(+ (state) => state.pruneMissingConversations,+ );const toggleGroupCollapsed = React.useCallback((groupId: string) => {setCollapsedGroupIds((prev) => {@@ -192,6 +222,7 @@ export function ConversationPanel({isLoading,isFetched,hasNextPage,+ isFetching,isFetchingNextPage,fetchNextPage,} = usePaginatedConversations();@@ -199,17 +230,63 @@ export function ConversationPanel({// Fetch in-progress start tasksconst { data: startTasks } = useStartTasks();- const conversations = React.useMemo(- () => data?.pages.flatMap((page) => page.items) ?? [],- [data],+ const conversations = React.useMemo(() => {+ const all = data?.pages.flatMap((page) => page.items) ?? [];+ // The 10s background refetch re-fetches every loaded page with the+ // `UPDATED_AT_DESC` cursor. If a conversation's `updated_at` shifts between+ // page fetches, a later page can overlap an earlier one and surface the+ // same conversation twice. Dedupe by id (keeping the first/freshest copy)+ // so the rendered count reflects real growth and React keys stay unique.+ const seen = new Set<string>();+ return all.filter((conversation) => {+ if (seen.has(conversation.id)) {+ return false;+ }+ seen.add(conversation.id);+ return true;+ });+ }, [data]);++ const pinnedConversations = React.useMemo(+ () => resolvePinnedConversations(pinnedIds, conversations),+ [conversations, pinnedIds],);+ React.useEffect(() => {+ if (!isFetched) {+ return;+ }+ pruneMissingPinnedConversations(+ activeBackend.id,+ conversations.map((conversation) => conversation.id),+ );+ }, [+ activeBackend.id,+ conversations,+ isFetched,+ pruneMissingPinnedConversations,+ ]);++ React.useEffect(() => {+ if (pinnedIds.length === 0) {+ setExpandedPinnedPreview(false);+ }+ }, [pinnedIds.length]);+const scopedConversations = React.useMemo(() => {- if (threadScope === "relevant") {- return conversations.filter((c) => isExecutionActive(c.execution_status));+ const scopeFiltered =+ threadScope === "relevant"+ ? conversations.filter((c) => isExecutionActive(c.execution_status))+ : conversations;++ // In the expanded panel, pinned conversations should only appear inside+ // the dedicated pinned section (not duplicated in grouped/flat lists).+ if (compact) {+ return scopeFiltered;}- return conversations;- }, [conversations, threadScope]);++ return filterOutPinnedConversations(scopeFiltered, pinnedIds);+ }, [compact, conversations, pinnedIds, threadScope]);const { recent: recentScoped, older: olderScoped } = React.useMemo(() => partitionByCutoff(scopedConversations),@@ -265,6 +342,18 @@ export function ConversationPanel({showOlderConversations,]);+ const orderedConversationGroups = React.useMemo(() => {+ if (!conversationGroups) {+ return null;+ }+ return applyGroupFolderOrder(conversationGroups, groupFolderOrder);+ }, [conversationGroups, groupFolderOrder]);++ const conversationGroupIds = React.useMemo(+ () => conversationGroups?.map((group) => group.id) ?? [],+ [conversationGroups],+ );+const compactVisibleConversations = React.useMemo(() =>sortConversationsByField(@@ -279,17 +368,87 @@ export function ConversationPanel({const visibleFlatCount = sortedVisibleConversations.length;const visibleGroupedCount = React.useMemo(() => {- if (!conversationGroups) {+ if (!orderedConversationGroups) {return 0;}- return conversationGroups.reduce((n, g) => n + g.conversations.length, 0);- }, [conversationGroups]);+ return orderedConversationGroups.reduce(+ (n, g) => n + g.conversations.length,+ 0,+ );+ }, [orderedConversationGroups]);const listIsEffectivelyEmpty =organizeMode === "grouped" && !compact? visibleGroupedCount === 0: visibleFlatCount === 0;+ // Number of conversations actually rendered in the list right now, in the+ // current organize mode. "Load more" succeeds only when this number grows.+ const visibleCount =+ organizeMode === "grouped" && !compact+ ? visibleGroupedCount+ : visibleFlatCount;++ // KNOWN ISSUE (unresolved as of 2026-05-29): users still report that the+ // sidebar "Load more" sometimes requires two clicks before new conversations+ // appear. The mitigation below (dedupe by id in `conversations`, plus the+ // floor-tracking driver that keeps fetching until the visible count grows)+ // reduced but did NOT fully eliminate the symptom in manual testing. Likely+ // remaining suspects to investigate next: the agent-server cursor pagination+ // returning an overlapping/short page under `UPDATED_AT_DESC` while the 10s+ // `refetchInterval` reorders pages (see `usePaginatedConversations`), or a+ // React Query state lag where `hasNextPage`/`isFetching` settle a render+ // after the click. If you pick this up, reproduce against a backend with+ // >40 conversations and watch the `/api/conversations/search` cursors.+ //+ // Robust "Load more" driver. A single click can fail to surface new rows for+ // two reasons: (1) `fetchNextPage()` is silently dropped while the 10s+ // background refetch is in flight, and (2) a fetched page can yield zero+ // *visible* rows (filtered out by the active scope, or deduped as overlap),+ // so the list does not appear to grow. We capture the visible count at click+ // time and keep fetching pages — once the query is idle — until the visible+ // count actually increases or there are no more pages.+ const [loadMoreFloor, setLoadMoreFloor] = React.useState<number | null>(null);+ const visibleCountRef = React.useRef(visibleCount);+ visibleCountRef.current = visibleCount;++ const requestLoadMore = React.useCallback(() => {+ if (hasNextPage) {+ setLoadMoreFloor(visibleCountRef.current);+ }+ }, [hasNextPage]);++ React.useEffect(() => {+ if (loadMoreFloor === null) {+ return;+ }+ // Goal met: the visible list grew past where it was when the user clicked.+ if (visibleCount > loadMoreFloor) {+ setLoadMoreFloor(null);+ return;+ }+ // Nothing more to fetch — stop waiting even if the list did not grow.+ if (!hasNextPage) {+ setLoadMoreFloor(null);+ return;+ }+ // Wait for any in-flight fetch (including the background refetch) to settle+ // before requesting the next page, otherwise the request is dropped.+ if (isFetching || isFetchingNextPage) {+ return;+ }+ fetchNextPage();+ }, [+ loadMoreFloor,+ visibleCount,+ hasNextPage,+ isFetching,+ isFetchingNextPage,+ fetchNextPage,+ ]);++ const isLoadingMore = loadMoreFloor !== null || isFetchingNextPage;+const { mutate: deleteConversation, mutateAsync: deleteConversationAsync } =useDeleteConversation();const { mutate: pauseConversation } = useUnifiedPauseConversation();@@ -407,7 +566,11 @@ export function ConversationPanel({};const renderConversationCard = React.useCallback(- (conversation: (typeof conversations)[number]) => {+ (+ conversation: (typeof conversations)[number],+ options?: { inPinnedSection?: boolean },+ ) => {+ const isPinned = pinnedIds.includes(conversation.id);if (compact) {return (<CompactConversationRow@@ -438,50 +601,90 @@ export function ConversationPanel({);}return (- <NavigationLink+ <Tooltipkey={conversation.id}- to={`/conversations/${conversation.id}`}- onClick={onClose}- className="block"+ placement="right-start"+ delay={1000}+ closeDelay={100}+ isDisabled={+ !showHoverMetadata || openContextMenuId === conversation.id+ }+ disableAnimation={import.meta.env.MODE === "test"}+ className="rounded-xl border border-[var(--oh-border)] bg-base-secondary p-0 text-white shadow-xl"+ content={+ <ConversationCardPreview+ title={conversation.title ?? ""}+ executionStatus={conversation.execution_status}+ sandboxStatus={conversation.sandbox_status}+ selectedRepository={{+ selected_repository: conversation.selected_repository,+ selected_branch: conversation.selected_branch,+ git_provider: conversation.git_provider as Provider,+ }}+ workspaceWorkingDir={+ conversation.selected_workspace ??+ conversation.workspace?.working_dir+ }+ llmModel={conversation.llm_model}+ createdAt={conversation.created_at}+ />+ }>- <ConversationCard- onDelete={() =>- handleDeleteProject(conversation.id, conversation.title ?? "")- }- onStop={() => handleStopConversation(conversation.id)}- onChangeTitle={(title) =>- handleConversationTitleChange(conversation.id, title)- }- title={conversation.title ?? ""}- selectedRepository={{- selected_repository: conversation.selected_repository,- selected_branch: conversation.selected_branch,- git_provider: conversation.git_provider as Provider,- }}- lastUpdatedAt={conversation.updated_at}- createdAt={conversation.created_at}- executionStatus={conversation.execution_status}- sandboxStatus={conversation.sandbox_status}- conversationId={conversation.id}- contextMenuOpen={openContextMenuId === conversation.id}- onContextMenuToggle={(isOpen) =>- setOpenContextMenuId(isOpen ? conversation.id : null)- }- isActive={conversation.id === currentConversationId}- workspaceWorkingDir={- conversation.selected_workspace ??- conversation.workspace?.working_dir- }- showRepositoryMetadata={showRepoBranchMetadata}- llmModel={conversation.llm_model}- showLlmProfiles={showLlmProfiles}- agentKind={conversation.agent_kind}- acpServer={conversation.acp_server}- />- </NavigationLink>+ <NavigationLink+ to={`/conversations/${conversation.id}`}+ onClick={onClose}+ className={cn(+ "block rounded-md transition-colors",+ openContextMenuId !== conversation.id &&+ "hover:bg-[var(--oh-surface)]",+ (conversation.id === currentConversationId ||+ openContextMenuId === conversation.id) &&+ "bg-[var(--oh-surface)]",+ )}+ >+ <ConversationCard+ onDelete={() =>+ handleDeleteProject(conversation.id, conversation.title ?? "")+ }+ onStop={() => handleStopConversation(conversation.id)}+ onChangeTitle={(title) =>+ handleConversationTitleChange(conversation.id, title)+ }+ title={conversation.title ?? ""}+ selectedRepository={{+ selected_repository: conversation.selected_repository,+ selected_branch: conversation.selected_branch,+ git_provider: conversation.git_provider as Provider,+ }}+ lastUpdatedAt={conversation.updated_at}+ createdAt={conversation.created_at}+ executionStatus={conversation.execution_status}+ sandboxStatus={conversation.sandbox_status}+ conversationId={conversation.id}+ contextMenuOpen={openContextMenuId === conversation.id}+ onContextMenuToggle={(isOpen) =>+ setOpenContextMenuId(isOpen ? conversation.id : null)+ }+ isActive={conversation.id === currentConversationId}+ workspaceWorkingDir={+ conversation.selected_workspace ??+ conversation.workspace?.working_dir+ }+ showRepositoryMetadata={showRepoBranchMetadata}+ llmModel={conversation.llm_model}+ showLlmProfiles={showLlmProfiles}+ agentKind={conversation.agent_kind}+ acpServer={conversation.acp_server}+ isPinned={isPinned}+ onTogglePin={() => togglePin(activeBackend.id, conversation.id)}+ alwaysShowPinIcon={isPinned && !options?.inPinnedSection}+ />+ </NavigationLink>+ </Tooltip>);},[+ activeBackend.id,compact,currentConversationId,handleConversationTitleChange,@@ -489,8 +692,11 @@ export function ConversationPanel({handleStopConversation,onClose,openContextMenuId,+ pinnedIds,showRepoBranchMetadata,showLlmProfiles,+ showHoverMetadata,+ togglePin,],);@@ -502,11 +708,14 @@ export function ConversationPanel({// not `isFetching` — the latter flips back to true on every 10s background// refetch, causing the skeleton/empty-state to flicker when the list is empty.const showInitialSkeleton = isLoading || !isFetched;+ const showPinnedSection =+ !compact && !showInitialSkeleton && pinnedConversations.length > 0;const showEmptyState =isFetched &&!isLoading &&!compact &&listIsEffectivelyEmpty &&+ !showPinnedSection &&!startTasks?.length;const showConversationHeader = !compact;@@ -554,6 +763,8 @@ export function ConversationPanel({toggleShowRepoBranchMetadata={toggleShowRepoBranchMetadata}showLlmProfiles={showLlmProfiles}toggleShowLlmProfiles={toggleShowLlmProfiles}+ showHoverMetadata={showHoverMetadata}+ toggleShowHoverMetadata={toggleShowHoverMetadata}totalConversationsCount={conversations.length}onRequestDeleteAll={() => setConfirmDeleteAllVisible(true)}/>@@ -586,6 +797,21 @@ export function ConversationPanel({</div>)}+ {showPinnedSection ? (+ <ConversationPanelPinnedSection+ pinnedConversations={pinnedConversations}+ isPreviewExpanded={expandedPinnedPreview}+ onTogglePreviewExpanded={() =>+ setExpandedPinnedPreview((current) => !current)+ }+ activeConversationId={currentConversationId}+ showDivider={!compact && organizeMode === "chronological"}+ renderConversationCard={(conversation) =>+ renderConversationCard(conversation, { inPinnedSection: true })+ }+ />+ ) : null}+{/* Render in-progress start tasks first (skipped in compact mode —their rich card layout doesn't fit in the icon rail). */}{!compact &&@@ -601,108 +827,41 @@ export function ConversationPanel({))}{!showInitialSkeleton && compact- ? compactVisibleConversations.map(renderConversationCard)+ ? compactVisibleConversations.map((conversation) =>+ renderConversationCard(conversation),+ ): 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 groupTestIdSuffix = group.id.replace(- /[^a-zA-Z0-9_-]/g,- "-",- );- const expanded = !collapsedGroupIds.has(group.id);- const previewExpanded = expandedGroupPreviewIds.has(group.id);- const { visibleConversations, isPreviewTruncated, isShowingAll } =- getGroupConversationPreview(group.conversations, {- expanded: previewExpanded,- activeConversationId: currentConversationId,- });- 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-normal",- "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">- {visibleConversations.map(renderConversationCard)}- {isPreviewTruncated ? (- <div className="pl-2">- <button- type="button"- data-testid={`thread-folder-view-more-${groupTestIdSuffix}`}- onClick={() => toggleGroupPreviewExpanded(group.id)}- className="ml-[26px] cursor-pointer text-xs text-[var(--oh-text-dim)] hover:text-white"- >- {isShowingAll- ? t(I18nKey.CONVERSATION_PANEL$LESS)- : t(I18nKey.CONVERSATION_PANEL$MORE)}- </button>- </div>- ) : null}- </div>- ) : null}- </section>- );- })}- </nav>+ orderedConversationGroups &&+ orderedConversationGroups.length > 0 ? (+ <ConversationGroupFolderList+ groups={orderedConversationGroups}+ groupIds={conversationGroupIds}+ groupFolderOrder={groupFolderOrder}+ setGroupFolderOrder={setGroupFolderOrder}+ collapsedGroupIds={collapsedGroupIds}+ expandedGroupPreviewIds={expandedGroupPreviewIds}+ onToggleGroupCollapsed={toggleGroupCollapsed}+ onToggleGroupPreviewExpanded={toggleGroupPreviewExpanded}+ isCreatingConversationFlow={isCreatingConversationFlow}+ activeConversationId={currentConversationId}+ onLaunchFromGroup={launchFromGroup}+ renderConversationCard={(conversation) =>+ renderConversationCard(conversation)+ }+ />) : null}{!showInitialSkeleton &&!compact &&organizeMode === "chronological" ? (<div className="space-y-0.5">- {sortedVisibleConversations.map(renderConversationCard)}+ {sortedVisibleConversations.map((conversation) =>+ renderConversationCard(conversation),+ )}</div>) : null}@@ -710,22 +869,23 @@ export function ConversationPanel({*and* the older list is currently visible (or there are no olderconversations to begin with) — otherwise the next page would bepopulated mostly with conversations the user has chosen to hide. */}- {showLoadMore && (- <div className="flex justify-center py-4">- {isFetchingNextPage ? (- <LoadingSpinner size="small" />- ) : (+ {showLoadMore &&+ (isLoadingMore ? (+ <div className="py-1">+ <ConversationCardSkeleton compact={compact} />+ </div>+ ) : (+ <div className="flex justify-center py-4"><buttontype="button"data-testid="load-more-conversations"- onClick={() => fetchNextPage()}+ onClick={requestLoadMore}className="text-xs text-[var(--oh-muted)] hover:text-white">{t(I18nKey.CONVERSATION$LOAD_MORE)}</button>- )}- </div>- )}+ </div>+ ))}</div>{confirmDeleteModalVisible && (diff --git a/src/components/features/settings/upgrade-button.tsx b/src/components/features/settings/upgrade-button.tsxindex 92792693f5..f79f2d0772 100644--- a/src/components/features/settings/upgrade-button.tsx+++ b/src/components/features/settings/upgrade-button.tsx@@ -1,6 +1,6 @@import { useTranslation } from "react-i18next";-import { cn } from "#/utils/utils";import { I18nKey } from "#/i18n/declaration";+import { cn } from "#/utils/utils";interface UpgradeButtonProps {onClick?: () => void;diff --git a/src/i18n/translation.json b/src/i18n/translation.jsonindex 32025da07f..e4b11991a2 100644--- a/src/i18n/translation.json+++ b/src/i18n/translation.json@@ -16812,6 +16812,23 @@"tr": "Depo ve dal","uk": "Репозиторій і гілка"},+ "CONVERSATION_PANEL$HOVER_METADATA": {+ "en": "Hover metadata",+ "ja": "ホバーメタデータ",+ "zh-CN": "悬停元数据",+ "zh-TW": "懸停中繼資料",+ "ko-KR": "호버 메타데이터",+ "no": "Sveve-metadata",+ "ar": "بيانات التمرير",+ "de": "Hover-Metadaten",+ "fr": "Métadonnées au survol",+ "it": "Metadati al passaggio",+ "pt": "Metadados ao passar",+ "es": "Metadatos al pasar",+ "ca": "Metadades en passar",+ "tr": "Üzerine gelme meta verileri",+ "uk": "Метадані при наведенні"+ },"CONVERSATION_PANEL$NO_WORKSPACE": {"en": "No workspace","ja": "ワークスペースなし",@@ -16914,6 +16931,193 @@"tr": "Daha az","uk": "Менше"},+ "CONVERSATION_PANEL$EXPAND_FOLDER": {+ "en": "Expand {{label}} folder",+ "ja": "{{label}} フォルダを展開",+ "zh-CN": "展开 {{label}} 文件夹",+ "zh-TW": "展開 {{label}} 資料夾",+ "ko-KR": "{{label}} 폴더 펼치기",+ "no": "Utvid mappen {{label}}",+ "ar": "توسيع مجلد {{label}}",+ "de": "Ordner {{label}} aufklappen",+ "fr": "Développer le dossier {{label}}",+ "it": "Espandi cartella {{label}}",+ "pt": "Expandir pasta {{label}}",+ "es": "Expandir carpeta {{label}}",+ "ca": "Desplega la carpeta {{label}}",+ "tr": "{{label}} klasörünü genişlet",+ "uk": "Розгорнути папку {{label}}"+ },+ "CONVERSATION_PANEL$COLLAPSE_FOLDER": {+ "en": "Collapse {{label}} folder",+ "ja": "{{label}} フォルダを折りたたむ",+ "zh-CN": "收起 {{label}} 文件夹",+ "zh-TW": "收合 {{label}} 資料夾",+ "ko-KR": "{{label}} 폴더 접기",+ "no": "Skjul mappen {{label}}",+ "ar": "طي مجلد {{label}}",+ "de": "Ordner {{label}} einklappen",+ "fr": "Réduire le dossier {{label}}",+ "it": "Comprimi cartella {{label}}",+ "pt": "Recolher pasta {{label}}",+ "es": "Contraer carpeta {{label}}",+ "ca": "Replega la carpeta {{label}}",+ "tr": "{{label}} klasörünü daralt",+ "uk": "Згорнути папку {{label}}"+ },+ "CONVERSATION_PANEL$SELECT_FOLDER": {+ "en": "Select {{label}} folder",+ "ja": "{{label}} フォルダを選択",+ "zh-CN": "选择 {{label}} 文件夹",+ "zh-TW": "選取 {{label}} 資料夾",+ "ko-KR": "{{label}} 폴더 선택",+ "no": "Velg mappen {{label}}",+ "ar": "تحديد مجلد {{label}}",+ "de": "Ordner {{label}} auswählen",+ "fr": "Sélectionner le dossier {{label}}",+ "it": "Seleziona cartella {{label}}",+ "pt": "Selecionar pasta {{label}}",+ "es": "Seleccionar carpeta {{label}}",+ "ca": "Selecciona la carpeta {{label}}",+ "tr": "{{label}} klasörünü seç",+ "uk": "Вибрати папку {{label}}"+ },+ "CONVERSATION_PANEL$DRAG_FOLDER": {+ "en": "Drag {{label}} folder to reorder",+ "ja": "{{label}} フォルダをドラッグして並べ替え",+ "zh-CN": "拖动 {{label}} 文件夹以重新排序",+ "zh-TW": "拖曳 {{label}} 資料夾以重新排序",+ "ko-KR": "{{label}} 폴더를 드래그하여 순서 변경",+ "no": "Dra mappen {{label}} for å endre rekkefølge",+ "ar": "اسحب مجلد {{label}} لإعادة الترتيب",+ "de": "Ordner {{label}} ziehen, um neu zu sortieren",+ "fr": "Glisser le dossier {{label}} pour réorganiser",+ "it": "Trascina la cartella {{label}} per riordinare",+ "pt": "Arraste a pasta {{label}} para reordenar",+ "es": "Arrastra la carpeta {{label}} para reordenar",+ "ca": "Arrossega la carpeta {{label}} per reordenar",+ "tr": "Sıralamak için {{label}} klasörünü sürükleyin",+ "uk": "Перетягніть папку {{label}}, щоб змінити порядок"+ },+ "CONVERSATION_PANEL$PINNED": {+ "en": "Pinned",+ "ja": "ピン留め",+ "zh-CN": "已固定",+ "zh-TW": "已釘選",+ "ko-KR": "고정됨",+ "no": "Festet",+ "ar": "مثبت",+ "de": "Angepinnt",+ "fr": "Épinglés",+ "it": "Fissati",+ "pt": "Fixados",+ "es": "Fijados",+ "ca": "Fixats",+ "tr": "Sabitlenmiş",+ "uk": "Закріплені"+ },+ "CONVERSATION_PANEL$PREVIEW_DIRECTORY": {+ "en": "Directory",+ "ja": "ディレクトリ",+ "zh-CN": "目录",+ "zh-TW": "目錄",+ "ko-KR": "디렉터리",+ "no": "Katalog",+ "ar": "الدليل",+ "de": "Verzeichnis",+ "fr": "Répertoire",+ "it": "Directory",+ "pt": "Diretório",+ "es": "Directorio",+ "ca": "Directori",+ "tr": "Dizin",+ "uk": "Каталог"+ },+ "CONVERSATION_PANEL$PREVIEW_MODEL": {+ "en": "Model",+ "ja": "モデル",+ "zh-CN": "模型",+ "zh-TW": "模型",+ "ko-KR": "모델",+ "no": "Modell",+ "ar": "النموذج",+ "de": "Modell",+ "fr": "Modèle",+ "it": "Modello",+ "pt": "Modelo",+ "es": "Modelo",+ "ca": "Model",+ "tr": "Model",+ "uk": "Модель"+ },+ "CONVERSATION_PANEL$PIN_CONVERSATION": {+ "en": "Pin conversation",+ "ja": "会話をピン留め",+ "zh-CN": "固定对话",+ "zh-TW": "釘選對話",+ "ko-KR": "대화 고정",+ "no": "Fest samtale",+ "ar": "تثبيت المحادثة",+ "de": "Unterhaltung anpinnen",+ "fr": "Épingler la conversation",+ "it": "Fissa conversazione",+ "pt": "Fixar conversa",+ "es": "Fijar conversación",+ "ca": "Fixar conversa",+ "tr": "Konuşmayı sabitle",+ "uk": "Закріпити розмову"+ },+ "CONVERSATION_PANEL$UNPIN_CONVERSATION": {+ "en": "Unpin conversation",+ "ja": "会話のピン留めを解除",+ "zh-CN": "取消固定对话",+ "zh-TW": "取消釘選對話",+ "ko-KR": "대화 고정 해제",+ "no": "Løsne samtale",+ "ar": "إلغاء تثبيت المحادثة",+ "de": "Unterhaltung lösen",+ "fr": "Désépingler la conversation",+ "it": "Rimuovi fissaggio conversazione",+ "pt": "Desafixar conversa",+ "es": "Desfijar conversación",+ "ca": "Desfixar conversa",+ "tr": "Konuşmanın sabitlemesini kaldır",+ "uk": "Відкріпити розмову"+ },+ "CONVERSATION_PANEL$MOVE_FOLDER_UP": {+ "en": "Move {{label}} folder up",+ "ja": "{{label}} フォルダを上に移動",+ "zh-CN": "将 {{label}} 文件夹上移",+ "zh-TW": "將 {{label}} 資料夾上移",+ "ko-KR": "{{label}} 폴더 위로 이동",+ "no": "Flytt mappen {{label}} opp",+ "ar": "نقل مجلد {{label}} لأعلى",+ "de": "Ordner {{label}} nach oben verschieben",+ "fr": "Monter le dossier {{label}}",+ "it": "Sposta la cartella {{label}} in su",+ "pt": "Mover pasta {{label}} para cima",+ "es": "Mover carpeta {{label}} arriba",+ "ca": "Mou la carpeta {{label}} amunt",+ "tr": "{{label}} klasörünü yukarı taşı",+ "uk": "Перемістити папку {{label}} вгору"+ },+ "CONVERSATION_PANEL$MOVE_FOLDER_DOWN": {+ "en": "Move {{label}} folder down",+ "ja": "{{label}} フォルダを下に移動",+ "zh-CN": "将 {{label}} 文件夹下移",+ "zh-TW": "將 {{label}} 資料夾下移",+ "ko-KR": "{{label}} 폴더 아래로 이동",+ "no": "Flytt mappen {{label}} ned",+ "ar": "نقل مجلد {{label}} لأسفل",+ "de": "Ordner {{label}} nach unten verschieben",+ "fr": "Descendre le dossier {{label}}",+ "it": "Sposta la cartella {{label}} in giù",+ "pt": "Mover pasta {{label}} para baixo",+ "es": "Mover carpeta {{label}} abajo",+ "ca": "Mou la carpeta {{label}} avall",+ "tr": "{{label}} klasörünü aşağı taşı",+ "uk": "Перемістити папку {{label}} вниз"+ },"CONVERSATION$CONFIRM_DELETE_ALL_TITLE": {"en": "Delete all conversations","ja": "すべての会話を削除",diff --git a/src/stores/conversation-panel-preferences-store.ts b/src/stores/conversation-panel-preferences-store.tsindex e70f29607b..72f092d699 100644--- a/src/stores/conversation-panel-preferences-store.ts+++ b/src/stores/conversation-panel-preferences-store.ts@@ -1,9 +1,9 @@import { create } from "zustand";import { persist, createJSONStorage } from "zustand/middleware";-import type {- ConversationSortField,- OrganizeMode,- ThreadScope,+import {+ type ConversationSortField,+ type OrganizeMode,+ type ThreadScope,} from "#/components/features/conversation-panel/conversation-panel-list-helpers";/**@@ -23,9 +23,11 @@ interface ConversationPanelPreferencesState {showOlderConversations: boolean;showRepoBranchMetadata: boolean;showLlmProfiles: boolean;+ showHoverMetadata: boolean;organizeMode: OrganizeMode;conversationSort: ConversationSortField;threadScope: ThreadScope;+ groupFolderOrder: string[];}interface ConversationPanelPreferencesActions {@@ -35,9 +37,12 @@ interface ConversationPanelPreferencesActions {toggleShowRepoBranchMetadata: () => void;setShowLlmProfiles: (value: boolean) => void;toggleShowLlmProfiles: () => void;+ setShowHoverMetadata: (value: boolean) => void;+ toggleShowHoverMetadata: () => void;setOrganizeMode: (value: OrganizeMode) => void;setConversationSort: (value: ConversationSortField) => void;setThreadScope: (value: ThreadScope) => void;+ setGroupFolderOrder: (order: readonly string[]) => void;}type ConversationPanelPreferencesStore = ConversationPanelPreferencesState &@@ -47,9 +52,11 @@ const initialState: ConversationPanelPreferencesState = {showOlderConversations: true,showRepoBranchMetadata: false,showLlmProfiles: false,+ showHoverMetadata: true,organizeMode: "chronological",conversationSort: "updated",threadScope: "all",+ groupFolderOrder: [],};export const useConversationPanelPreferencesStore =@@ -78,10 +85,19 @@ export const useConversationPanelPreferencesStore =showLlmProfiles: !state.showLlmProfiles,})),+ setShowHoverMetadata: (value) =>+ set(() => ({ showHoverMetadata: value })),+ toggleShowHoverMetadata: () =>+ set((state) => ({+ showHoverMetadata: !state.showHoverMetadata,+ })),+setOrganizeMode: (value) => set(() => ({ organizeMode: value })),setConversationSort: (value) =>set(() => ({ conversationSort: value })),setThreadScope: (value) => set(() => ({ threadScope: value })),+ setGroupFolderOrder: (order) =>+ set(() => ({ groupFolderOrder: [...order] })),}),{name: "conversation-panel-preferences",@@ -91,9 +107,11 @@ export const useConversationPanelPreferencesStore =showOlderConversations: state.showOlderConversations,showRepoBranchMetadata: state.showRepoBranchMetadata,showLlmProfiles: state.showLlmProfiles,+ showHoverMetadata: state.showHoverMetadata,organizeMode: state.organizeMode,conversationSort: state.conversationSort,threadScope: state.threadScope,+ groupFolderOrder: state.groupFolderOrder,}),},),diff --git a/src/stores/pinned-conversations-store.ts b/src/stores/pinned-conversations-store.tsnew file mode 100644index 0000000000..190c5b4ff1--- /dev/null+++ b/src/stores/pinned-conversations-store.ts@@ -0,0 +1,95 @@+import { create } from "zustand";+import { persist, createJSONStorage } from "zustand/middleware";++interface PinnedConversationsState {+ pinsByBackendId: Record<string, string[]>;+}++interface PinnedConversationsActions {+ pinConversation: (backendId: string, conversationId: string) => void;+ unpinConversation: (backendId: string, conversationId: string) => void;+ togglePin: (backendId: string, conversationId: string) => void;+ pruneMissingConversations: (+ backendId: string,+ existingIds: readonly string[],+ ) => void;+}++type PinnedConversationsStore = PinnedConversationsState &+ PinnedConversationsActions;++const initialState: PinnedConversationsState = {+ pinsByBackendId: {},+};++function getPinsForBackend(+ pinsByBackendId: Record<string, string[]>,+ backendId: string,+): string[] {+ return pinsByBackendId[backendId] ?? [];+}++export const usePinnedConversationsStore = create<PinnedConversationsStore>()(+ persist(+ (set, get) => ({+ ...initialState,++ pinConversation: (backendId, conversationId) => {+ const current = getPinsForBackend(get().pinsByBackendId, backendId);+ if (current.includes(conversationId)) {+ return;+ }+ set((state) => ({+ pinsByBackendId: {+ ...state.pinsByBackendId,+ [backendId]: [conversationId, ...current],+ },+ }));+ },++ unpinConversation: (backendId, conversationId) => {+ const current = getPinsForBackend(get().pinsByBackendId, backendId);+ if (!current.includes(conversationId)) {+ return;+ }+ set((state) => ({+ pinsByBackendId: {+ ...state.pinsByBackendId,+ [backendId]: current.filter((id) => id !== conversationId),+ },+ }));+ },++ togglePin: (backendId, conversationId) => {+ const current = getPinsForBackend(get().pinsByBackendId, backendId);+ if (current.includes(conversationId)) {+ get().unpinConversation(backendId, conversationId);+ } else {+ get().pinConversation(backendId, conversationId);+ }+ },++ pruneMissingConversations: (backendId, existingIds) => {+ const existing = new Set(existingIds);+ const current = getPinsForBackend(get().pinsByBackendId, backendId);+ const pruned = current.filter((id) => existing.has(id));+ if (pruned.length === current.length) {+ return;+ }+ set((state) => ({+ pinsByBackendId: {+ ...state.pinsByBackendId,+ [backendId]: pruned,+ },+ }));+ },+ }),+ {+ name: "pinned-conversations",+ storage: createJSONStorage(() => localStorage),+ partialize: (state): PinnedConversationsState => ({+ pinsByBackendId: state.pinsByBackendId,+ }),+ },+ ),+);