fix(frontend): wip

This commit is contained in:
Faton Ramadani
2024-08-02 17:42:06 +02:00
parent 1c7b67d0ee
commit 9abeccbe72
2 changed files with 10 additions and 4 deletions

View File

@@ -105,14 +105,20 @@
branchAllEnd: BranchAllEndNode,
forLoopEnd: ForLoopEndNode,
forLoopStart: ForLoopStartNode,
result: ResultNode
result: ResultNode,
whileLoopStart: ForLoopStartNode,
whileLoopEnd: ForLoopEndNode
}
const edgeTypes = {
edge: BaseEdge
}
</script>
<div class="h-screen">
<div
style={`min-height: ${minHeight}px; max-height: ${
maxHeight ? maxHeight + 'px' : 'none'
}; height:100%;`}
>
<SvelteFlow
{nodes}
{edges}

View File

@@ -135,6 +135,7 @@ export default function graphBuilder(modules: FlowModule[] | undefined): {
position: { x: 0, y: 0 },
type: 'whileLoopStart'
}
addEdge(module.id, startNode.id)
const endNode = {
id: `${module.id}-end`,
@@ -147,6 +148,7 @@ export default function graphBuilder(modules: FlowModule[] | undefined): {
nodes.push(endNode)
processModules(module.value.modules, startNode, endNode, currentOffset + 50)
previousId = endNode.id
} else if (module.value.type === 'branchone') {
// Start
addNode(module, currentOffset, 'module')
@@ -179,12 +181,10 @@ export default function graphBuilder(modules: FlowModule[] | undefined): {
}
if (index === 0) {
console.log('Adding edge between beforeNode and module', beforeNode.id, module.id)
addEdge(beforeNode.id, module.id)
}
if (index === modules.length - 1 && previousId) {
console.log(nextNode, previousId)
addEdge(previousId, nextNode.id)
}
})