Spaces:
Build error
Build error
Upload components/Results.jsx with huggingface_hub
Browse files- components/Results.jsx +73 -0
components/Results.jsx
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { FiUser, FiBriefcase, FiMapPin, FiAlertCircle } from 'react-icons/fi';
|
| 2 |
+
|
| 3 |
+
export default function Results({ data, loading, error }) {
|
| 4 |
+
if (loading) {
|
| 5 |
+
return (
|
| 6 |
+
<div className="text-center py-8">
|
| 7 |
+
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto mb-4"></div>
|
| 8 |
+
<p className="text-gray-600">Carregando dados...</p>
|
| 9 |
+
</div>
|
| 10 |
+
);
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
if (error) {
|
| 14 |
+
return (
|
| 15 |
+
<div className="bg-red-50 border-l-4 border-red-500 p-4 rounded-md">
|
| 16 |
+
<div className="flex">
|
| 17 |
+
<div className="flex-shrink-0">
|
| 18 |
+
<FiAlertCircle className="h-5 w-5 text-red-500" />
|
| 19 |
+
</div>
|
| 20 |
+
<div className="ml-3">
|
| 21 |
+
<p className="text-red-700">{error}</p>
|
| 22 |
+
</div>
|
| 23 |
+
</div>
|
| 24 |
+
</div>
|
| 25 |
+
);
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
if (!data || data.length === 0) {
|
| 29 |
+
return (
|
| 30 |
+
<div className="text-center py-8 text-gray-500">
|
| 31 |
+
<FiAlertCircle className="mx-auto h-12 w-12 mb-4" />
|
| 32 |
+
<p>Nenhum resultado encontrado</p>
|
| 33 |
+
</div>
|
| 34 |
+
);
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
return (
|
| 38 |
+
<div className="space-y-4">
|
| 39 |
+
{data.map((agent, index) => (
|
| 40 |
+
<div key={index} className="bg-white rounded-lg shadow-md p-6 hover:shadow-lg transition-shadow">
|
| 41 |
+
<div className="flex flex-col md:flex-row md:items-center md:justify-between">
|
| 42 |
+
<div className="flex items-center space-x-4 mb-4 md:mb-0">
|
| 43 |
+
<div className="bg-primary text-white rounded-full h-12 w-12 flex items-center justify-center font-bold text-xl">
|
| 44 |
+
{agent.name.charAt(0)}
|
| 45 |
+
</div>
|
| 46 |
+
<div>
|
| 47 |
+
<h3 className="text-lg font-semibold text-gray-900 flex items-center">
|
| 48 |
+
<FiUser className="mr-2" /> {agent.name}
|
| 49 |
+
</h3>
|
| 50 |
+
<p className="text-gray-600 flex items-center">
|
| 51 |
+
<FiBriefcase className="mr-2" /> {agent.position}
|
| 52 |
+
</p>
|
| 53 |
+
</div>
|
| 54 |
+
</div>
|
| 55 |
+
<div className="text-right">
|
| 56 |
+
<p className="text-gray-600 flex items-center justify-end md:justify-start">
|
| 57 |
+
<FiMapPin className="mr-2" /> {agent.location}
|
| 58 |
+
</p>
|
| 59 |
+
<span className={`inline-block px-2 py-1 rounded-full text-xs font-medium ${agent.status === 'ativo' ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800'}`}>
|
| 60 |
+
{agent.status}
|
| 61 |
+
</span>
|
| 62 |
+
</div>
|
| 63 |
+
</div>
|
| 64 |
+
{agent.details && (
|
| 65 |
+
<div className="mt-4 pt-4 border-t border-gray-200">
|
| 66 |
+
<p className="text-gray-700">{agent.details}</p>
|
| 67 |
+
</div>
|
| 68 |
+
)}
|
| 69 |
+
</div>
|
| 70 |
+
))}
|
| 71 |
+
</div>
|
| 72 |
+
);
|
| 73 |
+
}
|