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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abmp-npm",
3
- "version": "1.10.21",
3
+ "version": "1.10.23",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "check-cycles": "madge --circular .",
@@ -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
- if (newPage < 0 || newPage > 9) return;
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 === 9 ? _$w('#nextPage').disable() : _$w('#nextPage').enable();
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 (noOfPages === 0 || noOfPages === 1) {
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
- return;
478
+ } else {
479
+ _$w('#previousPage').enable();
477
480
  }
478
- if (currentPage === noOfPages - 1) {
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
- return;
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);