Append tabs to the named tabset, returning a new tree (or the original if unchanged).
( node: RightSidebarLayoutNode, tabsetId: string, tabs: TabType[] )
| 124 | |
| 125 | /** Append tabs to the named tabset, returning a new tree (or the original if unchanged). */ |
| 126 | function appendTabsToTabset( |
| 127 | node: RightSidebarLayoutNode, |
| 128 | tabsetId: string, |
| 129 | tabs: TabType[] |
| 130 | ): RightSidebarLayoutNode { |
| 131 | if (node.type === "tabset") { |
| 132 | if (node.id !== tabsetId) return node; |
| 133 | return { ...node, tabs: [...node.tabs, ...tabs] }; |
| 134 | } |
| 135 | |
| 136 | const left = appendTabsToTabset(node.children[0], tabsetId, tabs); |
| 137 | const right = appendTabsToTabset(node.children[1], tabsetId, tabs); |
| 138 | if (left === node.children[0] && right === node.children[1]) return node; |
| 139 | return { ...node, children: [left, right] }; |
| 140 | } |
| 141 | |
| 142 | /** |
| 143 | * Recursively strip removed static tabs from raw layout data. |
no outgoing calls
no test coverage detected