@@ -22,6 +22,8 @@ import { useToolExpansion, getStatusDisplay, type ToolStatus } from "./shared/to
2222import { TooltipWrapper , Tooltip } from "../Tooltip" ;
2323import { DiffContainer , DiffRenderer , SelectableDiffRenderer } from "../shared/DiffRenderer" ;
2424import { KebabMenu , type KebabMenuItem } from "../KebabMenu" ;
25+ import { useClipboard } from "@/utils/ui/clipboard" ;
26+ import { UI_TEXT } from "@/constants/ui" ;
2527
2628type FileEditOperationArgs =
2729 | FileEditReplaceStringToolArgs
@@ -49,7 +51,7 @@ function renderDiff(
4951 try {
5052 const patches = parsePatch ( diff ) ;
5153 if ( patches . length === 0 ) {
52- return < div style = { { padding : "8px" , color : "#888 " } } > No changes</ div > ;
54+ return < div style = { { padding : "8px" , color : "var(--color-muted) " } } > No changes</ div > ;
5355 }
5456
5557 // Render each hunk using SelectableDiffRenderer if we have a callback, otherwise DiffRenderer
@@ -99,16 +101,14 @@ export const FileEditToolCall: React.FC<FileEditToolCallProps> = ({
99101} ) => {
100102 const { expanded, toggleExpanded } = useToolExpansion ( true ) ;
101103 const [ showRaw , setShowRaw ] = React . useState ( false ) ;
102- const [ copied , setCopied ] = React . useState ( false ) ;
104+ const { copied, copy } = useClipboard ( ) ;
103105
104106 const filePath = "file_path" in args ? args . file_path : undefined ;
105107
106108 const handleCopyPatch = async ( ) => {
107109 if ( result && result . success && result . diff ) {
108110 try {
109- await navigator . clipboard . writeText ( result . diff ) ;
110- setCopied ( true ) ;
111- setTimeout ( ( ) => setCopied ( false ) , 2000 ) ;
111+ await copy ( result . diff ) ;
112112 } catch ( err ) {
113113 console . error ( "Failed to copy:" , err ) ;
114114 }
@@ -120,7 +120,7 @@ export const FileEditToolCall: React.FC<FileEditToolCallProps> = ({
120120 result && result . success && result . diff
121121 ? [
122122 {
123- label : copied ? "✓ Copied" : "Copy Patch" ,
123+ label : copied ? `✓ ${ UI_TEXT . COPIED } ` : "Copy Patch" ,
124124 onClick : ( ) => void handleCopyPatch ( ) ,
125125 } ,
126126 {
0 commit comments