diff --git a/src/lib/components/Sidebar.svelte b/src/lib/components/Sidebar.svelte
index e72df07..964cf5f 100644
--- a/src/lib/components/Sidebar.svelte
+++ b/src/lib/components/Sidebar.svelte
@@ -67,6 +67,22 @@
$collapsedNotebooks = [...$collapsedNotebooks, path];
}
}
+ // Collapse-all / expand-all: toggles every notebook that has children.
+ function collectParentPaths(tree: NotebookEntry[]): string[] {
+ const out: string[] = [];
+ for (const nb of tree) {
+ if (nb.children && nb.children.length > 0) {
+ out.push(nb.path);
+ out.push(...collectParentPaths(nb.children));
+ }
+ }
+ return out;
+ }
+ const allParentPaths = $derived(collectParentPaths($notebooks));
+ const allCollapsed = $derived(allParentPaths.length > 0 && allParentPaths.every((p) => $collapsedNotebooks.includes(p)));
+ function toggleAllCollapse() {
+ $collapsedNotebooks = allCollapsed ? [] : [...allParentPaths];
+ }
export async function refresh() {
@@ -578,19 +594,32 @@
}}
>
Notebooks
-
+
+ {#if allParentPaths.length > 0}
+
+ {/if}
+
+
{#if showNewNotebook}
@@ -952,6 +981,11 @@
color: var(--text-tertiary);
}
+ .section-actions {
+ display: flex;
+ align-items: center;
+ gap: 2px;
+ }
.icon-btn, .icon-btn-sm {
background: none;
border: none;