@@ -22,6 +22,7 @@ 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" ;
2526
2627type FileEditOperationArgs =
2728 | FileEditReplaceStringToolArgs
@@ -49,7 +50,7 @@ function renderDiff(
4950 try {
5051 const patches = parsePatch ( diff ) ;
5152 if ( patches . length === 0 ) {
52- return < div style = { { padding : "8px" , color : "#888 " } } > No changes</ div > ;
53+ return < div style = { { padding : "8px" , color : "var(--color-muted) " } } > No changes</ div > ;
5354 }
5455
5556 // Render each hunk using SelectableDiffRenderer if we have a callback, otherwise DiffRenderer
@@ -99,16 +100,14 @@ export const FileEditToolCall: React.FC<FileEditToolCallProps> = ({
99100} ) => {
100101 const { expanded, toggleExpanded } = useToolExpansion ( true ) ;
101102 const [ showRaw , setShowRaw ] = React . useState ( false ) ;
102- const [ copied , setCopied ] = React . useState ( false ) ;
103+ const { copied, copy } = useClipboard ( ) ;
103104
104105 const filePath = "file_path" in args ? args . file_path : undefined ;
105106
106107 const handleCopyPatch = async ( ) => {
107108 if ( result && result . success && result . diff ) {
108109 try {
109- await navigator . clipboard . writeText ( result . diff ) ;
110- setCopied ( true ) ;
111- setTimeout ( ( ) => setCopied ( false ) , 2000 ) ;
110+ await copy ( result . diff ) ;
112111 } catch ( err ) {
113112 console . error ( "Failed to copy:" , err ) ;
114113 }
0 commit comments