Create src/components/ProjectWorkspace.tsx
Browse files
src/components/ProjectWorkspace.tsx
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React from 'react';
|
| 2 |
+
import { FolderOpen, FileText, Calendar, ArrowRight } from 'lucide-react';
|
| 3 |
+
|
| 4 |
+
export const ProjectWorkspace = ({ projects, activeProjectId, setActiveProject, t }) => {
|
| 5 |
+
const activeProject = projects.find(p => p.id === activeProjectId);
|
| 6 |
+
|
| 7 |
+
return (
|
| 8 |
+
<div className="space-y-6">
|
| 9 |
+
<div className="bg-white p-6 rounded-2xl border border-slate-200 shadow-sm">
|
| 10 |
+
<h2 className="text-2xl font-bold text-slate-900 mb-2">{t.navProjects}</h2>
|
| 11 |
+
<p className="text-slate-500 text-sm">إدارة المسودات والمشاريع البحثية القائمة</p>
|
| 12 |
+
</div>
|
| 13 |
+
|
| 14 |
+
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
|
| 15 |
+
{/* قائمة المشاريع على اليمين */}
|
| 16 |
+
<div className="md:col-span-1 space-y-4">
|
| 17 |
+
{projects.map((project) => (
|
| 18 |
+
<div
|
| 19 |
+
key={project.id}
|
| 20 |
+
onClick={() => setActiveProject(project.id)}
|
| 21 |
+
className={`p-4 rounded-xl border cursor-pointer transition-all ${
|
| 22 |
+
activeProjectId === project.id
|
| 23 |
+
? 'border-emerald-500 bg-emerald-50 ring-1 ring-emerald-500'
|
| 24 |
+
: 'border-slate-200 bg-white hover:border-emerald-300'
|
| 25 |
+
}`}
|
| 26 |
+
>
|
| 27 |
+
<div className="flex items-center gap-3 mb-2">
|
| 28 |
+
<FolderOpen className={`w-5 h-5 ${activeProjectId === project.id ? 'text-emerald-600' : 'text-slate-400'}`} />
|
| 29 |
+
<h3 className="font-bold text-slate-900 truncate">{project.name}</h3>
|
| 30 |
+
</div>
|
| 31 |
+
<div className="flex items-center text-[10px] text-slate-400 gap-2">
|
| 32 |
+
<Calendar className="w-3 h-3" />
|
| 33 |
+
{new Date(project.createdAt).toLocaleDateString('ar-EG')}
|
| 34 |
+
</div>
|
| 35 |
+
</div>
|
| 36 |
+
))}
|
| 37 |
+
</div>
|
| 38 |
+
|
| 39 |
+
{/* تفاصيل المشروع المختار */}
|
| 40 |
+
<div className="md:col-span-2">
|
| 41 |
+
{activeProject ? (
|
| 42 |
+
<div className="bg-white rounded-2xl border border-slate-200 min-h-[400px] flex flex-col">
|
| 43 |
+
<div className="p-6 border-b border-slate-100">
|
| 44 |
+
<h2 className="text-xl font-bold text-slate-900">{activeProject.name}</h2>
|
| 45 |
+
<p className="text-slate-500 text-sm mt-1">{activeProject.description}</p>
|
| 46 |
+
</div>
|
| 47 |
+
|
| 48 |
+
<div className="p-12 text-center flex-grow flex flex-col items-center justify-center space-y-4">
|
| 49 |
+
<div className="w-16 h-16 bg-slate-50 rounded-full flex items-center justify-center">
|
| 50 |
+
<FileText className="w-8 h-8 text-slate-300" />
|
| 51 |
+
</div>
|
| 52 |
+
<div className="max-w-xs">
|
| 53 |
+
<h3 className="font-bold text-slate-900 mb-1">المسودة فارغة</h3>
|
| 54 |
+
<p className="text-sm text-slate-500">
|
| 55 |
+
ابدأ بالبحث في "الباحث الذكي" وقم بتحويل المحادثات إلى هذا المشروع.
|
| 56 |
+
</p>
|
| 57 |
+
</div>
|
| 58 |
+
</div>
|
| 59 |
+
</div>
|
| 60 |
+
) : (
|
| 61 |
+
<div className="h-full flex items-center justify-center border-2 border-dashed border-slate-200 rounded-2xl p-12 text-slate-400">
|
| 62 |
+
اختر مشروعاً من القائمة أو ابدأ بحثاً جديداً
|
| 63 |
+
</div>
|
| 64 |
+
)}
|
| 65 |
+
</div>
|
| 66 |
+
</div>
|
| 67 |
+
</div>
|
| 68 |
+
);
|
| 69 |
+
};
|