import React from 'react';
import { SingleChildTreeLayer } from './SingleChildTreeLayer';
import { TreeLayer } from './TreeLayer';
import { hasSingleChild } from './util';
/**
 * Either a SingleChildTreeLayer or TreeLayer.
 */
export const ChildTreeLayer = (props) => {
    const sharedProps = {
        location: props.location,
        history: props.history,
        activePath: props.activePath,
        activeNode: props.activeNode,
        depth: props.depth + 1,
        expandedTrees: props.expandedTrees,
        parent: props.parent,
        repoPath: props.repoPath,
        rev: props.rev,
        onToggleExpand: props.onToggleExpand,
        onHover: props.onHover,
        selectedNode: props.selectedNode,
        setChildNodes: props.setChildNodes,
        setActiveNode: props.setActiveNode,
        onSelect: props.onSelect,
        commitID: props.commitID,
    };
    return (React.createElement("div", null,
        React.createElement("table", { className: "tree-layer" },
            React.createElement("tbody", null,
                React.createElement("tr", null,
                    React.createElement("td", null, hasSingleChild(props.entries) ? (React.createElement(SingleChildTreeLayer, Object.assign({}, sharedProps, { key: props.singleChildTreeEntry.path, index: 0, isExpanded: props.expandedTrees.includes(props.singleChildTreeEntry.path), parentPath: props.singleChildTreeEntry.path, entryInfo: props.singleChildTreeEntry, childrenEntries: props.singleChildTreeEntry.children }))) : (props.entries.map((item, i) => (React.createElement(TreeLayer, Object.assign({}, sharedProps, { key: item.path, index: i, isExpanded: props.expandedTrees.includes(item.path), parentPath: item.path, entryInfo: item })))))))))));
};
//# sourceMappingURL=ChildTreeLayer.js.map