Spaces:
Build error
Build error
Upload components/ThreadList.js with huggingface_hub
Browse files- components/ThreadList.js +57 -0
components/ThreadList.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Check, ExternalLink, Hash, Quote } from 'lucide-react';
|
| 2 |
+
|
| 3 |
+
export default function ThreadList({ threads, selectedIds, onSelect }) {
|
| 4 |
+
return (
|
| 5 |
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
| 6 |
+
{threads.map((thread) => {
|
| 7 |
+
const isSelected = selectedIds.includes(thread.id);
|
| 8 |
+
|
| 9 |
+
return (
|
| 10 |
+
<div
|
| 11 |
+
key={thread.id}
|
| 12 |
+
onClick={() => onSelect(thread.id)}
|
| 13 |
+
className={`
|
| 14 |
+
relative p-5 rounded-xl border transition-all duration-200 cursor-pointer group
|
| 15 |
+
${isSelected
|
| 16 |
+
? 'bg-blue-900/20 border-blue-500/50 shadow-[0_0_15px_rgba(59,130,246,0.15)]'
|
| 17 |
+
: 'bg-slate-800 border-slate-700 hover:border-slate-500 hover:bg-slate-750'}
|
| 18 |
+
`}
|
| 19 |
+
>
|
| 20 |
+
{/* Selection Indicator */}
|
| 21 |
+
<div className={`
|
| 22 |
+
absolute top-4 right-4 w-6 h-6 rounded-full border flex items-center justify-center transition-colors
|
| 23 |
+
${isSelected ? 'bg-blue-500 border-blue-500' : 'bg-slate-900 border-slate-600 group-hover:border-slate-400'}
|
| 24 |
+
`}>
|
| 25 |
+
{isSelected && <Check size={14} className="text-white" />}
|
| 26 |
+
</div>
|
| 27 |
+
|
| 28 |
+
<div className="mb-3">
|
| 29 |
+
<h3 className="text-lg font-semibold text-white mb-1 line-clamp-2">{thread.title}</h3>
|
| 30 |
+
<div className="flex items-center gap-2 text-xs text-slate-400 mb-2">
|
| 31 |
+
<span className="bg-slate-900 px-2 py-0.5 rounded">{thread.date}</span>
|
| 32 |
+
</div>
|
| 33 |
+
</div>
|
| 34 |
+
|
| 35 |
+
<div className="bg-slate-900/50 p-3 rounded-lg mb-4 border border-slate-800">
|
| 36 |
+
<div className="flex items-start gap-2">
|
| 37 |
+
<Quote size={16} className="text-slate-500 mt-0.5 shrink-0" />
|
| 38 |
+
<p className="text-sm text-slate-300 italic line-clamp-2">"{thread.query}"</p>
|
| 39 |
+
</div>
|
| 40 |
+
</div>
|
| 41 |
+
|
| 42 |
+
<div className="flex items-center justify-between text-xs text-slate-500">
|
| 43 |
+
<div className="flex items-center gap-1">
|
| 44 |
+
<Hash size={14} />
|
| 45 |
+
<span>{thread.citations} Citations</span>
|
| 46 |
+
</div>
|
| 47 |
+
<span className="text-green-500 flex items-center gap-1">
|
| 48 |
+
<ExternalLink size={14} />
|
| 49 |
+
View Thread
|
| 50 |
+
</span>
|
| 51 |
+
</div>
|
| 52 |
+
</div>
|
| 53 |
+
);
|
| 54 |
+
})}
|
| 55 |
+
</div>
|
| 56 |
+
);
|
| 57 |
+
}
|