From 5915bb28b8d43a833cd887856197fa1bba146117 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Sat, 7 Sep 2024 19:33:02 -0400 Subject: [PATCH] changed to svelte headless table for reactive data --- frontend/package.json | 4 +- .../src/helperComponents/AnimeTable.svelte | 234 ++++++++---------- 2 files changed, 99 insertions(+), 139 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index 3379fdd..637e5aa 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -16,6 +16,7 @@ "postcss": "^8.4.45", "svelte": "^4.0.0", "svelte-check": "^3.4.3", + "svelte-headless-table": "^0.18.2", "svelte-preprocess": "^5.0.3", "svelte-spa-router": "^4.0.1", "tailwind-merge": "^2.5.2", @@ -26,9 +27,8 @@ }, "dependencies": { "@popperjs/core": "^2.11.8", - "@tanstack/svelte-table": "^8.20.5", "flowbite": "^2.5.1", "flowbite-svelte": "^0.46.16", "moment": "^2.30.1" } -} \ No newline at end of file +} diff --git a/frontend/src/helperComponents/AnimeTable.svelte b/frontend/src/helperComponents/AnimeTable.svelte index f0fa3e2..44be587 100644 --- a/frontend/src/helperComponents/AnimeTable.svelte +++ b/frontend/src/helperComponents/AnimeTable.svelte @@ -1,151 +1,111 @@
- - - {#each $table.getHeaderGroups() as headerGroup} - - {#each headerGroup.headers as header} - + {#each $headerRows as headerRow (headerRow.id)} + + + {#each headerRow.cells as cell (cell.id)} + + - {/each} - +
+ + {#if props.sort.order === 'asc'} + ⬇️ + {:else if props.sort.order === 'desc'} + ⬆️ + {/if} +
+ + + {/each} + + {/each} - - {#each $table.getRowModel().rows as row} - - {#each row.getVisibleCells() as cell} - - {/each} - - {/each} + + {#each $rows as row (row.id)} + + + {#each row.cells as cell (cell.id)} + + + + {/each} + + + {/each}
- {#if !header.isPlaceholder} -
- - {#if header.column.getIsSorted().toString() === 'asc'} - 🔼 - {:else if header.column.getIsSorted().toString() === 'desc'} - 🔽 - {/if} - - {/if} -
- -
+ +
-