diff --git a/web/src/catalog.ts b/web/src/catalog.ts index 094d0cc..1ec7b57 100644 --- a/web/src/catalog.ts +++ b/web/src/catalog.ts @@ -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 = `▾${abbreviateFolderName(node.name)}${countLeaves(node)}`; + header.innerHTML = `▾${abbreviateFolderName(node.name)}`; 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, "&") @@ -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 = ` +

maestro

@@ -298,6 +294,10 @@ export function renderTopbar(store: CatalogStore): HTMLElement {
`; + // 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;