import { Handle, Position, NodeProps } from 'reactflow'; const typeInfo: { [key: string]: { bg: string; text: string; icon: string; } } = { start: { bg: 'bg-green-500/20', text: 'text-green-500', icon: 'play_arrow' }, given: { bg: 'bg-sky-500/20', text: 'text-sky-500', icon: 'task_alt' }, when: { bg: 'bg-emerald-500/20', text: 'text-emerald-500', icon: 'task_alt' }, then: { bg: 'bg-amber-500/20', text: 'text-amber-500', icon: 'task_alt' }, }; const StepNode = ({ data, type }: NodeProps) => { const { label } = data; const [stepType, ...stepNameParts] = label.split(':'); const stepName = stepNameParts.join(':').trim(); const info = typeInfo[stepType.toLowerCase()] || { bg: 'bg-gray-500/20', text: 'text-gray-500', icon: 'help' }; // Special node for the start of the scenario if (type === 'input') { const startInfo = typeInfo['start']; return (
{startInfo.icon}

Start

Scenario starting point

); } return (
{info.icon}

{stepType}

{stepName}

); }; export default StepNode;