diff --git a/src/visualProgrammingUI/VisProgUI.tsx b/src/visualProgrammingUI/VisProgUI.tsx index ae526c6..48c987f 100644 --- a/src/visualProgrammingUI/VisProgUI.tsx +++ b/src/visualProgrammingUI/VisProgUI.tsx @@ -17,28 +17,34 @@ import { type Connection, } from '@xyflow/react'; import '@xyflow/react/dist/style.css'; -import StartNode from "./components/NodeDefinitions.tsx"; +import { + StartNode, + EndNode, + PhaseNode +} from "./components/NodeDefinitions.tsx"; const nodeTypes = { - startNode: StartNode, + start: StartNode, + end: EndNode, + phase: PhaseNode, }; const initialNodes = [ { id: 'start', - type: 'startNode', + type: 'start', position: {x: 0, y: 0}, data: {label: 'start'} }, { id: 'genericPhase', - type: 'default', + type: 'phase', position: {x: 0, y: 150}, - data: {label: 'Generic Phase'}, + data: {label: 'Generic Phase', number: 1}, }, { id: 'end', - type: 'output', + type: 'end', position: {x: 0, y: 300}, data: {label: 'End'} } diff --git a/src/visualProgrammingUI/components/NodeDefinitions.tsx b/src/visualProgrammingUI/components/NodeDefinitions.tsx index e9fc0b9..99ad1da 100644 --- a/src/visualProgrammingUI/components/NodeDefinitions.tsx +++ b/src/visualProgrammingUI/components/NodeDefinitions.tsx @@ -4,7 +4,17 @@ import '../VisProgUI.css'; // Datatypes for NodeTypes -type startNodeData = { label: string; }; +type defaultNodeData = { + label: string; +}; + +type startNodeData = defaultNodeData; +type endNodeData = defaultNodeData; +type phaseNodeData = defaultNodeData & { + number: number; +}; + +export type nodeData = defaultNodeData | startNodeData | phaseNodeData | endNodeData; // Definitions of Nodes @@ -12,11 +22,34 @@ type startNodeData = { label: string; }; export const StartNode= ({ data } : {data : startNodeData}) => { return ( <> -