From cc36c67fc93d342ca64e26e22502da7a6a36a079 Mon Sep 17 00:00:00 2001 From: "Jose R. Perez" Date: Fri, 19 Dec 2025 18:46:20 -0500 Subject: [PATCH] feat: enhanced compact task complete ui (#8025) * feat: enhanced task completed response ui * feat: enhanced task completed response ui * feature: adjusted embed component styling * fix: minor adjustments * fix: made last task completed expanded by default * fix: restore api request and thinking * feat: copy button fix --- .changeset/vast-llamas-admire.md | 5 + webview-ui/src/components/chat/ChatRow.css | 17 + webview-ui/src/components/chat/ChatRow.tsx | 417 +++++++++++++----- .../src/components/common/CopyButton.tsx | 8 +- 4 files changed, 334 insertions(+), 113 deletions(-) create mode 100644 .changeset/vast-llamas-admire.md create mode 100644 webview-ui/src/components/chat/ChatRow.css diff --git a/.changeset/vast-llamas-admire.md b/.changeset/vast-llamas-admire.md new file mode 100644 index 00000000..66076b66 --- /dev/null +++ b/.changeset/vast-llamas-admire.md @@ -0,0 +1,5 @@ +--- +"claude-dev": patch +--- + +enhanced compact task complete ui diff --git a/webview-ui/src/components/chat/ChatRow.css b/webview-ui/src/components/chat/ChatRow.css new file mode 100644 index 00000000..d9ee601a --- /dev/null +++ b/webview-ui/src/components/chat/ChatRow.css @@ -0,0 +1,17 @@ +/* Use theme-aware background and border colors for better contrast in all themes */ +.completion-output-content pre { + background-color: rgba(0, 0, 0, 0.15) !important; + border-top: 1px solid var(--vscode-editorWidget-border, #cccccc); + border-bottom: 1px solid var(--vscode-editorWidget-border, #cccccc); +} + +.completion-output-content code { + background-color: rgba(0, 0, 0, 0.15) !important; + border-top: 1px solid var(--vscode-editorWidget-border, #cccccc); + border-bottom: 1px solid var(--vscode-editorWidget-border, #cccccc); +} + +.completion-output-content pre > code { + background-color: transparent; + border: none; +} diff --git a/webview-ui/src/components/chat/ChatRow.tsx b/webview-ui/src/components/chat/ChatRow.tsx index 1d8fccea..deed5591 100644 --- a/webview-ui/src/components/chat/ChatRow.tsx +++ b/webview-ui/src/components/chat/ChatRow.tsx @@ -18,6 +18,7 @@ import { useSize } from "react-use" import styled from "styled-components" import { OptionsButtons } from "@/components/chat/OptionsButtons" import TaskFeedbackButtons from "@/components/chat/TaskFeedbackButtons" +import "./ChatRow.css" import { CheckmarkControl } from "@/components/common/CheckmarkControl" import { CheckpointControls } from "@/components/common/CheckpointControls" import CodeBlock, { @@ -25,15 +26,13 @@ import CodeBlock, { CODE_BLOCK_BG_COLOR, TERMINAL_CODE_BLOCK_BG_COLOR, } from "@/components/common/CodeBlock" -import { WithCopyButton } from "@/components/common/CopyButton" +import { CopyButton, WithCopyButton } from "@/components/common/CopyButton" import MarkdownBlock from "@/components/common/MarkdownBlock" -import SuccessButton from "@/components/common/SuccessButton" import McpResponseDisplay from "@/components/mcp/chat-display/McpResponseDisplay" import McpResourceRow from "@/components/mcp/configuration/tabs/installed/server-row/McpResourceRow" import McpToolRow from "@/components/mcp/configuration/tabs/installed/server-row/McpToolRow" import { PLATFORM_CONFIG, PlatformType } from "@/config/platform.config" import { useExtensionState } from "@/context/ExtensionStateContext" -import { cn } from "@/lib/utils" import { FileServiceClient, TaskServiceClient, UiServiceClient } from "@/services/grpc-client" import { findMatchingResourceOrTemplate, getMcpServerDisplayName } from "@/utils/mcp" import CodeAccordian, { cleanPathPrefix } from "../common/CodeAccordian" @@ -134,11 +133,13 @@ const CommandOutput = memo( isOutputFullyExpanded, onToggle, isContainerExpanded, + borderColor = "var(--vscode-editorGroup-border)", }: { output: string isOutputFullyExpanded: boolean onToggle: () => void isContainerExpanded: boolean + borderColor?: string }) => { const outputLines = output.split("\n") const lineCount = outputLines.length @@ -173,9 +174,9 @@ const CommandOutput = memo( paddingBottom: lineCount > 5 ? "16px" : "0", overflow: "visible", borderTop: "1px solid rgba(255,255,255,.07)", - backgroundColor: TERMINAL_CODE_BLOCK_BG_COLOR, borderBottomLeftRadius: "6px", borderBottomRightRadius: "6px", + backgroundColor: CHAT_ROW_EXPANDED_BG_COLOR, }}>
5 && (
{ - e.currentTarget.style.opacity = "0.8" - }} - onMouseLeave={(e) => { - e.currentTarget.style.opacity = "1" - }} style={{ position: "absolute", - bottom: "-10px", + bottom: "-8px", left: "50%", transform: "translateX(-50%)", display: "flex", @@ -210,16 +205,85 @@ const CommandOutput = memo( alignItems: "center", padding: "1px 14px", cursor: "pointer", - backgroundColor: "var(--vscode-descriptionForeground)", - borderRadius: "3px 3px 6px 6px", - transition: "opacity 0.1s ease", - border: "1px solid rgba(0, 0, 0, 0.1)", + backgroundColor: borderColor, + borderRadius: "2px", + border: "none", }}> +
+ )} +
+ ) + }, +) + +const CompletionOutput = memo( + ({ + text, + isOutputFullyExpanded, + onToggle, + borderColor = successColor, + }: { + text: string + isOutputFullyExpanded: boolean + onToggle: () => void + borderColor?: string + }) => { + const outputLines = text.split("\n") + const lineCount = outputLines.length + const shouldAutoShow = lineCount <= 5 + + return ( +
5 ? "8px" : "0", + overflow: "visible", + borderTop: "1px solid rgba(255,255,255,.07)", + borderBottomLeftRadius: "6px", + borderBottomRightRadius: "6px", + backgroundColor: CHAT_ROW_EXPANDED_BG_COLOR, + }}> +
+ +
+ {/* Show notch only if there's more than 5 lines */} + {lineCount > 5 && ( +
+
@@ -279,6 +343,9 @@ export const ChatRowContent = memo( const { mcpServers, mcpMarketplaceCatalog, onRelinquishControl, vscodeTerminalExecutionMode } = useExtensionState() const [seeNewChangesDisabled, setSeeNewChangesDisabled] = useState(false) const [explainChangesDisabled, setExplainChangesDisabled] = useState(false) + const [viewChangesHovered, setViewChangesHovered] = useState(false) + const [explainChangesHovered, setExplainChangesHovered] = useState(false) + const [completionContainerHovered, setCompletionContainerHovered] = useState(false) const [quoteButtonState, setQuoteButtonState] = useState({ visible: false, top: 0, @@ -290,6 +357,39 @@ export const ChatRowContent = memo( // Command output expansion state (for all messages, but only used by command messages) const [isOutputFullyExpanded, setIsOutputFullyExpanded] = useState(false) const prevCommandExecutingRef = useRef(false) + // Completion output expansion state + const [isCompletionOutputExpanded, setIsCompletionOutputExpanded] = useState(false) + const hasAutoExpandedRef = useRef(false) + const hasAutoCollapsedRef = useRef(false) + const prevIsLastRef = useRef(isLast) + + // Auto-expand completion output when it's the last message (runs once per message) + useEffect(() => { + const isCompletionResult = message.ask === "completion_result" || message.say === "completion_result" + + // Auto-expand if it's last and we haven't already auto-expanded + if (isLast && isCompletionResult && !hasAutoExpandedRef.current) { + setIsCompletionOutputExpanded(true) + hasAutoExpandedRef.current = true + hasAutoCollapsedRef.current = false // Reset the auto-collapse flag when expanding + } + }, [isLast, message.ask, message.say]) + + // Auto-collapse completion output ONCE when transitioning from last to not-last + useEffect(() => { + const isCompletionResult = message.ask === "completion_result" || message.say === "completion_result" + const wasLast = prevIsLastRef.current + + // Only auto-collapse if transitioning from last to not-last, and we haven't already auto-collapsed + if (wasLast && !isLast && isCompletionResult && !hasAutoCollapsedRef.current) { + setIsCompletionOutputExpanded(false) + hasAutoCollapsedRef.current = true + hasAutoExpandedRef.current = false // Reset the auto-expand flag when collapsing + } + + prevIsLastRef.current = isLast + }, [isLast, message.ask, message.say]) + const [cost, apiReqCancelReason, apiReqStreamingFailedMessage, retryStatus] = useMemo(() => { if (message.text != null && message.say === "api_req_started") { const info: ClineApiReqInfo = JSON.parse(message.text) @@ -1336,10 +1436,7 @@ export const ChatRowContent = memo( {title} {/* Need to render this every time since it affects height of row by 2px */} 0, - "opacity-0": cost == null || cost <= 0, - })} + className="text-sm" style={{ opacity: cost != null && cost > 0 ? 1 : 0, }}> @@ -1661,45 +1758,66 @@ export const ChatRowContent = memo( return ( <>
setCompletionContainerHovered(true)} + onMouseLeave={() => setCompletionContainerHovered(false)} style={{ - ...headerStyle, - marginBottom: "10px", + borderRadius: 6, + border: `1px solid ${completionContainerHovered ? successColor : "var(--vscode-editorGroup-border)"}`, + overflow: "visible", + backgroundColor: CHAT_ROW_EXPANDED_BG_COLOR, + transition: "border-color 0.2s ease", }}> - {icon} - {title} - {/* */} + display: "flex", + alignItems: "center", + justifyContent: "space-between", + padding: "8px 10px", + backgroundColor: CHAT_ROW_EXPANDED_BG_COLOR, + borderTopLeftRadius: "6px", + borderTopRightRadius: "6px", + borderBottomLeftRadius: 0, + borderBottomRightRadius: 0, + }}> +
+
+ + Task Completed + +
+ +
+ setIsCompletionOutputExpanded(!isCompletionOutputExpanded)} + text={text || ""} + />
- - - {quoteButtonState.visible && ( - - )} - {message.partial !== true && hasChanges && ( -
- + {PLATFORM_CONFIG.type === PlatformType.VSCODE && ( - { setExplainChangesDisabled(true) @@ -1731,15 +1862,26 @@ export const ChatRowContent = memo( setExplainChangesDisabled(false) }) }} + onMouseEnter={() => setExplainChangesHovered(true)} + onMouseLeave={() => setExplainChangesHovered(false)} style={{ cursor: explainChangesDisabled ? "wait" : "pointer", - width: "100%", - backgroundColor: "var(--vscode-button-secondaryBackground)", - borderColor: "var(--vscode-button-secondaryBackground)", + flex: 1, + background: CHAT_ROW_EXPANDED_BG_COLOR, + border: `1px solid ${explainChangesHovered ? successColor : "var(--vscode-editorGroup-border)"}`, + color: successColor, + borderRadius: "2px", + padding: "8px 12px", + fontSize: "13px", + fontFamily: "inherit", + display: "flex", + alignItems: "center", + justifyContent: "center", + transition: "border-color 0.2s ease", }}> {explainChangesDisabled ? "Explaining..." : "Explain Changes"} - + )}
)} @@ -1967,45 +2109,76 @@ export const ChatRowContent = memo(
- {icon} - {title} - +
+
+ + Task Completed + +
+
+ + +
+
+ setIsCompletionOutputExpanded(!isCompletionOutputExpanded)} + text={text || ""} />
- - - {quoteButtonState.visible && ( - - )} - {message.partial !== true && hasChanges && ( -
- + {PLATFORM_CONFIG.type === PlatformType.VSCODE && ( - { setExplainChangesDisabled(true) @@ -2039,16 +2222,30 @@ export const ChatRowContent = memo( console.error("Failed to explain changes:", err) setExplainChangesDisabled(false) }) + }} + onMouseEnter={() => setExplainChangesHovered(true)} + onMouseLeave={() => setExplainChangesHovered(false)} + style={{ + cursor: explainChangesDisabled ? "wait" : "pointer", + flex: 1, + background: CHAT_ROW_EXPANDED_BG_COLOR, + border: `1px solid ${explainChangesHovered ? successColor : "var(--vscode-editorGroup-border)"}`, + color: successColor, + borderRadius: "2px", + padding: "8px 12px", + fontSize: "13px", + fontFamily: "inherit", + display: "flex", + alignItems: "center", + justifyContent: "center", + transition: "border-color 0.2s ease", }}> {explainChangesDisabled ? "Explaining..." : "Explain Changes"} - + )}
)} diff --git a/webview-ui/src/components/common/CopyButton.tsx b/webview-ui/src/components/common/CopyButton.tsx index 3088b872..044b854c 100644 --- a/webview-ui/src/components/common/CopyButton.tsx +++ b/webview-ui/src/components/common/CopyButton.tsx @@ -27,6 +27,8 @@ interface WithCopyButtonProps { const StyledButton = styled(VSCodeButton)` z-index: 1; transform: scale(0.9); + background-color: none; + outline: none; ` // Unified container component @@ -46,11 +48,11 @@ const ButtonContainer = styled.div<{ $position?: "top-right" | "bottom-right" }> return "top: 5px; right: 5px;" } }} - z-index: 1; + z-index: 2; opacity: 0; ${ContentContainer}:hover & { - opacity: 0.5; + opacity: 1; } ` @@ -118,7 +120,6 @@ export const WithCopyButton = forwardRef( ) => { return ( - {children} {(textToCopy || onCopy) && ( ( /> )} + {children} ) },