From b1cc5135f29663b8e13ec2c4e37e02e9bd453052 Mon Sep 17 00:00:00 2001 From: Robert Goniszewski Date: Tue, 29 Oct 2024 22:41:08 +0100 Subject: [PATCH] refactor(bulk-list): centralize bookmark management with dedicated store Signed-off-by: Robert Goniszewski --- src/lib/components/BulkList/BulkList.svelte | 33 +++------ .../BulkListItem/BulkListItem.svelte | 10 ++- .../components/Pagination/Pagination.svelte | 69 +++++++++++-------- src/lib/stores/import-bookmarks.store.ts | 28 ++++++++ 4 files changed, 87 insertions(+), 53 deletions(-) create mode 100644 src/lib/stores/import-bookmarks.store.ts diff --git a/src/lib/components/BulkList/BulkList.svelte b/src/lib/components/BulkList/BulkList.svelte index 0419bb7..12e36c5 100644 --- a/src/lib/components/BulkList/BulkList.svelte +++ b/src/lib/components/BulkList/BulkList.svelte @@ -1,40 +1,28 @@
- +
@@ -62,8 +50,7 @@ const removeSelectedItems = () => { category={category} selected={selected} isLoading={isLoading} - metadataFetched={!!contentHtml} - toggleItemSelection={toggleItemSelection} /> + metadataFetched={!!contentHtml} /> {/each} diff --git a/src/lib/components/BulkListItem/BulkListItem.svelte b/src/lib/components/BulkListItem/BulkListItem.svelte index fd3db87..8119d48 100644 --- a/src/lib/components/BulkListItem/BulkListItem.svelte +++ b/src/lib/components/BulkListItem/BulkListItem.svelte @@ -1,4 +1,5 @@ @@ -26,7 +30,7 @@ let urlObj = new URL(url); type="checkbox" class="checkbox" bind:checked={selected} - on:change={() => toggleItemSelection(id)} /> + on:change={() => importBookmarkStore.toggleSelectionForItem(id)} /> diff --git a/src/lib/components/Pagination/Pagination.svelte b/src/lib/components/Pagination/Pagination.svelte index 79ffb95..886715a 100644 --- a/src/lib/components/Pagination/Pagination.svelte +++ b/src/lib/components/Pagination/Pagination.svelte @@ -1,44 +1,58 @@ -
+
{#if pagesCount > 0} {#each Array(pagesCount) as _, i} + }}>{i + 1} {/each} {/if}
@@ -47,10 +61,11 @@
@@ -75,6 +79,6 @@ let urlObj = new URL(url); {category} - +