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
This commit is contained in:
1 parent
d77032bc8a
commit
cc36c67fc9
4 files changed
+334
-113
No files matched your search
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"claude-dev": patch
|
||||
---
|
||||
|
||||
enhanced compact task complete ui
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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,
|
||||
}}>
|
||||
<div
|
||||
ref={outputRef}
|
||||
@@ -194,15 +195,9 @@ const CommandOutput = memo(
|
||||
{lineCount > 5 && (
|
||||
<div
|
||||
onClick={onToggle}
|
||||
onMouseEnter={(e) => {
|
||||
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",
|
||||
}}>
|
||||
<span
|
||||
className={`codicon codicon-triangle-${isOutputFullyExpanded ? "up" : "down"}`}
|
||||
style={{
|
||||
fontSize: "11px",
|
||||
color: "var(--vscode-editor-background)",
|
||||
color: "#000000",
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
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 (
|
||||
<div
|
||||
style={{
|
||||
width: "100%",
|
||||
position: "relative",
|
||||
paddingBottom: lineCount > 5 ? "8px" : "0",
|
||||
overflow: "visible",
|
||||
borderTop: "1px solid rgba(255,255,255,.07)",
|
||||
borderBottomLeftRadius: "6px",
|
||||
borderBottomRightRadius: "6px",
|
||||
backgroundColor: CHAT_ROW_EXPANDED_BG_COLOR,
|
||||
}}>
|
||||
<div
|
||||
className="completion-output-content"
|
||||
style={{
|
||||
maxHeight: shouldAutoShow ? "none" : isOutputFullyExpanded ? "400px" : "150px",
|
||||
overflowY: shouldAutoShow ? "visible" : "auto",
|
||||
scrollBehavior: "smooth",
|
||||
padding: "12px",
|
||||
}}>
|
||||
<Markdown markdown={text} />
|
||||
</div>
|
||||
{/* Show notch only if there's more than 5 lines */}
|
||||
{lineCount > 5 && (
|
||||
<div
|
||||
onClick={onToggle}
|
||||
style={{
|
||||
position: "absolute",
|
||||
bottom: "-8px",
|
||||
left: "50%",
|
||||
transform: "translateX(-50%)",
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
padding: "1px 14px",
|
||||
cursor: "pointer",
|
||||
backgroundColor: borderColor,
|
||||
borderRadius: "2px",
|
||||
border: "none",
|
||||
}}>
|
||||
<span
|
||||
className={`codicon codicon-triangle-${isOutputFullyExpanded ? "up" : "down"}`}
|
||||
style={{
|
||||
fontSize: "11px",
|
||||
color: "#000000",
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
@@ -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<QuoteButtonState>({
|
||||
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<boolean>(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 */}
|
||||
<VSCodeBadge
|
||||
className={cn("text-sm", {
|
||||
"opacity-100": cost != null && cost > 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 (
|
||||
<>
|
||||
<div
|
||||
onMouseEnter={() => 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}
|
||||
{/* <TaskFeedbackButtons
|
||||
isFromHistory={
|
||||
!isLast ||
|
||||
lastModifiedMessage?.ask === "resume_completed_task" ||
|
||||
lastModifiedMessage?.ask === "resume_task"
|
||||
}
|
||||
messageTs={message.ts}
|
||||
<div
|
||||
style={{
|
||||
marginLeft: "auto",
|
||||
}}
|
||||
/> */}
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "space-between",
|
||||
padding: "8px 10px",
|
||||
backgroundColor: CHAT_ROW_EXPANDED_BG_COLOR,
|
||||
borderTopLeftRadius: "6px",
|
||||
borderTopRightRadius: "6px",
|
||||
borderBottomLeftRadius: 0,
|
||||
borderBottomRightRadius: 0,
|
||||
}}>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
gap: "8px",
|
||||
flex: 1,
|
||||
minWidth: 0,
|
||||
}}>
|
||||
<div
|
||||
style={{
|
||||
width: "8px",
|
||||
height: "8px",
|
||||
borderRadius: "50%",
|
||||
backgroundColor: successColor,
|
||||
flexShrink: 0,
|
||||
}}
|
||||
/>
|
||||
<span
|
||||
style={{
|
||||
color: successColor,
|
||||
fontWeight: 500,
|
||||
fontSize: "13px",
|
||||
flexShrink: 0,
|
||||
}}>
|
||||
Task Completed
|
||||
</span>
|
||||
</div>
|
||||
<CopyButton textToCopy={text || ""} />
|
||||
</div>
|
||||
<CompletionOutput
|
||||
borderColor={successColor}
|
||||
isOutputFullyExpanded={isCompletionOutputExpanded}
|
||||
onToggle={() => setIsCompletionOutputExpanded(!isCompletionOutputExpanded)}
|
||||
text={text || ""}
|
||||
/>
|
||||
</div>
|
||||
<WithCopyButton
|
||||
onMouseUp={handleMouseUp}
|
||||
position="bottom-right"
|
||||
ref={contentRef}
|
||||
style={{
|
||||
color: "var(--vscode-charts-green)",
|
||||
paddingTop: 10,
|
||||
}}
|
||||
textToCopy={text}>
|
||||
<Markdown markdown={text} />
|
||||
{quoteButtonState.visible && (
|
||||
<QuoteButton
|
||||
left={quoteButtonState.left}
|
||||
onClick={handleQuoteClick}
|
||||
top={quoteButtonState.top}
|
||||
/>
|
||||
)}
|
||||
</WithCopyButton>
|
||||
{message.partial !== true && hasChanges && (
|
||||
<div style={{ paddingTop: 17, display: "flex", flexDirection: "column", gap: 8 }}>
|
||||
<SuccessButton
|
||||
<div style={{ paddingTop: 17, display: "flex", flexDirection: "row", gap: 8 }}>
|
||||
<button
|
||||
disabled={seeNewChangesDisabled}
|
||||
onClick={() => {
|
||||
setSeeNewChangesDisabled(true)
|
||||
@@ -1711,15 +1829,28 @@ export const ChatRowContent = memo(
|
||||
console.error("Failed to show task completion view changes:", err),
|
||||
)
|
||||
}}
|
||||
onMouseEnter={() => setViewChangesHovered(true)}
|
||||
onMouseLeave={() => setViewChangesHovered(false)}
|
||||
style={{
|
||||
cursor: seeNewChangesDisabled ? "wait" : "pointer",
|
||||
width: "100%",
|
||||
flex: 1,
|
||||
background: CHAT_ROW_EXPANDED_BG_COLOR,
|
||||
border: `1px solid ${viewChangesHovered ? 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",
|
||||
}}>
|
||||
<i className="codicon codicon-new-file" style={{ marginRight: 6 }} />
|
||||
View Changes
|
||||
</SuccessButton>
|
||||
</button>
|
||||
{PLATFORM_CONFIG.type === PlatformType.VSCODE && (
|
||||
<SuccessButton
|
||||
<button
|
||||
disabled={explainChangesDisabled}
|
||||
onClick={() => {
|
||||
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",
|
||||
}}>
|
||||
<i className="codicon codicon-comment-discussion" style={{ marginRight: 6 }} />
|
||||
{explainChangesDisabled ? "Explaining..." : "Explain Changes"}
|
||||
</SuccessButton>
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
@@ -1967,45 +2109,76 @@ export const ChatRowContent = memo(
|
||||
<div>
|
||||
<div
|
||||
style={{
|
||||
...headerStyle,
|
||||
marginBottom: "10px",
|
||||
borderRadius: 6,
|
||||
border: `1px solid ${successColor}`,
|
||||
overflow: "visible",
|
||||
backgroundColor: CHAT_ROW_EXPANDED_BG_COLOR,
|
||||
transition: "all 0.3s ease-in-out",
|
||||
}}>
|
||||
{icon}
|
||||
{title}
|
||||
<TaskFeedbackButtons
|
||||
isFromHistory={
|
||||
!isLast ||
|
||||
lastModifiedMessage?.ask === "resume_completed_task" ||
|
||||
lastModifiedMessage?.ask === "resume_task"
|
||||
}
|
||||
messageTs={message.ts}
|
||||
<div
|
||||
style={{
|
||||
marginLeft: "auto",
|
||||
}}
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "space-between",
|
||||
padding: "8px 10px",
|
||||
backgroundColor: CHAT_ROW_EXPANDED_BG_COLOR,
|
||||
borderTopLeftRadius: "6px",
|
||||
borderTopRightRadius: "6px",
|
||||
borderBottomLeftRadius: 0,
|
||||
borderBottomRightRadius: 0,
|
||||
}}>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
gap: "8px",
|
||||
flex: 1,
|
||||
minWidth: 0,
|
||||
}}>
|
||||
<div
|
||||
style={{
|
||||
width: "8px",
|
||||
height: "8px",
|
||||
borderRadius: "50%",
|
||||
backgroundColor: successColor,
|
||||
flexShrink: 0,
|
||||
}}
|
||||
/>
|
||||
<span
|
||||
style={{
|
||||
color: successColor,
|
||||
fontWeight: 500,
|
||||
fontSize: "13px",
|
||||
flexShrink: 0,
|
||||
}}>
|
||||
Task Completed
|
||||
</span>
|
||||
</div>
|
||||
<div style={{ display: "flex", alignItems: "center", gap: "8px", flexShrink: 0 }}>
|
||||
<CopyButton textToCopy={text || ""} />
|
||||
<TaskFeedbackButtons
|
||||
isFromHistory={
|
||||
!isLast ||
|
||||
lastModifiedMessage?.ask === "resume_completed_task" ||
|
||||
lastModifiedMessage?.ask === "resume_task"
|
||||
}
|
||||
messageTs={message.ts}
|
||||
style={{
|
||||
flexShrink: 0,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<CompletionOutput
|
||||
borderColor={successColor}
|
||||
isOutputFullyExpanded={isCompletionOutputExpanded}
|
||||
onToggle={() => setIsCompletionOutputExpanded(!isCompletionOutputExpanded)}
|
||||
text={text || ""}
|
||||
/>
|
||||
</div>
|
||||
<WithCopyButton
|
||||
onMouseUp={handleMouseUp}
|
||||
position="bottom-right"
|
||||
ref={contentRef}
|
||||
style={{
|
||||
color: "var(--vscode-charts-green)",
|
||||
paddingTop: 10,
|
||||
}}
|
||||
textToCopy={text}>
|
||||
<Markdown markdown={text} />
|
||||
{quoteButtonState.visible && (
|
||||
<QuoteButton
|
||||
left={quoteButtonState.left}
|
||||
onClick={handleQuoteClick}
|
||||
top={quoteButtonState.top}
|
||||
/>
|
||||
)}
|
||||
</WithCopyButton>
|
||||
{message.partial !== true && hasChanges && (
|
||||
<div style={{ marginTop: 15, display: "flex", flexDirection: "column", gap: 8 }}>
|
||||
<SuccessButton
|
||||
appearance="secondary"
|
||||
<div style={{ marginTop: 15, display: "flex", flexDirection: "row", gap: 8 }}>
|
||||
<button
|
||||
disabled={seeNewChangesDisabled}
|
||||
onClick={() => {
|
||||
setSeeNewChangesDisabled(true)
|
||||
@@ -2016,19 +2189,29 @@ export const ChatRowContent = memo(
|
||||
).catch((err) =>
|
||||
console.error("Failed to show task completion view changes:", err),
|
||||
)
|
||||
}}
|
||||
onMouseEnter={() => setViewChangesHovered(true)}
|
||||
onMouseLeave={() => setViewChangesHovered(false)}
|
||||
style={{
|
||||
cursor: seeNewChangesDisabled ? "wait" : "pointer",
|
||||
flex: 1,
|
||||
background: CHAT_ROW_EXPANDED_BG_COLOR,
|
||||
border: `1px solid ${viewChangesHovered ? 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",
|
||||
}}>
|
||||
<i
|
||||
className="codicon codicon-new-file"
|
||||
style={{
|
||||
marginRight: 6,
|
||||
cursor: seeNewChangesDisabled ? "wait" : "pointer",
|
||||
}}
|
||||
/>
|
||||
<i className="codicon codicon-new-file" style={{ marginRight: 6 }} />
|
||||
View Changes
|
||||
</SuccessButton>
|
||||
</button>
|
||||
{PLATFORM_CONFIG.type === PlatformType.VSCODE && (
|
||||
<SuccessButton
|
||||
appearance="secondary"
|
||||
<button
|
||||
disabled={explainChangesDisabled}
|
||||
onClick={() => {
|
||||
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",
|
||||
}}>
|
||||
<i
|
||||
className="codicon codicon-comment-discussion"
|
||||
style={{
|
||||
marginRight: 6,
|
||||
cursor: explainChangesDisabled ? "wait" : "pointer",
|
||||
}}
|
||||
style={{ marginRight: 6 }}
|
||||
/>
|
||||
{explainChangesDisabled ? "Explaining..." : "Explain Changes"}
|
||||
</SuccessButton>
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -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<HTMLDivElement, WithCopyButtonProps>(
|
||||
) => {
|
||||
return (
|
||||
<ContentContainer className={className} onMouseUp={onMouseUp} ref={ref} style={style} {...props}>
|
||||
{children}
|
||||
{(textToCopy || onCopy) && (
|
||||
<ButtonContainer $position={position}>
|
||||
<CopyButton
|
||||
@@ -128,6 +129,7 @@ export const WithCopyButton = forwardRef<HTMLDivElement, WithCopyButtonProps>(
|
||||
/>
|
||||
</ButtonContainer>
|
||||
)}
|
||||
{children}
|
||||
</ContentContainer>
|
||||
)
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user