({ currentWorkflow, isLoading })
| 2 | import { FileText, CheckCircle2, Circle, Loader2, Presentation, Image as ImageIcon } from 'lucide-react' |
| 3 | |
| 4 | const WorkflowPanel = ({ currentWorkflow, isLoading }) => { |
| 5 | const [workflow, setWorkflow] = useState(null) |
| 6 | |
| 7 | useEffect(() => { |
| 8 | if (currentWorkflow) { |
| 9 | setWorkflow(currentWorkflow) |
| 10 | } |
| 11 | }, [currentWorkflow]) |
| 12 | |
| 13 | // Default workflow stages |
| 14 | const defaultStages = [ |
| 15 | { id: 'RAG', name: 'RAG', status: 'pending', description: 'Index documents and run RAG queries ...' }, |
| 16 | { id: 'Summary', name: 'Summary', status: 'pending', description: 'Summarize key content from RAG results ...' }, |
| 17 | { id: 'Plan', name: 'Plan', status: 'pending', description: 'Plan the generation ...' }, |
| 18 | { id: 'Generate', name: 'Generate', status: 'pending', description: 'Generate ...' } |
| 19 | ] |
| 20 | |
| 21 | const stages = workflow?.stages || defaultStages |
| 22 | |
| 23 | const getStageIcon = (status) => { |
| 24 | switch (status) { |
| 25 | case 'completed': |
| 26 | return <CheckCircle2 className="w-5 h-5 text-green-600 dark:text-green-400" /> |
| 27 | case 'active': |
| 28 | return <Loader2 className="w-5 h-5 text-blue-600 dark:text-blue-400 animate-spin" /> |
| 29 | default: |
| 30 | return <Circle className="w-5 h-5 text-gray-300 dark:text-gray-600" /> |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | return ( |
| 35 | <div className="h-full flex flex-col bg-white dark:bg-gray-900 rounded-2xl shadow-xl overflow-hidden"> |
| 36 | {/* Header - Fixed height for alignment */} |
| 37 | <div className="flex items-center justify-between px-6 border-b border-gray-100 dark:border-gray-800 bg-white dark:bg-gray-900 h-[72px] flex-shrink-0"> |
| 38 | <div className="flex items-center gap-2"> |
| 39 | {isLoading ? ( |
| 40 | <Loader2 className="w-5 h-5 text-purple-600 dark:text-purple-400 animate-spin" /> |
| 41 | ) : ( |
| 42 | <Presentation className="w-5 h-5 text-purple-600 dark:text-purple-400" /> |
| 43 | )} |
| 44 | <h2 className="text-lg font-semibold text-gray-900 dark:text-gray-100"> |
| 45 | Workflow Status |
| 46 | </h2> |
| 47 | </div> |
| 48 | <span className={`text-xs font-medium px-3 py-1 rounded-full ${ |
| 49 | isLoading |
| 50 | ? 'bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-300' |
| 51 | : 'bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300' |
| 52 | }`}> |
| 53 | {isLoading ? 'Processing' : 'Ready'} |
| 54 | </span> |
| 55 | </div> |
| 56 | |
| 57 | {/* Content */} |
| 58 | <div className="flex-1 overflow-y-auto p-4"> |
| 59 | {!isLoading && !workflow ? ( |
| 60 | <div className="flex flex-col items-center justify-center h-full text-center"> |
| 61 | <div className="w-16 h-16 rounded-full bg-gray-100 dark:bg-gray-800 flex items-center justify-center mb-4"> |
nothing calls this directly
no test coverage detected