From 7cb4046c2ed565562c57892762d851f05432ddc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20M=C4=83rgineanu?= Date: Mon, 9 Dec 2024 18:16:09 +0200 Subject: [PATCH 1/6] Add pagination count parameter. --- src/UI/Pagination/Pagination.tsx | 2 +- .../LedgerLoginContainer/AddressTable/AddressTable.tsx | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/UI/Pagination/Pagination.tsx b/src/UI/Pagination/Pagination.tsx index 30bc5facc..f4fdfcf6f 100644 --- a/src/UI/Pagination/Pagination.tsx +++ b/src/UI/Pagination/Pagination.tsx @@ -91,7 +91,7 @@ const PaginationComponent = ({ } }, [currentPage, currentPageIndex]); - if (totalPages === 1) { + if (totalPages <= 1) { return null; } diff --git a/src/UI/ledger/LedgerLoginContainer/AddressTable/AddressTable.tsx b/src/UI/ledger/LedgerLoginContainer/AddressTable/AddressTable.tsx index 0d7e8f767..13df098c6 100644 --- a/src/UI/ledger/LedgerLoginContainer/AddressTable/AddressTable.tsx +++ b/src/UI/ledger/LedgerLoginContainer/AddressTable/AddressTable.tsx @@ -12,7 +12,7 @@ import { LedgerColumnsEnum } from '../enums'; import { LedgerLoading } from '../LedgerLoading'; const ADDRESSES_PER_PAGE = 10; -const TOTAL_ADDRESSES_PAGES = 500; +const TOTAL_ADDRESSES_COUNT = 5000; export interface AddressTablePropsType extends WithClassnameType { accounts: string[]; @@ -27,6 +27,7 @@ export interface AddressTablePropsType extends WithClassnameType { ledgerModalTableSelectedItemClassName?: string; ledgerModalTableNavigationButtonDisabledClassName?: string; }; + addressesCount?: number; customContentComponent?: ReactNode; dataTestId?: string; loading: boolean; @@ -42,6 +43,7 @@ export interface AddressTablePropsType extends WithClassnameType { const AddressTableComponent = ({ accounts, addressTableClassNames, + addressesCount = TOTAL_ADDRESSES_COUNT, className = 'dapp-ledger-address-table', customContentComponent, dataTestId = DataTestIdsEnum.addressTableContainer, @@ -140,6 +142,7 @@ const AddressTableComponent = ({ onGoToSpecificPage(newPage - 1); }; + const totalPages = addressesCount / ADDRESSES_PER_PAGE; const columns = [ LedgerColumnsEnum.Address, LedgerColumnsEnum.Balance, @@ -213,7 +216,7 @@ const AddressTableComponent = ({ Date: Mon, 9 Dec 2024 18:17:07 +0200 Subject: [PATCH 2/6] Updated CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6049343d9..472b7437b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- [Add pagination item count support](https://github.com/multiversx/mx-sdk-dapp/pull/1343) + ## [[v3.1.1](https://github.com/multiversx/mx-sdk-dapp/pull/1342)] - 2024-12-09 + - [Fix dApp compatibility check (webview provider)](https://github.com/multiversx/mx-sdk-dapp/pull/1341) ## [[v3.1.0](https://github.com/multiversx/mx-sdk-dapp/pull/1339)] - 2024-12-05 From ab332c8372746ee14fc477e6a55b5006cedaf497 Mon Sep 17 00:00:00 2001 From: Miro Date: Mon, 9 Dec 2024 18:19:46 +0200 Subject: [PATCH 3/6] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 472b7437b..ada315423 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -- [Add pagination item count support](https://github.com/multiversx/mx-sdk-dapp/pull/1343) +- [Add pagination item count support to "AddressTable"](https://github.com/multiversx/mx-sdk-dapp/pull/1343) ## [[v3.1.1](https://github.com/multiversx/mx-sdk-dapp/pull/1342)] - 2024-12-09 From 751168b7aad204fe9e5a7815db3b20f549a88fdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20M=C4=83rgineanu?= Date: Mon, 9 Dec 2024 18:23:45 +0200 Subject: [PATCH 4/6] Added Math.ceil --- .../ledger/LedgerLoginContainer/AddressTable/AddressTable.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UI/ledger/LedgerLoginContainer/AddressTable/AddressTable.tsx b/src/UI/ledger/LedgerLoginContainer/AddressTable/AddressTable.tsx index 13df098c6..2b935984f 100644 --- a/src/UI/ledger/LedgerLoginContainer/AddressTable/AddressTable.tsx +++ b/src/UI/ledger/LedgerLoginContainer/AddressTable/AddressTable.tsx @@ -142,7 +142,7 @@ const AddressTableComponent = ({ onGoToSpecificPage(newPage - 1); }; - const totalPages = addressesCount / ADDRESSES_PER_PAGE; + const totalPages = Math.ceil(addressesCount / ADDRESSES_PER_PAGE); const columns = [ LedgerColumnsEnum.Address, LedgerColumnsEnum.Balance, From 7e20cb07c1f504644636751a4549fcdd3ee2e9d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20M=C4=83rgineanu?= Date: Mon, 9 Dec 2024 18:25:21 +0200 Subject: [PATCH 5/6] 3.1.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 20b51b0f8..bdeeb10c0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@multiversx/sdk-dapp", - "version": "3.1.1", + "version": "3.1.2", "description": "A library to hold the main logic for a dapp on the MultiversX blockchain", "author": "MultiversX", "license": "GPL-3.0-or-later", From fbe5c5b298292602d58c712bc00f65f4ef241603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20M=C4=83rgineanu?= Date: Mon, 9 Dec 2024 18:25:44 +0200 Subject: [PATCH 6/6] Updated CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ada315423..f64e61ef7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [[v3.1.2](https://github.com/multiversx/mx-sdk-dapp/pull/1344)] - 2024-12-09 + - [Add pagination item count support to "AddressTable"](https://github.com/multiversx/mx-sdk-dapp/pull/1343) ## [[v3.1.1](https://github.com/multiversx/mx-sdk-dapp/pull/1342)] - 2024-12-09