Spaces:
Running
Running
| import { Brain, Code, Search, ShieldCheck } from 'lucide-react'; | |
| const AGENT_CONFIG = { | |
| orchestrator: { name: 'Orchestrator', icon: Brain, color: '#f472b6' }, | |
| researcher: { name: 'Researcher', icon: Search, color: '#38bdf8' }, | |
| coder: { name: 'Dev Agent', icon: Code, color: '#a78bfa' }, | |
| reviewer: { name: 'Reviewer', icon: ShieldCheck, color: '#34d399' } | |
| }; | |
| export default function ChatArea({ messages }) { | |
| return ( | |
| <div className="flex-1 overflow-y-auto p-8 flex flex-col gap-6 scroll-smooth"> | |
| {messages.map((msg, idx) => ( | |
| <div | |
| key={idx} | |
| className={` | |
| flex gap-4 max-w-[85%] animate-slide-in | |
| ${msg.type === 'user' ? 'self-end flex-row-reverse' : 'self-start'} | |
| `} | |
| > | |
| {msg.type !== 'user' && ( | |
| <div | |
| className="w-8 h-8 rounded-lg flex-shrink-0 flex items-center justify-center bg-gradient-to-br from-slate-800 to-nexus-deep border border-nexus-border text-xs" | |
| style={{ color: AGENT_CONFIG[msg.agent].color }} | |
| > | |
| <AGENT_CONFIG[msg.agent].icon size={16} /> | |
| </div> | |
| )} | |
| <div className={` | |
| p-4 rounded-2xl border text-sm leading-relaxed | |
| ${msg.type === 'user' | |
| ? 'bg-blue-500/15 border-blue-500/30 rounded-br-none' | |
| : 'bg-slate-800/80 border-nexus-border rounded-bl-none'} | |
| `}> | |
| <div className="whitespace-pre-wrap">{msg.content}</div> | |
| {msg.tool && ( | |
| <div className="mt-3 bg-black border border-nexus-border rounded-lg p-3 font-mono text-xs text-nexus-success"> | |
| <div className="flex justify-between text-[10px] uppercase text-nexus-muted mb-2 border-b border-nexus-border pb-1"> | |
| <span>{msg.tool.name}</span> | |
| <span>{msg.tool.status}</span> | |
| </div> | |
| <div className="overflow-x-auto"> | |
| {msg.tool.content} | |
| </div> | |
| </div> | |
| )} | |
| <div className="mt-2 text-[10px] text-nexus-muted flex items-center gap-1.5"> | |
| <span>{msg.type === 'user' ? 'You' : AGENT_CONFIG[msg.agent].name}</span> | |
| <span>•</span> | |
| <span>Just now</span> | |
| </div> | |
| </div> | |
| </div> | |
| ))} | |
| </div> | |
| ); | |
| } |