Skip to content

Commit eb4bd66

Browse files
author
Merge Resolver
committed
refactor(webview-ui): replace VSCodeButton with IconButton in ChatRow error/diff_error copy controls; use StandardTooltip with i18n; remove unused import
1 parent ae8e4d8 commit eb4bd66

File tree

1 file changed

+16
-45
lines changed

1 file changed

+16
-45
lines changed

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

Lines changed: 16 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { McpExecution } from "./McpExecution"
44
import { useSize } from "react-use"
55
import { useTranslation, Trans } from "react-i18next"
66
import deepEqual from "fast-deep-equal"
7-
import { VSCodeBadge, VSCodeButton } from "@vscode/webview-ui-toolkit/react"
7+
import { VSCodeBadge } from "@vscode/webview-ui-toolkit/react"
88

99
import type { ClineMessage } from "@roo-code/types"
1010
import { Mode } from "@roo/modes"
@@ -33,6 +33,7 @@ import MarkdownBlock from "../common/MarkdownBlock"
3333
import { ReasoningBlock } from "./ReasoningBlock"
3434
import Thumbnails from "../common/Thumbnails"
3535
import McpResourceRow from "../mcp/McpResourceRow"
36+
import { IconButton } from "./IconButton"
3637

3738
import { Mention } from "./Mention"
3839
import { CheckpointSaved } from "./checkpoints/CheckpointSaved"
@@ -895,37 +896,22 @@ export const ChatRowContent = ({
895896
<span style={{ fontWeight: "bold" }}>{t("chat:diffError.title")}</span>
896897
</div>
897898
<div style={{ display: "flex", alignItems: "center" }}>
898-
<VSCodeButton
899-
appearance="icon"
900-
style={{
901-
padding: "3px",
902-
height: "24px",
903-
marginRight: "4px",
904-
color: "var(--vscode-editor-foreground)",
905-
display: "flex",
906-
alignItems: "center",
907-
justifyContent: "center",
908-
background: "transparent",
909-
}}
910-
onClick={(e) => {
899+
<IconButton
900+
iconClass={showCopySuccess ? "codicon-check" : "codicon-copy"}
901+
title={t("chat:codeblock.tooltips.copy_code")}
902+
onClick={(e: React.MouseEvent) => {
911903
e.stopPropagation()
912-
913-
// Call copyWithFeedback and handle the Promise
914904
copyWithFeedback(message.text || "").then((success) => {
915905
if (success) {
916-
// Show checkmark
917906
setShowCopySuccess(true)
918-
919-
// Reset after a brief delay
920907
setTimeout(() => {
921908
setShowCopySuccess(false)
922909
}, 1000)
923910
}
924911
})
925-
}}>
926-
<span
927-
className={`codicon codicon-${showCopySuccess ? "check" : "copy"}`}></span>
928-
</VSCodeButton>
912+
}}
913+
style={{ marginRight: "4px" }}
914+
/>
929915
<span
930916
className={`codicon codicon-chevron-${isDiffErrorExpanded ? "up" : "down"}`}></span>
931917
</div>
@@ -1175,37 +1161,22 @@ export const ChatRowContent = ({
11751161
</span>
11761162
</div>
11771163
<div style={{ display: "flex", alignItems: "center" }}>
1178-
<VSCodeButton
1179-
appearance="icon"
1180-
style={{
1181-
padding: "3px",
1182-
height: "24px",
1183-
marginRight: "4px",
1184-
color: "var(--vscode-editor-foreground)",
1185-
display: "flex",
1186-
alignItems: "center",
1187-
justifyContent: "center",
1188-
background: "transparent",
1189-
}}
1190-
onClick={(e) => {
1164+
<IconButton
1165+
iconClass={showErrorCopySuccess ? "codicon-check" : "codicon-copy"}
1166+
title={t("chat:codeblock.tooltips.copy_code")}
1167+
onClick={(e: React.MouseEvent) => {
11911168
e.stopPropagation()
1192-
1193-
// Call copyWithFeedback and handle the Promise
11941169
copyWithFeedback(message.text || "").then((success) => {
11951170
if (success) {
1196-
// Show checkmark
11971171
setShowErrorCopySuccess(true)
1198-
1199-
// Reset after a brief delay
12001172
setTimeout(() => {
12011173
setShowErrorCopySuccess(false)
12021174
}, 1000)
12031175
}
12041176
})
1205-
}}>
1206-
<span
1207-
className={`codicon codicon-${showErrorCopySuccess ? "check" : "copy"}`}></span>
1208-
</VSCodeButton>
1177+
}}
1178+
style={{ marginRight: "4px" }}
1179+
/>
12091180
<span
12101181
className={`codicon codicon-chevron-${isErrorExpanded ? "up" : "down"}`}></span>
12111182
</div>

0 commit comments

Comments
 (0)