@@ -8,6 +8,7 @@ import { cn, fireAndForget } from "@/util/util";
88import { useAtomValue } from "jotai" ;
99import { memo , useEffect , useRef , useState } from "react" ;
1010import { WaveUIMessagePart } from "./aitypes" ;
11+ import { RestoreBackupModal } from "./restorebackupmodal" ;
1112import { WaveAIModel } from "./waveai-model" ;
1213
1314// matches pkg/filebackup/filebackup.go
@@ -180,7 +181,7 @@ const AIToolUseBatch = memo(({ parts, isStreaming }: AIToolUseBatchProps) => {
180181 } ;
181182
182183 return (
183- < div className = "flex items-start gap-2 p-2 rounded bg-gray -800 border border-gray -700" >
184+ < div className = "flex items-start gap-2 p-2 rounded bg-zinc -800/60 border border-zinc -700" >
184185 < div className = "flex-1" >
185186 < div className = "font-semibold" > Reading Files</ div >
186187 < div className = "mt-1 space-y-0.5" >
@@ -198,94 +199,6 @@ const AIToolUseBatch = memo(({ parts, isStreaming }: AIToolUseBatchProps) => {
198199
199200AIToolUseBatch . displayName = "AIToolUseBatch" ;
200201
201- interface RestoreBackupModalProps {
202- part : WaveUIMessagePart & { type : "data-tooluse" } ;
203- }
204-
205- const RestoreBackupModal = memo ( ( { part } : RestoreBackupModalProps ) => {
206- const model = WaveAIModel . getInstance ( ) ;
207- const toolData = part . data ;
208- const status = useAtomValue ( model . restoreBackupStatus ) ;
209- const error = useAtomValue ( model . restoreBackupError ) ;
210-
211- const formatTimestamp = ( ts : number ) => {
212- if ( ! ts ) return "" ;
213- const date = new Date ( ts ) ;
214- return date . toLocaleString ( ) ;
215- } ;
216-
217- const handleConfirm = ( ) => {
218- recordTEvent ( "waveai:revertfile" , { "waveai:action" : "revertfile:confirm" } ) ;
219- model . restoreBackup ( toolData . toolcallid , toolData . writebackupfilename , toolData . inputfilename ) ;
220- } ;
221-
222- const handleCancel = ( ) => {
223- recordTEvent ( "waveai:revertfile" , { "waveai:action" : "revertfile:cancel" } ) ;
224- model . closeRestoreBackupModal ( ) ;
225- } ;
226-
227- const handleClose = ( ) => {
228- model . closeRestoreBackupModal ( ) ;
229- } ;
230-
231- if ( status === "success" ) {
232- return (
233- < Modal className = "restore-backup-modal pb-5 pr-5" onClose = { handleClose } onOk = { handleClose } okLabel = "Close" >
234- < div className = "flex flex-col gap-4 pt-4 pb-4 max-w-xl" >
235- < div className = "font-semibold text-lg text-green-500" > Backup Successfully Restored</ div >
236- < div className = "text-sm text-gray-300 leading-relaxed" >
237- The file < span className = "font-mono text-white break-all" > { toolData . inputfilename } </ span > has
238- been restored to its previous state.
239- </ div >
240- </ div >
241- </ Modal >
242- ) ;
243- }
244-
245- if ( status === "error" ) {
246- return (
247- < Modal className = "restore-backup-modal pb-5 pr-5" onClose = { handleClose } onOk = { handleClose } okLabel = "Close" >
248- < div className = "flex flex-col gap-4 pt-4 pb-4 max-w-xl" >
249- < div className = "font-semibold text-lg text-red-500" > Failed to Restore Backup</ div >
250- < div className = "text-sm text-gray-300 leading-relaxed" >
251- An error occurred while restoring the backup:
252- </ div >
253- < div className = "text-sm text-red-400 font-mono bg-gray-800 p-3 rounded break-all" > { error } </ div >
254- </ div >
255- </ Modal >
256- ) ;
257- }
258-
259- const isProcessing = status === "processing" ;
260-
261- return (
262- < Modal
263- className = "restore-backup-modal pb-5 pr-5"
264- onClose = { handleCancel }
265- onCancel = { handleCancel }
266- onOk = { handleConfirm }
267- okLabel = { isProcessing ? "Restoring..." : "Confirm Restore" }
268- cancelLabel = "Cancel"
269- okDisabled = { isProcessing }
270- cancelDisabled = { isProcessing }
271- >
272- < div className = "flex flex-col gap-4 pt-4 pb-4 max-w-xl" >
273- < div className = "font-semibold text-lg" > Restore File Backup</ div >
274- < div className = "text-sm text-gray-300 leading-relaxed" >
275- This will restore < span className = "font-mono text-white break-all" > { toolData . inputfilename } </ span > { " " }
276- to its state before this edit was made
277- { toolData . runts && < span > ({ formatTimestamp ( toolData . runts ) } )</ span > } .
278- </ div >
279- < div className = "text-sm text-gray-300 leading-relaxed" >
280- Any changes made by this edit and subsequent edits will be lost.
281- </ div >
282- </ div >
283- </ Modal >
284- ) ;
285- } ) ;
286-
287- RestoreBackupModal . displayName = "RestoreBackupModal" ;
288-
289202interface AIToolUseProps {
290203 part : WaveUIMessagePart & { type : "data-tooluse" } ;
291204 isStreaming : boolean ;
@@ -381,7 +294,7 @@ const AIToolUse = memo(({ part, isStreaming }: AIToolUseProps) => {
381294
382295 return (
383296 < div
384- className = { cn ( "flex flex-col gap-1 p-2 rounded bg-gray -800 border border-gray -700" , statusColor ) }
297+ className = { cn ( "flex flex-col gap-1 p-2 rounded bg-zinc -800/60 border border-zinc -700" , statusColor ) }
385298 onMouseEnter = { handleMouseEnter }
386299 onMouseLeave = { handleMouseLeave }
387300 >
@@ -399,7 +312,7 @@ const AIToolUse = memo(({ part, isStreaming }: AIToolUseProps) => {
399312 recordTEvent ( "waveai:revertfile" , { "waveai:action" : "revertfile:open" } ) ;
400313 model . openRestoreBackupModal ( toolData . toolcallid ) ;
401314 } }
402- className = "flex-shrink-0 px-1.5 py-0.5 border border-gray -600 hover:border-gray -500 hover:bg-gray -700 rounded cursor-pointer transition-colors flex items-center gap-1 text-gray -400"
315+ className = "flex-shrink-0 px-1.5 py-0.5 border border-zinc -600 hover:border-zinc -500 hover:bg-zinc -700 rounded cursor-pointer transition-colors flex items-center gap-1 text-zinc -400"
403316 title = "Restore backup file"
404317 >
405318 < span className = "text-xs" > Revert File</ span >
@@ -409,7 +322,7 @@ const AIToolUse = memo(({ part, isStreaming }: AIToolUseProps) => {
409322 { isFileWriteTool && toolData . inputfilename && (
410323 < button
411324 onClick = { handleOpenDiff }
412- className = "flex-shrink-0 px-1.5 py-0.5 border border-gray -600 hover:border-gray -500 hover:bg-gray -700 rounded cursor-pointer transition-colors flex items-center gap-1 text-gray -400"
325+ className = "flex-shrink-0 px-1.5 py-0.5 border border-zinc -600 hover:border-zinc -500 hover:bg-zinc -700 rounded cursor-pointer transition-colors flex items-center gap-1 text-zinc -400"
413326 title = "Open in diff viewer"
414327 >
415328 < span className = "text-xs" > Show Diff</ span >
@@ -441,7 +354,7 @@ const AIToolProgress = memo(({ part }: AIToolProgressProps) => {
441354 const progressData = part . data ;
442355
443356 return (
444- < div className = "flex flex-col gap-1 p-2 rounded bg-gray -800 border border-gray -700" >
357+ < div className = "flex flex-col gap-1 p-2 rounded bg-zinc -800/60 border border-zinc -700" >
445358 < div className = "flex items-center gap-2" >
446359 < i className = "fa fa-spinner fa-spin text-gray-400" > </ i >
447360 < div className = "font-semibold" > { progressData . toolname } </ div >
0 commit comments