11import { useEffect , useMemo , useRef , useState } from 'react'
22import { Code , FileJson , Trash2 , Wand2 , X } from 'lucide-react'
3- import { Button } from '@/components/ui/button'
4- import {
5- Dialog ,
6- DialogContent ,
7- DialogDescription ,
8- DialogFooter ,
9- DialogHeader ,
10- DialogTitle ,
11- } from '@/components/ui/dialog'
123import {
134 AlertDialog ,
145 AlertDialogAction ,
@@ -19,13 +10,22 @@ import {
1910 AlertDialogHeader ,
2011 AlertDialogTitle ,
2112} from '@/components/ui/alert-dialog'
13+ import { Button } from '@/components/ui/button'
14+ import {
15+ Dialog ,
16+ DialogContent ,
17+ DialogDescription ,
18+ DialogFooter ,
19+ DialogHeader ,
20+ DialogTitle ,
21+ } from '@/components/ui/dialog'
2222import { checkEnvVarTrigger , EnvVarDropdown } from '@/components/ui/env-var-dropdown'
2323import { Label } from '@/components/ui/label'
2424import { checkTagTrigger , TagDropdown } from '@/components/ui/tag-dropdown'
2525import { createLogger } from '@/lib/logs/console-logger'
2626import { cn } from '@/lib/utils'
2727import { useCustomToolsStore } from '@/stores/custom-tools/store'
28- import { useCodeGeneration } from '@/hooks/use-code-generation'
28+ import { useCodeGeneration } from '@/app/w/[id]/ hooks/use-code-generation'
2929import { CodePromptBar } from '../../../../../../../code-prompt-bar/code-prompt-bar'
3030import { CodeEditor } from '../code-editor/code-editor'
3131
@@ -436,30 +436,30 @@ export function CustomToolModal({
436436
437437 const handleDelete = async ( ) => {
438438 if ( ! toolId || ! isEditing ) return
439-
439+
440440 try {
441441 setShowDeleteConfirm ( false )
442-
442+
443443 // Call API to delete the tool
444444 const response = await fetch ( `/api/tools/custom?id=${ toolId } ` , {
445445 method : 'DELETE' ,
446446 } )
447-
447+
448448 if ( ! response . ok ) {
449449 const errorData = await response . json ( ) . catch ( ( ) => ( { } ) )
450450 const errorMessage = errorData . error || response . statusText || 'Failed to delete tool'
451451 throw new Error ( errorMessage )
452452 }
453-
453+
454454 // Remove from local store
455455 removeTool ( toolId )
456456 logger . info ( `Deleted tool: ${ toolId } ` )
457-
457+
458458 // Notify parent component if callback provided
459459 if ( onDelete ) {
460460 onDelete ( toolId )
461461 }
462-
462+
463463 // Close the modal
464464 handleClose ( )
465465 } catch ( error ) {
@@ -489,7 +489,10 @@ export function CustomToolModal({
489489 return (
490490 < >
491491 < Dialog open = { open } onOpenChange = { handleClose } >
492- < DialogContent className = "sm:max-w-[700px] h-[80vh] flex flex-col p-0 gap-0" hideCloseButton >
492+ < DialogContent
493+ className = "sm:max-w-[700px] h-[80vh] flex flex-col p-0 gap-0"
494+ hideCloseButton
495+ >
493496 < DialogHeader className = "px-6 py-4 border-b" >
494497 < div className = "flex items-center justify-between" >
495498 < DialogTitle className = "text-lg font-medium" >
@@ -786,20 +789,23 @@ export function CustomToolModal({
786789 </ DialogFooter >
787790 </ DialogContent >
788791 </ Dialog >
789-
792+
790793 { /* Delete Confirmation Dialog */ }
791794 < AlertDialog open = { showDeleteConfirm } onOpenChange = { setShowDeleteConfirm } >
792795 < AlertDialogContent >
793796 < AlertDialogHeader >
794797 < AlertDialogTitle > Are you sure you want to delete this tool?</ AlertDialogTitle >
795798 < AlertDialogDescription >
796- This action cannot be undone. This will permanently delete the tool
797- and remove it from any workflows that are using it.
799+ This action cannot be undone. This will permanently delete the tool and remove it from
800+ any workflows that are using it.
798801 </ AlertDialogDescription >
799802 </ AlertDialogHeader >
800803 < AlertDialogFooter >
801804 < AlertDialogCancel > Cancel</ AlertDialogCancel >
802- < AlertDialogAction onClick = { handleDelete } className = "bg-destructive text-destructive-foreground hover:bg-destructive/90" >
805+ < AlertDialogAction
806+ onClick = { handleDelete }
807+ className = "bg-destructive text-destructive-foreground hover:bg-destructive/90"
808+ >
803809 Delete
804810 </ AlertDialogAction >
805811 </ AlertDialogFooter >
0 commit comments