1
1
import React , { useState , useEffect } from 'react' ;
2
2
import { motion , AnimatePresence } from 'framer-motion' ;
3
- import { Bot , Loader2 , Play , Clock , CheckCircle , XCircle , Trash2 , Import , ChevronDown , ChevronRight , FileJson , Globe , Download , Plus , History } from 'lucide-react' ;
3
+ import { Bot , Loader2 , Play , Clock , CheckCircle , XCircle , Trash2 , Import , ChevronDown , ChevronRight , FileJson , Globe , Download , Plus , History , Edit } from 'lucide-react' ;
4
4
import {
5
5
DropdownMenu ,
6
6
DropdownMenuContent ,
@@ -22,6 +22,7 @@ import { useTabState } from '@/hooks/useTabState';
22
22
export const Agents : React . FC = ( ) => {
23
23
const [ activeTab , setActiveTab ] = useState ( 'agents' ) ;
24
24
const [ showCreateAgent , setShowCreateAgent ] = useState ( false ) ;
25
+ const [ editingAgent , setEditingAgent ] = useState < Agent | null > ( null ) ;
25
26
const [ agents , setAgents ] = useState < Agent [ ] > ( [ ] ) ;
26
27
const [ runningAgents , setRunningAgents ] = useState < AgentRunWithMetrics [ ] > ( [ ] ) ;
27
28
const [ loading , setLoading ] = useState ( true ) ;
@@ -184,6 +185,20 @@ export const Agents: React.FC = () => {
184
185
) ;
185
186
}
186
187
188
+ // Show CreateAgent component in edit mode
189
+ if ( editingAgent ) {
190
+ return (
191
+ < CreateAgent
192
+ agent = { editingAgent }
193
+ onBack = { ( ) => setEditingAgent ( null ) }
194
+ onAgentCreated = { ( ) => {
195
+ setEditingAgent ( null ) ;
196
+ loadAgents ( ) ; // Reload agents after update
197
+ } }
198
+ />
199
+ ) ;
200
+ }
201
+
187
202
return (
188
203
< div className = "h-full overflow-y-auto" >
189
204
< div className = "max-w-6xl mx-auto flex flex-col h-full" >
@@ -344,6 +359,10 @@ export const Agents: React.FC = () => {
344
359
</ Button >
345
360
</ DropdownMenuTrigger >
346
361
< DropdownMenuContent align = "end" >
362
+ < DropdownMenuItem onClick = { ( ) => setEditingAgent ( agent ) } >
363
+ < Edit className = "w-4 h-4 mr-2" />
364
+ Edit
365
+ </ DropdownMenuItem >
347
366
< DropdownMenuItem onClick = { ( ) => handleRunAgent ( agent ) } >
348
367
< Play className = "w-4 h-4 mr-2" />
349
368
Run
0 commit comments