show both expand / collapse all

This commit is contained in:
Nikita Galaiko 2023-08-03 09:01:22 +02:00
parent 2f40e62dbe
commit 65396ce379

View File

@ -104,14 +104,18 @@
allExpanded = undefined; allExpanded = undefined;
} }
} }
function handleToggleExpandAll() {
if (allExpanded == true) { $: allCollapsed = files.every((f) => getExpandedWithCacheFallback(f) === false);
files.forEach((f) => setExpandedWithCache(f, false));
allExpanded = false; function handleCollapseAll() {
} else { files.forEach((f) => setExpandedWithCache(f, false));
files.forEach((f) => setExpandedWithCache(f, true)); allExpanded = false;
allExpanded = true; files = files;
} }
function handleExpandAll() {
files.forEach((f) => setExpandedWithCache(f, true));
allExpanded = true;
files = files; files = files;
} }
@ -526,13 +530,9 @@
Unapply Unapply
</PopupMenuItem> </PopupMenuItem>
<PopupMenuItem on:click={handleToggleExpandAll}> <PopupMenuItem on:click={handleExpandAll} disabled={allExpanded}>Expand all</PopupMenuItem>
{#if allExpanded}
Collapse all <PopupMenuItem on:click={handleCollapseAll} disabled={allCollapsed}>Collapse all</PopupMenuItem>
{:else}
Expand all
{/if}
</PopupMenuItem>
<div class="mx-3"> <div class="mx-3">
<div class="my-2 h-[0.0625rem] w-full bg-light-300 dark:bg-dark-500" /> <div class="my-2 h-[0.0625rem] w-full bg-light-300 dark:bg-dark-500" />