aboutsummaryrefslogtreecommitdiff
path: root/ufund-ui/src/app/components/need-list
diff options
context:
space:
mode:
Diffstat (limited to 'ufund-ui/src/app/components/need-list')
-rw-r--r--ufund-ui/src/app/components/need-list/need-list.component.css33
-rw-r--r--ufund-ui/src/app/components/need-list/need-list.component.ts22
2 files changed, 8 insertions, 47 deletions
diff --git a/ufund-ui/src/app/components/need-list/need-list.component.css b/ufund-ui/src/app/components/need-list/need-list.component.css
index e17609b..582b832 100644
--- a/ufund-ui/src/app/components/need-list/need-list.component.css
+++ b/ufund-ui/src/app/components/need-list/need-list.component.css
@@ -1,9 +1,3 @@
-#header {
- display: flex;
- flex-direction: column;
- gap: 10px
-}
-
.needEntry {
background-color: #2e2e2e;
display: flex;
@@ -17,33 +11,6 @@
gap: 15px
}
-select {
- font-size: 14pt;
- padding: 5px;
-}
-
-#searchArea {
- display: flex;
-
- form {
- display: flex;
- width: 100%;
- gap: 10px;
- }
-
- input[type=text] {
- display: flex;
- width: 100%;
- }
-}
-
-#sortArea {
- display: flex;
- flex-direction: row;
- gap: 10px;
- align-items: center;
-}
-
.needName {
font-weight: bold;
}
diff --git a/ufund-ui/src/app/components/need-list/need-list.component.ts b/ufund-ui/src/app/components/need-list/need-list.component.ts
index d637005..d027690 100644
--- a/ufund-ui/src/app/components/need-list/need-list.component.ts
+++ b/ufund-ui/src/app/components/need-list/need-list.component.ts
@@ -1,6 +1,6 @@
-import {Component, Input, OnInit} from '@angular/core';
+import {Component, Input, OnChanges, OnInit} from '@angular/core';
import {Need} from '../../models/Need';
-import {BehaviorSubject, Observable} from 'rxjs';
+import {Observable} from 'rxjs';
@Component({
selector: 'app-need-list',
@@ -8,9 +8,9 @@ import {BehaviorSubject, Observable} from 'rxjs';
templateUrl: './need-list.component.html',
styleUrl: './need-list.component.css'
})
-export class NeedListComponent implements OnInit {
+export class NeedListComponent implements OnChanges {
- @Input({required: true}) needs!: Observable<Need[]>
+ @Input({required: true}) needs!: Need[]
visibleNeeds: Need[] = [];
currentPage: number = 0;
@@ -21,14 +21,8 @@ export class NeedListComponent implements OnInit {
) {}
- ngOnInit() {
- this.needs.subscribe(needs => {
- this.totalPages = Math.ceil(needs.length / this.itemsPerPage);
- this.totalPages = Math.ceil(needs.length / this.itemsPerPage);
- this.visibleNeeds = needs.slice(this.currentPage * this.itemsPerPage, (this.currentPage + 1) * this.itemsPerPage);
- console.log(needs.length)
- })
-
+ ngOnChanges() {
+ this.updateVisibleNeeds()
}
decrementPage() {
@@ -57,8 +51,8 @@ export class NeedListComponent implements OnInit {
}
updateVisibleNeeds() {
- // this.totalPages = Math.ceil(this.needs.length / this.itemsPerPage);
- // this.visibleNeeds = this.needs.slice(this.currentPage * this.itemsPerPage, (this.currentPage + 1) * this.itemsPerPage);
+ this.totalPages = Math.ceil(this.needs.length / this.itemsPerPage);
+ this.visibleNeeds = this.needs.slice(this.currentPage * this.itemsPerPage, (this.currentPage + 1) * this.itemsPerPage);
}
resetVisibleNeeds() {