aboutsummaryrefslogtreecommitdiff
path: root/ufund-ui/src/app/components/cupboard/cupboard.component.ts
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2025-04-05 16:29:05 -0400
committersowgro <tpoke.ferrari@gmail.com>2025-04-05 16:29:05 -0400
commit80492e8f6f88bff8035e27b814cc9eacbee40c65 (patch)
tree1ccc4015e63543e32ac90beeb360326c6beedd8a /ufund-ui/src/app/components/cupboard/cupboard.component.ts
parentc2e7b170bfa0678a6ff4576d07388778f30084b0 (diff)
downloadJellySolutions-80492e8f6f88bff8035e27b814cc9eacbee40c65.tar.gz
JellySolutions-80492e8f6f88bff8035e27b814cc9eacbee40c65.tar.bz2
JellySolutions-80492e8f6f88bff8035e27b814cc9eacbee40c65.zip
Fix storage after merge
Diffstat (limited to 'ufund-ui/src/app/components/cupboard/cupboard.component.ts')
-rw-r--r--ufund-ui/src/app/components/cupboard/cupboard.component.ts13
1 files changed, 12 insertions, 1 deletions
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;
}