@rpg-engine/long-bow 0.8.163 → 0.8.165

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": "@rpg-engine/long-bow",
3
- "version": "0.8.163",
3
+ "version": "0.8.165",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -90,7 +90,6 @@ export const BuyPanel: React.FC<IBuyPanelProps> = ({
90
90
  dcBalance = 0,
91
91
  dcToGoldSwapRate = 0,
92
92
  openBuyOrders = [],
93
- openBuyOrdersTotal = 0,
94
93
  openBuyOrdersPage = 1,
95
94
  onOpenBuyOrdersPageChange,
96
95
  isLoading = false,
@@ -191,6 +190,11 @@ export const BuyPanel: React.FC<IBuyPanelProps> = ({
191
190
  });
192
191
  }, [visibleBuyOrders]);
193
192
 
193
+ const paginatedGroupedBuyOrders = useMemo(() => {
194
+ const start = (openBuyOrdersPage - 1) * BUY_REQUESTS_PER_PAGE;
195
+ return groupedBuyOrders.slice(start, start + BUY_REQUESTS_PER_PAGE);
196
+ }, [groupedBuyOrders, openBuyOrdersPage]);
197
+
194
198
  const showSellSection = browseMode === 'sell';
195
199
  const showBuySection = browseMode === 'buy';
196
200
  const hasVisibleContent =
@@ -447,7 +451,7 @@ export const BuyPanel: React.FC<IBuyPanelProps> = ({
447
451
  {groupedBuyOrders.length === 0 ? (
448
452
  <SectionEmpty>No public buy requests found.</SectionEmpty>
449
453
  ) : (
450
- groupedBuyOrders.map(({ bestOrder, otherOrders }) => (
454
+ paginatedGroupedBuyOrders.map(({ bestOrder, otherOrders }) => (
451
455
  <GroupedBuyOrderRow
452
456
  key={bestOrder._id}
453
457
  bestOrder={bestOrder}
@@ -473,9 +477,9 @@ export const BuyPanel: React.FC<IBuyPanelProps> = ({
473
477
  onPageChange={onPageChange}
474
478
  />
475
479
  )}
476
- {showBuySection && openBuyOrdersTotal > BUY_REQUESTS_PER_PAGE && (
480
+ {showBuySection && groupedBuyOrders.length > BUY_REQUESTS_PER_PAGE && (
477
481
  <Pager
478
- totalItems={openBuyOrdersTotal}
482
+ totalItems={groupedBuyOrders.length}
479
483
  currentPage={openBuyOrdersPage}
480
484
  itemsPerPage={BUY_REQUESTS_PER_PAGE}
481
485
  onPageChange={onOpenBuyOrdersPageChange ?? (() => {})}