Spaces:
Build error
Build error
Upload components/ProjectTable.jsx with huggingface_hub
Browse files- components/ProjectTable.jsx +107 -0
components/ProjectTable.jsx
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React from 'react';
|
| 2 |
+
import { MoreHorizontal, AlertCircle, CheckCircle, Clock, PauseCircle } from 'lucide-react';
|
| 3 |
+
|
| 4 |
+
const statusConfig = {
|
| 5 |
+
'In Progress': { color: 'bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300', icon: Clock },
|
| 6 |
+
'Planning': { color: 'bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300', icon: AlertCircle },
|
| 7 |
+
'Review': { color: 'bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300', icon: CheckCircle },
|
| 8 |
+
'On Hold': { color: 'bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300', icon: PauseCircle },
|
| 9 |
+
'Completed': { color: 'bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300', icon: CheckCircle },
|
| 10 |
+
};
|
| 11 |
+
|
| 12 |
+
const priorityConfig = {
|
| 13 |
+
'High': 'text-red-600 bg-red-50 dark:bg-red-900/20 dark:text-red-400',
|
| 14 |
+
'Medium': 'text-orange-600 bg-orange-50 dark:bg-orange-900/20 dark:text-orange-400',
|
| 15 |
+
'Low': 'text-green-600 bg-green-50 dark:bg-green-900/20 dark:text-green-400',
|
| 16 |
+
'Critical': 'text-red-800 bg-red-100 dark:bg-red-900/40 dark:text-red-200 font-bold',
|
| 17 |
+
};
|
| 18 |
+
|
| 19 |
+
export default function ProjectTable({ projects, loading }) {
|
| 20 |
+
if (loading) {
|
| 21 |
+
return (
|
| 22 |
+
<div className="space-y-4">
|
| 23 |
+
{[1, 2, 3].map((i) => (
|
| 24 |
+
<div key={i} className="h-20 bg-gray-100 dark:bg-gray-700 rounded animate-pulse"></div>
|
| 25 |
+
))}
|
| 26 |
+
</div>
|
| 27 |
+
);
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
return (
|
| 31 |
+
<div className="overflow-x-auto">
|
| 32 |
+
<table className="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
|
| 33 |
+
<thead>
|
| 34 |
+
<tr>
|
| 35 |
+
<th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:text-gray-400">
|
| 36 |
+
Project Name
|
| 37 |
+
</th>
|
| 38 |
+
<th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:text-gray-400">
|
| 39 |
+
Client
|
| 40 |
+
</th>
|
| 41 |
+
<th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:text-gray-400">
|
| 42 |
+
Deadline
|
| 43 |
+
</th>
|
| 44 |
+
<th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:text-gray-400">
|
| 45 |
+
Status
|
| 46 |
+
</th>
|
| 47 |
+
<th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:text-gray-400">
|
| 48 |
+
Priority
|
| 49 |
+
</th>
|
| 50 |
+
<th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider dark:text-gray-400">
|
| 51 |
+
Progress
|
| 52 |
+
</th>
|
| 53 |
+
<th scope="col" className="relative px-6 py-3">
|
| 54 |
+
<span className="sr-only">Actions</span>
|
| 55 |
+
</th>
|
| 56 |
+
</tr>
|
| 57 |
+
</thead>
|
| 58 |
+
<tbody className="divide-y divide-gray-200 dark:divide-gray-700">
|
| 59 |
+
{projects.map((project) => {
|
| 60 |
+
const StatusIcon = statusConfig[project.status]?.icon || AlertCircle;
|
| 61 |
+
return (
|
| 62 |
+
<tr key={project.id} className="hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors">
|
| 63 |
+
<td className="px-6 py-4 whitespace-nowrap">
|
| 64 |
+
<div className="text-sm font-medium text-gray-900 dark:text-white">
|
| 65 |
+
{project.name}
|
| 66 |
+
</div>
|
| 67 |
+
<div className="text-xs text-gray-500">{project.budget}</div>
|
| 68 |
+
</td>
|
| 69 |
+
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">
|
| 70 |
+
{project.client}
|
| 71 |
+
</td>
|
| 72 |
+
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">
|
| 73 |
+
{project.deadline}
|
| 74 |
+
</td>
|
| 75 |
+
<td className="px-6 py-4 whitespace-nowrap">
|
| 76 |
+
<span className={`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${statusConfig[project.status]?.color}`}>
|
| 77 |
+
<StatusIcon className="w-3 h-3 mr-1" />
|
| 78 |
+
{project.status}
|
| 79 |
+
</span>
|
| 80 |
+
</td>
|
| 81 |
+
<td className="px-6 py-4 whitespace-nowrap text-sm">
|
| 82 |
+
<span className={`px-2 py-1 rounded text-xs font-medium ${priorityConfig[project.priority]}`}>
|
| 83 |
+
{project.priority}
|
| 84 |
+
</span>
|
| 85 |
+
</td>
|
| 86 |
+
<td className="px-6 py-4 whitespace-nowrap">
|
| 87 |
+
<div className="w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700">
|
| 88 |
+
<div
|
| 89 |
+
className="bg-primary-600 h-2.5 rounded-full"
|
| 90 |
+
style={{ width: `${project.progress}%` }}
|
| 91 |
+
></div>
|
| 92 |
+
</div>
|
| 93 |
+
<span className="text-xs text-gray-500 mt-1 block">{project.progress}%</span>
|
| 94 |
+
</td>
|
| 95 |
+
<td className="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
| 96 |
+
<button className="text-gray-400 hover:text-gray-500 dark:hover:text-gray-300">
|
| 97 |
+
<MoreHorizontal className="w-5 h-5" />
|
| 98 |
+
</button>
|
| 99 |
+
</td>
|
| 100 |
+
</tr>
|
| 101 |
+
);
|
| 102 |
+
})}
|
| 103 |
+
</tbody>
|
| 104 |
+
</table>
|
| 105 |
+
</div>
|
| 106 |
+
);
|
| 107 |
+
}
|