()
| 98 | } |
| 99 | |
| 100 | render() { |
| 101 | const { block, selectionState, isInvalidBlamed, placeholder, isInsideBreadcrumbs } = this.props |
| 102 | const isSelected = selectionState !== NodeSelectionState.UNSELECTED |
| 103 | |
| 104 | if (block === null) { |
| 105 | return null |
| 106 | } |
| 107 | |
| 108 | const width = block.blockWidth |
| 109 | const leftPos = block.x + block.marginLeft |
| 110 | const topPos = block.y + block.marginTop |
| 111 | let internalLeftPos = leftPos + NODE_INLINE_SPACING |
| 112 | |
| 113 | let loopAnnotation = null |
| 114 | if (block.node.isRepeatableBlock) { |
| 115 | loopAnnotation = <RepeatedBlockAnnotation nodeBlock={block} /> |
| 116 | } |
| 117 | |
| 118 | const isValid = (block.isValid || block.invalidChildsetID) && !isInvalidBlamed |
| 119 | const classname = 'svgsplootnode' + (isSelected ? ' selected' : '') + (isValid ? '' : ' invalid') |
| 120 | |
| 121 | let shape: ReactElement |
| 122 | let placeholderLabel: ReactElement |
| 123 | |
| 124 | if (block.layout.boxType === NodeBoxType.STRING) { |
| 125 | return ( |
| 126 | <StringNode |
| 127 | block={block} |
| 128 | selectionState={selectionState} |
| 129 | isInsideBreadcrumbs={isInsideBreadcrumbs} |
| 130 | isInvalidBlamed={isInvalidBlamed} |
| 131 | /> |
| 132 | ) |
| 133 | } |
| 134 | |
| 135 | if (block.layout.boxType === NodeBoxType.INVISIBLE || block.layout.boxType === NodeBoxType.BRACKETS) { |
| 136 | internalLeftPos = leftPos |
| 137 | if (block.node.isEmpty()) { |
| 138 | placeholderLabel = <PlaceholderLabel x={block.x} y={block.y} label={placeholder} /> |
| 139 | } |
| 140 | if (!isValid) { |
| 141 | shape = ( |
| 142 | <rect |
| 143 | className={'invisible-splootnode-invalid'} |
| 144 | x={leftPos} |
| 145 | y={topPos} |
| 146 | height={NODE_BLOCK_HEIGHT} |
| 147 | width={width} |
| 148 | rx="4" |
| 149 | /> |
| 150 | ) |
| 151 | } else { |
| 152 | shape = null |
| 153 | } |
| 154 | } else if (block.layout.boxType === NodeBoxType.SMALL_BLOCK) { |
| 155 | shape = getNodeShape( |
| 156 | classname, |
| 157 | leftPos, |
nothing calls this directly
no test coverage detected