π OpenHands: AI-Driven Development
fix(frontend): show stop action button for running or starting conversations (#12215)
yunbae2734a5a52d0b
diff --git a/frontend/__tests__/components/features/conversation-panel/conversation-card.test.tsx b/frontend/__tests__/components/features/conversation-panel/conversation-card.test.tsxindex 65020fa669..d069280b00 100644--- a/frontend/__tests__/components/features/conversation-panel/conversation-card.test.tsx+++ b/frontend/__tests__/components/features/conversation-panel/conversation-card.test.tsx@@ -14,6 +14,8 @@ import { renderWithProviders } from "test-utils";import { formatTimeDelta } from "#/utils/format-time-delta";import { ConversationCard } from "#/components/features/conversation-panel/conversation-card/conversation-card";import { clickOnEditButton } from "./utils";+import { ConversationCardActions } from "#/components/features/conversation-panel/conversation-card/conversation-card-actions";+import { ConversationStatus } from "#/types/conversation-status";// We'll use the actual i18next implementation but override the translation function@@ -431,4 +433,34 @@ describe("ConversationCard", () => {expect(screen.queryByTestId("ellipsis-button")).not.toBeInTheDocument();});++ const statusTable: [ConversationStatus, boolean][] = [+ ["RUNNING", true],+ ["STARTING", true],+ ["STOPPED", false],+ ["ARCHIVED", false],+ ["ERROR", false],+ ];++ it.each(statusTable)(+ "should toggle stop button visibility correctly for status",+ (status, shouldShow) => {+ renderWithProviders(+ <ConversationCardActions+ contextMenuOpen={true}+ onContextMenuToggle={vi.fn()}+ onStop={vi.fn()}+ conversationStatus={status}+ />,+ );++ const stopButton = screen.queryByTestId("stop-button");++ if (shouldShow) {+ expect(stopButton).toBeInTheDocument();+ } else {+ expect(stopButton).not.toBeInTheDocument();+ }+ },+ );});diff --git a/frontend/src/components/features/conversation-panel/conversation-card/conversation-card-actions.tsx b/frontend/src/components/features/conversation-panel/conversation-card/conversation-card-actions.tsxindex 7afa2fed14..28a940955a 100644--- a/frontend/src/components/features/conversation-panel/conversation-card/conversation-card-actions.tsx+++ b/frontend/src/components/features/conversation-panel/conversation-card/conversation-card-actions.tsx@@ -59,7 +59,12 @@ export function ConversationCardActions({<ConversationCardContextMenuonClose={() => onContextMenuToggle(false)}onDelete={onDelete}- onStop={conversationStatus !== "STOPPED" ? onStop : undefined}+ onStop={+ conversationStatus === "RUNNING" ||+ conversationStatus === "STARTING"+ ? onStop+ : undefined+ }onEdit={onEdit}onDownloadViaVSCode={conversationId && showOptions ? onDownloadViaVSCode : undefined