refactor: defaults should be in their own file, respecting eslint/ react standards. all tests fail, obviously.

ref: N25B-294
This commit is contained in:
Björn Otgaar
2025-11-17 16:00:36 +01:00
parent c5dc825ca3
commit 35ff58eca8
16 changed files with 1134 additions and 1201 deletions

View File

@@ -12,9 +12,7 @@ import {DndToolbar} from './visualProgrammingUI/components/DragDropSidebar.tsx';
import useFlowStore from './visualProgrammingUI/VisProgStores.tsx';
import type {FlowState} from './visualProgrammingUI/VisProgTypes.tsx';
import styles from './VisProg.module.css'
import type { JSX } from 'react';
import { NodeTypes } from './visualProgrammingUI/NodeRegistry.ts';
import { graphReducer } from './visualProgrammingUI/GraphReducer.ts';
import { NodeReduces, NodeTypes } from './visualProgrammingUI/NodeRegistry.ts';
// --| config starting params for flow |--
@@ -116,6 +114,19 @@ function runProgram() {
console.log(program);
}
/**
* Reduces the graph into its phases' information and recursively calls their reducing function
*/
function graphReducer() {
const { nodes } = useFlowStore.getState();
return nodes
.filter((n) => n.type == 'phase')
.map((n) => {
const reducer = NodeReduces['phase'];
return reducer(n, nodes)
});
}
/**
* houses the entire page, so also UI elements
* that are not a part of the Visual Programming UI