feat: display actor type icons in left panel add buttons

Replace generic circle icons with the actual node type icons in the
left panel's "Add Actors" section. Icons now match the visual
representation of actors in the graph, making it more intuitive to
identify actor types. Falls back to circle if no icon is defined.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jan-Henrik Bruhn 2025-10-10 22:31:56 +02:00
parent 38cae3cdd9
commit cd1a93f88f

View file

@ -8,6 +8,8 @@ import { usePanelStore } from '../../stores/panelStore';
import { useGraphWithHistory } from '../../hooks/useGraphWithHistory'; import { useGraphWithHistory } from '../../hooks/useGraphWithHistory';
import { useEditorStore } from '../../stores/editorStore'; import { useEditorStore } from '../../stores/editorStore';
import { createNode } from '../../utils/nodeUtils'; import { createNode } from '../../utils/nodeUtils';
import { getIconComponent } from '../../utils/iconUtils';
import { getContrastColor } from '../../utils/colorUtils';
/** /**
* LeftPanel - Collapsible tools panel on the left side * LeftPanel - Collapsible tools panel on the left side
@ -107,21 +109,38 @@ const LeftPanel = ({ onDeselectAll, onAddNode }: LeftPanelProps) => {
</button> </button>
{leftPanelSections.addActors && ( {leftPanelSections.addActors && (
<div className="px-3 py-3 space-y-2"> <div className="px-3 py-3 space-y-2">
{nodeTypes.map((nodeType) => ( {nodeTypes.map((nodeType) => {
const IconComponent = getIconComponent(nodeType.icon);
const textColor = getContrastColor(nodeType.color);
return (
<button <button
key={nodeType.id} key={nodeType.id}
onClick={() => handleAddNode(nodeType.id)} onClick={() => handleAddNode(nodeType.id)}
className="w-full flex items-center space-x-3 px-3 py-2.5 text-sm font-medium text-white rounded hover:opacity-90 transition-opacity focus:outline-none focus:ring-2 focus:ring-offset-2 shadow-sm" className="w-full flex items-center space-x-3 px-3 py-2.5 text-sm font-medium rounded hover:opacity-90 transition-opacity focus:outline-none focus:ring-2 focus:ring-offset-2 shadow-sm"
style={{ backgroundColor: nodeType.color }} style={{
backgroundColor: nodeType.color,
color: textColor
}}
title={nodeType.description} title={nodeType.description}
> >
{IconComponent ? (
<div className="w-5 h-5 flex items-center justify-center" style={{ color: textColor }}>
<IconComponent style={{ fontSize: '1.25rem' }} />
</div>
) : (
<div <div
className="w-3 h-3 rounded-full border-2 border-white" className="w-3 h-3 rounded-full border-2"
style={{ backgroundColor: nodeType.color }} style={{
backgroundColor: nodeType.color,
borderColor: textColor
}}
/> />
)}
<span className="flex-1 text-left">{nodeType.label}</span> <span className="flex-1 text-left">{nodeType.label}</span>
</button> </button>
))} );
})}
<p className="text-xs text-gray-500 pt-2 border-t border-gray-100"> <p className="text-xs text-gray-500 pt-2 border-t border-gray-100">
Click a button to add an actor to the canvas Click a button to add an actor to the canvas
</p> </p>