Skip to content

Commit eed1f15

Browse files
committed
fix: add X button to stop/close task during save/reject prompts
- Added a stop/close button (X icon) that remains visible when approval buttons are shown - Button allows users to terminate tasks during save/reject phase as requested - Fixes issue where users could not stop tasks when prompted to save/reject changes Fixes #6865
1 parent ad0e33e commit eed1f15

File tree

1 file changed

+34
-13
lines changed

1 file changed

+34
-13
lines changed

webview-ui/src/components/chat/ChatView.tsx

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1942,25 +1942,46 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
19421942
</VSCodeButton>
19431943
</StandardTooltip>
19441944
)}
1945-
{(secondaryButtonText || isStreaming) && (
1945+
{(secondaryButtonText || isStreaming) && !isStreaming && (
19461946
<StandardTooltip
19471947
content={
1948-
isStreaming
1949-
? t("chat:cancel.tooltip")
1950-
: secondaryButtonText === t("chat:startNewTask.title")
1951-
? t("chat:startNewTask.tooltip")
1952-
: secondaryButtonText === t("chat:reject.title")
1953-
? t("chat:reject.tooltip")
1954-
: secondaryButtonText === t("chat:terminate.title")
1955-
? t("chat:terminate.tooltip")
1956-
: undefined
1948+
secondaryButtonText === t("chat:startNewTask.title")
1949+
? t("chat:startNewTask.tooltip")
1950+
: secondaryButtonText === t("chat:reject.title")
1951+
? t("chat:reject.tooltip")
1952+
: secondaryButtonText === t("chat:terminate.title")
1953+
? t("chat:terminate.tooltip")
1954+
: undefined
19571955
}>
19581956
<VSCodeButton
19591957
appearance="secondary"
1960-
disabled={!enableButtons && !(isStreaming && !didClickCancel)}
1961-
className={isStreaming ? "flex-[2] ml-0" : "flex-1 ml-[6px]"}
1958+
disabled={!enableButtons}
1959+
className="flex-1 ml-[6px]"
19621960
onClick={() => handleSecondaryButtonClick(inputValue, selectedImages)}>
1963-
{isStreaming ? t("chat:cancel.title") : secondaryButtonText}
1961+
{secondaryButtonText}
1962+
</VSCodeButton>
1963+
</StandardTooltip>
1964+
)}
1965+
{isStreaming && (
1966+
<StandardTooltip content={t("chat:cancel.tooltip")}>
1967+
<VSCodeButton
1968+
appearance="secondary"
1969+
disabled={!(isStreaming && !didClickCancel)}
1970+
className="flex-[2] ml-0"
1971+
onClick={() => handleSecondaryButtonClick(inputValue, selectedImages)}>
1972+
{t("chat:cancel.title")}
1973+
</VSCodeButton>
1974+
</StandardTooltip>
1975+
)}
1976+
{/* Add stop/close button when not streaming but showing approval buttons */}
1977+
{!isStreaming && enableButtons && primaryButtonText && (
1978+
<StandardTooltip content={t("chat:terminate.tooltip")}>
1979+
<VSCodeButton
1980+
appearance="icon"
1981+
disabled={false}
1982+
className="ml-2"
1983+
onClick={() => startNewTask()}>
1984+
<span className="codicon codicon-x"></span>
19641985
</VSCodeButton>
19651986
</StandardTooltip>
19661987
)}

0 commit comments

Comments
 (0)