renderContent()

in frontend/src/js/components/UtilComponents/TreeBrowser/Node.tsx [200:273]


    renderContent() {

        if (this.props.entry.children.length >= MAX_NUMBER_OF_CHILDREN) {
            return <tr>
                <td>
                    {[...Array(this.props.depth + 1)].map((m, i) => <span key={i} className='file-browser__name-pad'></span>)}
                    <span>
                        <SearchLink to={`/resources/${this.props.entry.id}`}>
                            {this.props.entry.children.length} files. Click to load...
                        </SearchLink>
                    </span>
                </td>
            </tr>;
        }

        const sortedEntries = sortEntries<T>(this.props.entry.children, this.props.columnsConfig);

        return (
            sortedEntries.map((e: TreeEntry<T>, i: number) => {
                if (isTreeNode<T>(e)) {
                    return (
                        <Node
                            key={e.id}
                            ref={n => {if (n !== null) this.childReactComponents.push(n);}}
                            isFirst={i === 0}

                            entry={e}
                            index={i}
                            depth={this.props.depth + 1}
                            focusSibling={this.focusEntry}

                            onFocus={this.props.onFocus}
                            selectedEntries={this.props.selectedEntries}
                            focusedEntry={this.props.focusedEntry}
                            expandedNodes={this.props.expandedNodes}
                            clearFocus={this.props.clearFocus}
                            onSelectLeaf={this.props.onSelectLeaf}
                            onExpandLeaf={this.props.onExpandLeaf}
                            onExpand={this.props.onExpand}
                            onCollapse={this.props.onCollapse}
                            onDrop={this.props.onDrop}
                            onContextMenu={this.props.onContextMenu}

                            columnsConfig={this.props.columnsConfig}
                        />
                    );
                } else {
                    return (
                        <Leaf
                            key={e.id}
                            ref={l => {if (l !== null) this.childReactComponents.push(l);}}
                            isFirst={i === 0}

                            entry={e}
                            index={i}
                            depth={this.props.depth + 1}
                            focusSibling={this.focusEntry}

                            onFocus={this.props.onFocus}
                            selectedEntries={this.props.selectedEntries}
                            focusedEntry={this.props.focusedEntry}

                            onSelect={this.props.onSelectLeaf}
                            // no onCollapse for a leaf - if it's expanded it becomes a node
                            onExpand={this.props.onExpandLeaf}
                            onContextMenu={this.props.onContextMenu}

                            columnsConfig={this.props.columnsConfig}
                        />
                    );
                }
            })
        );
    }