File size: 2,285 Bytes
c3bf538 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
import React from 'react';
import { LoaderCircle, CheckCircle2, XCircle, FileClock, Database, Search, Bot } from 'lucide-react';
function JobStatusCard({ job }) {
const getStatusInfo = (status) => {
const statusMap = {
'PENDING': {
icon: <FileClock className="w-8 h-8 text-yellow-400" />,
text: 'Your analysis is in the queue.',
bgColor: 'bg-yellow-900/50 border-yellow-400/30',
},
'DATA_FETCHING': {
icon: <Database className="w-8 h-8 text-blue-400 animate-pulse" />,
text: 'Agent 1: Data Agent is fetching fundamentals...',
bgColor: 'bg-blue-900/50 border-blue-400/30',
},
'INTELLIGENCE_GATHERING': {
icon: <Search className="w-8 h-8 text-blue-400 animate-pulse" />,
text: 'Agent 2: Intelligence Agent is scanning news...',
bgColor: 'bg-blue-900/50 border-blue-400/30',
},
'ANALYZING': {
icon: <Bot className="w-8 h-8 text-blue-400 animate-spin" />,
text: 'Agent 3: Analyst Agent is generating a report with Gemini...',
bgColor: 'bg-blue-900/50 border-blue-400/30',
},
'SUCCESS': {
icon: <CheckCircle2 className="w-8 h-8 text-green-400" />,
text: 'All agents have completed their tasks!',
bgColor: 'bg-green-900/50 border-green-400/30',
},
'FAILED': {
icon: <XCircle className="w-8 h-8 text-red-400" />,
text: `Analysis failed. See error below.`,
bgColor: 'bg-red-900/50 border-red-400/30',
}
};
return statusMap[status] || {
icon: <FileClock className="w-8 h-8 text-gray-400" />,
text: 'Waiting for status...',
bgColor: 'bg-gray-800 border-gray-600',
};
};
const statusInfo = getStatusInfo(job.status);
return (
<div className="my-8">
<div className={`p-6 rounded-lg border flex items-center space-x-4 transition-all duration-500 ${statusInfo.bgColor}`}>
<div className="flex-shrink-0">
{statusInfo.icon}
</div>
<div>
<p className="font-bold text-lg text-gray-200">
Analysis for {job.ticker}
</p>
<p className="text-gray-400">{statusInfo.text}</p>
</div>
</div>
</div>
);
}
export default JobStatusCard; |