diff --git a/frontend/src/components/Diagram.jsx b/frontend/src/components/Diagram.jsx index f4ced64..9b8e518 100644 --- a/frontend/src/components/Diagram.jsx +++ b/frontend/src/components/Diagram.jsx @@ -16,9 +16,11 @@ import { import CustomNode from './CustomNode'; import IconSelector from './IconSelector'; import { toast } from 'react-toastify'; +import RouterNode from './RouterNode'; const nodeTypes = { custom: CustomNode, + router: RouterNode, }; function Diagram() { @@ -27,6 +29,7 @@ function Diagram() { const [selectedNode, setSelectedNode] = useState(null); const [showForm, setShowForm] = useState(false); const [newLabel, setNewLabel] = useState(''); + const [newType, setNewType] = useState('custom'); const [selectedIcon, setSelectedIcon] = useState(''); const [selectedEdge, setSelectedEdge] = useState(null); const [diagramName, setDiagramName] = useState(null); @@ -121,8 +124,10 @@ function Diagram() { const newNode = { id, - type: 'custom', - data: { label, icon }, + type: newType, + data: newType === 'custom' + ? { label, icon } + : { label }, // router and other types don't have icons position: { x: Math.random() * 400, y: Math.random() * 300 }, }; @@ -131,6 +136,7 @@ function Diagram() { setShowForm(false); setNewLabel(''); setSelectedIcon(''); + setNewType('custom'); }; const handleDeleteNode = () => { @@ -272,6 +278,7 @@ function Diagram() { {showForm && (