treding page: fix pagination error

This commit is contained in:
X4Lo committed 2024-04-16 10:23:06 +01:00
1 parent 7dec0d6149
commit 282a0a413e
3 files changed
+14 -4

No files matched your search

@@ -4,13 +4,20 @@
border-bottom-right-radius: 0; border-bottom-right-radius: 0;
} }
.custom-group .form-select,
.custom-group .input-group-text {
border: 1px black solid;
}
.custom-group .btn-group .btn { .custom-group .btn-group .btn {
border-radius: 0; /* Remove rounding from buttons inside the group */ border-radius: 0;
} }
.custom-group .btn-group .left-btn { .custom-group .btn-group .left-btn {
border-top-left-radius: 0.25rem; /* Reapply rounding to the left-most button */ /* border-top-left-radius: 0.25rem; */
border-bottom-left-radius: 0.25rem; /* border-bottom-left-radius: 0.25rem; */
border-left: 0;
border-right: 0;
} }
.custom-group .btn-group .right-btn { .custom-group .btn-group .right-btn {
@@ -14,6 +14,7 @@
</div> </div>
<div class="ms-auto"> <div class="ms-auto">
<div class="input-group custom-group"> <div class="input-group custom-group">
<div class="input-group-text">Period</div>
<select class="form-select" id="single-select-field" data-placeholder="Choose one thing" style="max-width: 150px;" <select class="form-select" id="single-select-field" data-placeholder="Choose one thing" style="max-width: 150px;"
[(ngModel)]="period" (change)="updatePeriod($event)"> [(ngModel)]="period" (change)="updatePeriod($event)">
<option value="day">Daily</option> <option value="day">Daily</option>
@@ -23,17 +23,19 @@ export class TrendingComponent {
setEntryType(entryType: boolean) { setEntryType(entryType: boolean) {
this.entryType = entryType; this.entryType = entryType;
this.currentPage = 1;
this.fetchEntries(); this.fetchEntries();
} }
updatePeriod(event: any) { updatePeriod(event: any) {
this.period = event.target.value; this.period = event.target.value;
this.currentPage = 1;
this.fetchEntries(); this.fetchEntries();
} }
fetchEntries() { fetchEntries() {
this.tmdbService this.tmdbService
.getPopular(this.currentPage, this.entryType) .getTrending(this.currentPage, this.entryType, this.period)
.subscribe((myEntries) => { .subscribe((myEntries) => {
this.entries = myEntries; this.entries = myEntries;
}); });