From 77808784473e07a483e9a6b146ad0ec0ace65a42 Mon Sep 17 00:00:00 2001 From: JGerla Date: Wed, 1 Oct 2025 17:13:55 +0200 Subject: [PATCH] feat: added Norm nodes and an extra handle on phase nodes ref: N25B-114 --- src/visualProgrammingUI/VisProgUI.tsx | 6 +++--- .../components/DragDropSidebar.tsx | 10 ++++++++++ .../components/NodeDefinitions.tsx | 18 ++++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/visualProgrammingUI/VisProgUI.tsx b/src/visualProgrammingUI/VisProgUI.tsx index 55c5a85..a2b1e9c 100644 --- a/src/visualProgrammingUI/VisProgUI.tsx +++ b/src/visualProgrammingUI/VisProgUI.tsx @@ -21,7 +21,8 @@ import '@xyflow/react/dist/style.css'; import { StartNode, EndNode, - PhaseNode + PhaseNode, + NormNode } from "./components/NodeDefinitions.tsx"; import { Sidebar } from './components/DragDropSidebar.tsx'; @@ -30,6 +31,7 @@ const nodeTypes = { start: StartNode, end: EndNode, phase: PhaseNode, + norm: NormNode }; const initialNodes = [ @@ -67,8 +69,6 @@ const VisProgUI = ()=> { const [nodes, , onNodesChange] = useNodesState(initialNodes); const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges); - - const onConnect = useCallback( (params: Edge | Connection) => setEdges((els) => addEdge(params, els)), [setEdges], diff --git a/src/visualProgrammingUI/components/DragDropSidebar.tsx b/src/visualProgrammingUI/components/DragDropSidebar.tsx index 219e3a2..b3926d9 100644 --- a/src/visualProgrammingUI/components/DragDropSidebar.tsx +++ b/src/visualProgrammingUI/components/DragDropSidebar.tsx @@ -95,6 +95,13 @@ export function Sidebar() { position, data: {label: `new end node`}, }; + case "norm": + return { + id: getId(), + type: nodeType, + position, + data: {label: `new norm node`}, + }; default: { return { id: getId(), @@ -126,6 +133,9 @@ export function Sidebar() { phase Node + + norm Node + ); } \ No newline at end of file diff --git a/src/visualProgrammingUI/components/NodeDefinitions.tsx b/src/visualProgrammingUI/components/NodeDefinitions.tsx index 7c712b3..b4547b2 100644 --- a/src/visualProgrammingUI/components/NodeDefinitions.tsx +++ b/src/visualProgrammingUI/components/NodeDefinitions.tsx @@ -10,6 +10,7 @@ type defaultNodeData = { type startNodeData = defaultNodeData; type endNodeData = defaultNodeData; +type normNodeData = defaultNodeData; type phaseNodeData = defaultNodeData & { number: number; }; @@ -85,9 +86,26 @@ export const PhaseNode= ({ id, data }: PhaseNodeProps) => {
phase {data.number} {data.label}
+
); }; +type NormNodeProps = { + id: string; + data: normNodeData; +}; + +export const NormNode= ({ id, data }: NormNodeProps) => { + return ( + <> + +
+
Norm {data.label}
+ +
+ + ); +}; \ No newline at end of file