diff options
author | Tyler Ferrari <69283684+Sowgro@users.noreply.github.com> | 2025-04-05 20:18:10 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-05 20:18:10 -0400 |
commit | 95798c2b81da7f950850a6bb3c5be28e0323d5ba (patch) | |
tree | 7c0cf1c24c9177ba77468141e245f2b2f111e50b /ufund-ui/src/app/components/cupboard/cupboard.component.ts | |
parent | ef52495d781a3adcec79bfbc9067f70f5ec3c8ab (diff) | |
parent | 2f37b1de28399a361dc272b51ad624ac8902a562 (diff) | |
download | JellySolutions-95798c2b81da7f950850a6bb3c5be28e0323d5ba.tar.gz JellySolutions-95798c2b81da7f950850a6bb3c5be28e0323d5ba.tar.bz2 JellySolutions-95798c2b81da7f950850a6bb3c5be28e0323d5ba.zip |
Merge pull request #29 from RIT-SWEN-261-02/need-image
local persistence for need list data
Diffstat (limited to 'ufund-ui/src/app/components/cupboard/cupboard.component.ts')
-rw-r--r-- | ufund-ui/src/app/components/cupboard/cupboard.component.ts | 13 |
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; } |