fix(maestro): fold the sole root sidebar folder into its own children
~ never distinguishes anything from a sibling — nothing else sits beside it — so it showed as its own header even when it immediately branched into multiple real projects. Now it folds into each child instead, at the top only; a real divergence further down still gets its own header.
This commit is contained in:
@@ -59,6 +59,15 @@ export function buildTree(sessions: Session[], home: string | undefined, filter:
|
||||
for (const c of n.children) if (c.kind === "folder") sortRec(c);
|
||||
};
|
||||
sortRec(root);
|
||||
// The root's sole child (usually `~`) has no sibling to distinguish it
|
||||
// from, so it folds into every one of its own children, not just a lone
|
||||
// one — unlike the chain merge below, and only here at the very top.
|
||||
if (root.children.length === 1 && root.children[0].kind === "folder") {
|
||||
const only = root.children[0];
|
||||
root.children = only.children.map((c) =>
|
||||
c.kind === "folder" ? { ...c, name: `${only.name}/${c.name}` } : c,
|
||||
);
|
||||
}
|
||||
// Collapse linear directory chains so `~/git.naps.pt/naps62/maestro` reads as
|
||||
// one compact folder rather than four nested ones.
|
||||
root.children = root.children.map((c) => (c.kind === "folder" ? mergeLinear(c) : c));
|
||||
|
||||
Reference in New Issue
Block a user