import React from 'react'
import Node from './Node'
export default function NodeCanvas({
nodes,
connections,
selectedNode,
onSelectNode,
onEditNode,
onDeleteNode,
onAddConnection,
onNodeDragStart
}) {
const getNodeColor = (type) => {
switch (type) {
case 'ceo': return 'from-yellow-500 to-amber-600'
case 'claude': return 'from-violet-500 to-purple-600'
case 'gemini': return 'from-blue-500 to-cyan-600'
case 'openai': return 'from-emerald-500 to-teal-600'
case 'llama': return 'from-orange-500 to-red-600'
default: return 'from-slate-500 to-slate-600'
}
}
const renderConnections = () => {
return connections.map(conn => {
const fromNode = nodes.find(n => n.id === conn.from)
const toNode = nodes.find(n => n.id === conn.to)
if (!fromNode || !toNode) return null
const fromX = fromNode.position.x + 140
const fromY = fromNode.position.y + 60
const toX = toNode.position.x + 140
const toY = toNode.position.y + 60
const midX = (fromX + toX) / 2
const controlOffset = Math.abs(toX - fromX) / 3
return (
Click "Add Node" to create your first agent