Upload components/Sidebar.jsx with huggingface_hub
Browse files- components/Sidebar.jsx +58 -0
components/Sidebar.jsx
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { FileText, Database, Cpu, Waypoints, ArrowRight, Send, Trash2, Link } from 'lucide-react';
|
| 2 |
+
|
| 3 |
+
const tools = [
|
| 4 |
+
{ id: 'input', label: 'Data Source', icon: FileText, group: 'Data Ingestion' },
|
| 5 |
+
{ id: 'vector-db', label: 'Vector Store', icon: Database, group: 'Data Ingestion' },
|
| 6 |
+
{ id: 'llm', label: 'LLM Core', icon: Cpu, group: 'AI Processing' },
|
| 7 |
+
{ id: 'embedder', label: 'Embeddings', icon: Waypoints, group: 'AI Processing' },
|
| 8 |
+
{ id: 'router', label: 'Semantic Router', icon: ArrowRight, group: 'Logic' },
|
| 9 |
+
{ id: 'output', label: 'Response', icon: Send, group: 'Output' },
|
| 10 |
+
];
|
| 11 |
+
|
| 12 |
+
export default function Sidebar({ onAddNode, onClear, onConnectSelected, hasSelection }) {
|
| 13 |
+
return (
|
| 14 |
+
<aside className="w-64 bg-panel border-r border-border flex flex-col">
|
| 15 |
+
<div className="p-4 flex-1 overflow-y-auto">
|
| 16 |
+
{['Data Ingestion', 'AI Processing', 'Logic', 'Output'].map(group => (
|
| 17 |
+
<div key={group} className="mb-6">
|
| 18 |
+
<h3 className="text-[10px] uppercase tracking-widest text-muted font-bold mb-3">{group}</h3>
|
| 19 |
+
<div className="space-y-2">
|
| 20 |
+
{tools.filter(t => t.group === group).map(tool => {
|
| 21 |
+
const Icon = tool.icon;
|
| 22 |
+
return (
|
| 23 |
+
<button
|
| 24 |
+
key={tool.id}
|
| 25 |
+
onClick={() => onAddNode(tool.id)}
|
| 26 |
+
className="w-full flex items-center gap-3 px-3 py-2.5 rounded bg-surface border border-border hover:border-primary hover:bg-primary/5 transition-all text-sm text-main text-left group"
|
| 27 |
+
>
|
| 28 |
+
<div className="w-8 h-8 rounded bg-white/5 flex items-center justify-center group-hover:bg-primary/10 transition-colors">
|
| 29 |
+
<Icon size={16} className="text-muted group-hover:text-primary" />
|
| 30 |
+
</div>
|
| 31 |
+
{tool.label}
|
| 32 |
+
</button>
|
| 33 |
+
);
|
| 34 |
+
})}
|
| 35 |
+
</div>
|
| 36 |
+
</div>
|
| 37 |
+
))}
|
| 38 |
+
</div>
|
| 39 |
+
|
| 40 |
+
<div className="p-4 border-t border-border space-y-2 bg-surface/30">
|
| 41 |
+
<button
|
| 42 |
+
onClick={onConnectSelected}
|
| 43 |
+
disabled={!hasSelection}
|
| 44 |
+
className="w-full flex items-center justify-center gap-2 py-2 rounded bg-surface border border-border hover:border-success hover:text-success transition-all text-sm disabled:opacity-50 disabled:cursor-not-allowed"
|
| 45 |
+
title="Connect currently selected nodes"
|
| 46 |
+
>
|
| 47 |
+
<Link size={16} /> Connect Selected
|
| 48 |
+
</button>
|
| 49 |
+
<button
|
| 50 |
+
onClick={onClear}
|
| 51 |
+
className="w-full flex items-center justify-center gap-2 py-2 rounded bg-surface border border-border hover:border-red-500 hover:text-red-400 transition-all text-sm"
|
| 52 |
+
>
|
| 53 |
+
<Trash2 size={16} /> Clear Canvas
|
| 54 |
+
</button>
|
| 55 |
+
</div>
|
| 56 |
+
</aside>
|
| 57 |
+
);
|
| 58 |
+
}
|