From 1c9902448fd6811f8df172521e63318e378e6c36 Mon Sep 17 00:00:00 2001 From: Alex <25013571+alexhb1@users.noreply.github.com> Date: Sun, 3 May 2026 08:11:19 +0100 Subject: [PATCH] refactor(ui): use tanstack virtual+table for book browser table view (#1047) --- frontend/package.json | 1 + .../book-browser/book-browser.component.html | 59 +- .../book-browser/book-browser.component.scss | 90 +-- .../book-browser.component.spec.ts | 90 ++- .../book-browser/book-browser.component.ts | 145 ++--- .../book-table/book-table-row.component.html | 100 +++ .../book-table/book-table-row.component.scss | 179 ++++++ .../book-table-row.component.spec.ts | 128 ++++ .../book-table/book-table-row.component.ts | 327 ++++++++++ .../book-table/book-table.component.html | 225 +++---- .../book-table/book-table.component.scss | 288 ++++++--- .../book-table/book-table.component.spec.ts | 300 ++++++++- .../book-table/book-table.component.ts | 602 ++++++++---------- .../book-table/book-table.helpers.spec.ts | 25 + .../book-table/book-table.helpers.ts | 66 ++ .../src/app/features/book/model/book.model.ts | 3 +- .../book/service/app-books-api.service.ts | 55 +- .../features/book/service/book-query-cache.ts | 19 + .../components/rating/rating.component.html | 17 + .../components/rating/rating.component.scss | 64 ++ .../components/rating/rating.component.ts | 46 ++ .../route-scroll-position.service.spec.ts | 15 + .../service/route-scroll-position.service.ts | 8 +- frontend/src/i18n/da/book.json | 8 +- frontend/src/i18n/de/book.json | 8 +- frontend/src/i18n/en/book.json | 8 +- frontend/src/i18n/es/book.json | 8 +- frontend/src/i18n/fr/book.json | 8 +- frontend/src/i18n/hr/book.json | 8 +- frontend/src/i18n/hu/book.json | 8 +- frontend/src/i18n/id/book.json | 8 +- frontend/src/i18n/it/book.json | 8 +- frontend/src/i18n/ja/book.json | 8 +- frontend/src/i18n/nl/book.json | 8 +- frontend/src/i18n/pl/book.json | 8 +- frontend/src/i18n/pt/book.json | 8 +- frontend/src/i18n/ru/book.json | 8 +- frontend/src/i18n/sk/book.json | 8 +- frontend/src/i18n/sl/book.json | 8 +- frontend/src/i18n/sv/book.json | 8 +- frontend/src/i18n/uk/book.json | 8 +- frontend/src/i18n/zh/book.json | 8 +- frontend/yarn.lock | 22 +- 43 files changed, 2241 insertions(+), 785 deletions(-) create mode 100644 frontend/src/app/features/book/components/book-browser/book-table/book-table-row.component.html create mode 100644 frontend/src/app/features/book/components/book-browser/book-table/book-table-row.component.scss create mode 100644 frontend/src/app/features/book/components/book-browser/book-table/book-table-row.component.spec.ts create mode 100644 frontend/src/app/features/book/components/book-browser/book-table/book-table-row.component.ts create mode 100644 frontend/src/app/features/book/components/book-browser/book-table/book-table.helpers.spec.ts create mode 100644 frontend/src/app/features/book/components/book-browser/book-table/book-table.helpers.ts create mode 100644 frontend/src/app/shared/components/rating/rating.component.html create mode 100644 frontend/src/app/shared/components/rating/rating.component.scss create mode 100644 frontend/src/app/shared/components/rating/rating.component.ts diff --git a/frontend/package.json b/frontend/package.json index 6c12cc27e..5ed68ad9e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -39,6 +39,7 @@ "@stomp/rx-stomp": "^2.3.0", "@stomp/stompjs": "^7.3.0", "@tanstack/angular-query-experimental": "5.100.1", + "@tanstack/angular-table": "^8.21.4", "@tanstack/angular-virtual": "^4.0.13", "chart.js": "^4.5.1", "chartjs-chart-matrix": "^3.0.0", diff --git a/frontend/src/app/features/book/components/book-browser/book-browser.component.html b/frontend/src/app/features/book/components/book-browser/book-browser.component.html index ee6e9e623..c88fe7c37 100644 --- a/frontend/src/app/features/book/components/book-browser/book-browser.component.html +++ b/frontend/src/app/features/book/components/book-browser/book-browser.component.html @@ -128,17 +128,17 @@ @@ -253,38 +253,20 @@ - @if (showTableLoadingPlaceholder()) { -
- } @else if (showGridLoadingPlaceholder()) { -- {{ entityType() === EntityType.LIBRARY ? t('labels.failedLibrary') : t('labels.failedShelf') }} + @switch (entityType()) { + @case (EntityType.LIBRARY) { + {{ t('labels.failedLibrary') }} + } + @case (EntityType.SHELF) { + {{ t('labels.failedShelf') }} + } + @default { + {{ t('labels.failedBooks') }} + } + }