refactor(maestro): drop folder session counters in sidebar

Remove the per-folder count badge (and the now-unused countLeaves) from the
sidebar tree — the tree structure already conveys grouping.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-24 16:14:28 +00:00
co-authored by Claude Opus 4.8
parent 347b6bdc2a
commit 58b732d400
+7 -7
View File
@@ -119,7 +119,7 @@ function renderNode(node: TreeNode, depth: number): HTMLElement {
// A deep path (`~/git.naps.pt/naps62/maestro`) collapses its leading
// segments to initials (`~/g/n/maestro`) so the dir name stays readable in
// a narrow sidebar; the full path lives in the tooltip.
header.innerHTML = `<span class="chevron">▾</span><span class="folder-name" title="${escapeHtml(node.name)}">${abbreviateFolderName(node.name)}</span><span class="folder-count">${countLeaves(node)}</span>`;
header.innerHTML = `<span class="chevron">▾</span><span class="folder-name" title="${escapeHtml(node.name)}">${abbreviateFolderName(node.name)}</span>`;
header.addEventListener("click", () => {
if (collapsed.has(node.path)) collapsed.delete(node.path);
else collapsed.add(node.path);
@@ -183,11 +183,6 @@ function renderNode(node: TreeNode, depth: number): HTMLElement {
return row;
}
function countLeaves(node: TreeNode): number {
if (node.kind === "leaf") return 1;
return node.children.reduce((n, c) => n + countLeaves(c), 0);
}
function escapeHtml(s: string): string {
return s
.replace(/&/g, "&amp;")
@@ -287,10 +282,11 @@ function createDebugToggle(): HTMLButtonElement {
return btn;
}
export function renderTopbar(store: CatalogStore): HTMLElement {
export function renderTopbar(store: CatalogStore, onToggleSidebar?: () => void): HTMLElement {
const header = document.createElement("header");
header.className = "app-header";
header.innerHTML = `
<button type="button" class="app-menu" title="Sessions" aria-label="Toggle session list">☰</button>
<a class="brand" href="#/" aria-label="maestro — clear selection">
<span class="brand-dot" aria-hidden="true"></span>
<h1>maestro<span class="blink" aria-hidden="true">_</span></h1>
@@ -298,6 +294,10 @@ export function renderTopbar(store: CatalogStore): HTMLElement {
<div class="app-status"></div>
<div class="app-actions"></div>
`;
// Mobile-only ☰ (CSS hides it on desktop) — opens the off-canvas session drawer.
(header.querySelector(".app-menu") as HTMLElement).addEventListener("click", () =>
onToggleSidebar?.(),
);
// Session tally + daemon chips live centered in the header (not the sidebar).
const statusHost = header.querySelector(".app-status") as HTMLElement;