abmp-npm 1.10.21 → 1.10.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/public/Utils/homePage.js +11 -9
package/package.json
CHANGED
package/public/Utils/homePage.js
CHANGED
|
@@ -120,9 +120,11 @@ const createHomepageUtils = (_$w, filterProfiles) => {
|
|
|
120
120
|
});
|
|
121
121
|
async function handlePagination({ delta, pagination, searchResults, filter }) {
|
|
122
122
|
const newPage = pagination.currentPage + delta;
|
|
123
|
-
|
|
123
|
+
const maxPage = pagination.totalPages ? pagination.totalPages - 1 : 0;
|
|
124
|
+
if (newPage < 0 || newPage > maxPage) return;
|
|
125
|
+
|
|
124
126
|
newPage === 0 ? _$w('#previousPage').disable() : _$w('#previousPage').enable();
|
|
125
|
-
newPage ===
|
|
127
|
+
newPage === maxPage ? _$w('#nextPage').disable() : _$w('#nextPage').enable();
|
|
126
128
|
pagination.currentPage = newPage;
|
|
127
129
|
|
|
128
130
|
paginateSearchResults(searchResults, pagination);
|
|
@@ -466,22 +468,22 @@ const createHomepageUtils = (_$w, filterProfiles) => {
|
|
|
466
468
|
currentPageButtonIterator.collapse();
|
|
467
469
|
}
|
|
468
470
|
}
|
|
469
|
-
if (
|
|
471
|
+
if (totalPages === 0 || totalPages === 1) {
|
|
470
472
|
_$w('#previousPage').disable();
|
|
471
473
|
_$w('#nextPage').disable();
|
|
472
474
|
return;
|
|
473
475
|
}
|
|
474
476
|
if (currentPage === 0) {
|
|
475
477
|
_$w('#previousPage').disable();
|
|
476
|
-
|
|
478
|
+
} else {
|
|
479
|
+
_$w('#previousPage').enable();
|
|
477
480
|
}
|
|
478
|
-
|
|
481
|
+
// Use totalPages (not noOfPages) to check if we're on the last page
|
|
482
|
+
if (currentPage >= totalPages - 1) {
|
|
479
483
|
_$w('#nextPage').disable();
|
|
480
|
-
|
|
484
|
+
} else {
|
|
485
|
+
_$w('#nextPage').enable();
|
|
481
486
|
}
|
|
482
|
-
|
|
483
|
-
_$w('#previousPage').enable();
|
|
484
|
-
_$w('#nextPage').enable();
|
|
485
487
|
}
|
|
486
488
|
function paginateSearchResults(searchResults, pagination) {
|
|
487
489
|
updatePaginationUI(pagination);
|