From 80492e8f6f88bff8035e27b814cc9eacbee40c65 Mon Sep 17 00:00:00 2001 From: sowgro Date: Sat, 5 Apr 2025 16:29:05 -0400 Subject: Fix storage after merge --- .../components/cupboard/cupboard.component.html | 4 +- .../app/components/cupboard/cupboard.component.ts | 13 +++++- .../funding-basket/funding-basket.component.html | 2 +- .../components/need-list/need-list.component.ts | 54 +++++++++++----------- ufund-ui/src/app/services/users.service.ts | 4 +- 5 files changed, 46 insertions(+), 31 deletions(-) (limited to 'ufund-ui') diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.html b/ufund-ui/src/app/components/cupboard/cupboard.component.html index cd8fec2..4eebc2d 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.html +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.html @@ -25,7 +25,7 @@ {{sortMode === 'Ascending' ? 'arrow_upward': 'arrow_downward'}} - +

Search Results({{needs.length - searchResults.length}} needs filtered):

@@ -46,5 +46,5 @@ deleteDelete Need - + diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.ts b/ufund-ui/src/app/components/cupboard/cupboard.component.ts index b03b77e..aca1397 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.ts +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.ts @@ -26,7 +26,7 @@ export class CupboardComponent implements OnInit { needs: Need[] = []; searchResults: Need[] = []; sortMode: 'Ascending' | 'Descending' = 'Ascending' - itemsPerPage = 5; + itemsPerPage = parseInt(localStorage.getItem('itemsPerPage') ?? '5') ?? 5; currentSortAlgo = 'sortByPriority'; constructor( @@ -135,6 +135,17 @@ export class CupboardComponent implements OnInit { } } + editItemsPerPage() { + if (this.itemsPerPage > this.searchResults.length) { + this.itemsPerPage = this.searchResults.length + } + if (this.itemsPerPage < 1) { + this.itemsPerPage = 1 + } + localStorage.setItem('itemsPerPage', this.itemsPerPage.toString()) + this.refresh(); + } + protected readonly SortingAlgorithms = SortingAlgoArrays; protected readonly Object = Object; } diff --git a/ufund-ui/src/app/components/funding-basket/funding-basket.component.html b/ufund-ui/src/app/components/funding-basket/funding-basket.component.html index 3f840e1..c4b12c9 100644 --- a/ufund-ui/src/app/components/funding-basket/funding-basket.component.html +++ b/ufund-ui/src/app/components/funding-basket/funding-basket.component.html @@ -8,7 +8,7 @@ deleteRemove from Basket - +