From b977aa53cf93ba8117dcfbd5035220c31efc1462 Mon Sep 17 00:00:00 2001 From: Allan Lasser Date: Tue, 19 Mar 2024 10:26:17 -0400 Subject: [PATCH 1/5] Adds document count to manager ActionBar This refactors the ActionBar into a presentational component with an accompanying ActionBarContainer to connect it with our stores. It also adds a Storybook for the component. --- src/langs/json/en.json | 2 +- src/pages/app/ActionBar.svelte | 233 ++++++++++-------- src/pages/app/ActionBarContainer.svelte | 35 +++ src/pages/app/Documents.svelte | 2 +- .../app/stories/ActionBar.stories.svelte | 50 ++++ 5 files changed, 213 insertions(+), 109 deletions(-) create mode 100644 src/pages/app/ActionBarContainer.svelte create mode 100644 src/pages/app/stories/ActionBar.stories.svelte diff --git a/src/langs/json/en.json b/src/langs/json/en.json index 7dd7c47a6..f865addc1 100644 --- a/src/langs/json/en.json +++ b/src/langs/json/en.json @@ -547,7 +547,7 @@ "paginator": { "page": "Page", "of": "of", - "document": "{n, plural, one {Document} other {Documents}}", + "document": "{n, plural, one {# Document} other {# Documents}}", "next": "Next Page", "previous": "Previous Page", "first": "First Page", diff --git a/src/pages/app/ActionBar.svelte b/src/pages/app/ActionBar.svelte index cd9966767..0888e695d 100644 --- a/src/pages/app/ActionBar.svelte +++ b/src/pages/app/ActionBar.svelte @@ -1,98 +1,127 @@ -
- {#if !$layout.loading} -
- {#if $orgsAndUsers.loggedIn} - - {#if $documents.documents.length > 0} - - {/if} - + {#if !data.loading} + + + {#if loggedIn} + + {#if data.documents.length > 0} + + {/if} + - {#if $layout.hasSelection && $layout.selectionEditable} - 600} - on:active={(e) => (editVisible = e.detail)} - > + {#if selection.checked && selection.editable} + 600} + on:active={(e) => (editVisible = e.detail)} + > + + {$_("actionBar.editMenu")} + + + + + {:else} + + + {$_("actionBar.editMenu")} + + + + {/if} + 600}> - {$_("actionBar.editMenu")} + {$_("actionBar.projectsMenu")} - + + + 600}> + + + {$_("actionBar.addOnsMenu")} + + + + - {:else} - - - {$_("actionBar.editMenu")} - - - {/if} - 600}> - - {$_("actionBar.projectsMenu")} - - - - - 600}> - - {$_("common.new")}! - {$_("actionBar.addOnsMenu")} - - - - - {/if} - - - - -
+ + + {#if pagination.totalItems} +
+ {$_("paginator.document", { values: { n: pagination.totalItems } })} +
+ {/if} + + + +
+ {/if}
@@ -101,44 +130,34 @@