Added router block; fixed hidden rendering on workflow block

This commit is contained in:
Emir Karabeg
2025-02-05 12:44:02 -08:00
parent 4f3fa9000a
commit 707b7fd8bc
5 changed files with 127 additions and 5 deletions

View File

@@ -17,10 +17,6 @@ interface SubBlockProps {
}
export function SubBlock({ blockId, config, isConnecting }: SubBlockProps) {
if (config.hidden) {
return null
}
const handleMouseDown = (e: React.MouseEvent) => {
e.stopPropagation()
}

View File

@@ -89,11 +89,14 @@ export function WorkflowBlock({ id, type, config, name, selected }: WorkflowBloc
}, [workflow.subBlocks, id, updateNodeInternals])
function groupSubBlocks(subBlocks: SubBlockConfig[]) {
// Filter out hidden subblocks
const visibleSubBlocks = subBlocks.filter(block => !block.hidden)
const rows: SubBlockConfig[][] = []
let currentRow: SubBlockConfig[] = []
let currentRowWidth = 0
subBlocks.forEach((block) => {
visibleSubBlocks.forEach((block) => {
const blockWidth = block.layout === 'half' ? 0.5 : 1
if (currentRowWidth + blockWidth > 1) {
rows.push([...currentRow])