From 30e2b1c8ae0b1c6bdb0bda597788ec5446fd8e5f Mon Sep 17 00:00:00 2001 From: tom Date: Tue, 10 Sep 2024 15:27:48 +0200 Subject: [PATCH] fix null balance and result num --- types/api/addresses.ts | 2 +- ui/addresses/AddressesListItem.tsx | 2 +- ui/addresses/AddressesTableItem.tsx | 2 +- ui/addressesLabelSearch/AddressesLabelSearchListItem.tsx | 2 +- ui/addressesLabelSearch/AddressesLabelSearchTableItem.tsx | 2 +- ui/pages/AccountsLabelSearch.pw.tsx | 2 +- ui/pages/AccountsLabelSearch.tsx | 8 ++++++-- 7 files changed, 12 insertions(+), 8 deletions(-) diff --git a/types/api/addresses.ts b/types/api/addresses.ts index e0fdb666fd..3533b67655 100644 --- a/types/api/addresses.ts +++ b/types/api/addresses.ts @@ -1,6 +1,6 @@ import type { AddressParam } from './addressParams'; -export type AddressesItem = AddressParam &{ tx_count: string; coin_balance: string } +export type AddressesItem = AddressParam & { tx_count: string; coin_balance: string | null } export type AddressesResponse = { items: Array; diff --git a/ui/addresses/AddressesListItem.tsx b/ui/addresses/AddressesListItem.tsx index d147ff7970..462db87c80 100644 --- a/ui/addresses/AddressesListItem.tsx +++ b/ui/addresses/AddressesListItem.tsx @@ -25,7 +25,7 @@ const AddressesListItem = ({ isLoading, }: Props) => { - const addressBalance = BigNumber(item.coin_balance).div(BigNumber(10 ** config.chain.currency.decimals)); + const addressBalance = BigNumber(item.coin_balance || 0).div(BigNumber(10 ** config.chain.currency.decimals)); return ( diff --git a/ui/addresses/AddressesTableItem.tsx b/ui/addresses/AddressesTableItem.tsx index f5696f184f..06d849c211 100644 --- a/ui/addresses/AddressesTableItem.tsx +++ b/ui/addresses/AddressesTableItem.tsx @@ -24,7 +24,7 @@ const AddressesTableItem = ({ isLoading, }: Props) => { - const addressBalance = BigNumber(item.coin_balance).div(BigNumber(10 ** config.chain.currency.decimals)); + const addressBalance = BigNumber(item.coin_balance || 0).div(BigNumber(10 ** config.chain.currency.decimals)); const addressBalanceChunks = addressBalance.dp(8).toFormat().split('.'); return ( diff --git a/ui/addressesLabelSearch/AddressesLabelSearchListItem.tsx b/ui/addressesLabelSearch/AddressesLabelSearchListItem.tsx index 68e60ee2ec..f2145f93c7 100644 --- a/ui/addressesLabelSearch/AddressesLabelSearchListItem.tsx +++ b/ui/addressesLabelSearch/AddressesLabelSearchListItem.tsx @@ -19,7 +19,7 @@ const AddressesLabelSearchListItem = ({ isLoading, }: Props) => { - const addressBalance = BigNumber(item.coin_balance).div(BigNumber(10 ** config.chain.currency.decimals)); + const addressBalance = BigNumber(item.coin_balance || 0).div(BigNumber(10 ** config.chain.currency.decimals)); return ( diff --git a/ui/addressesLabelSearch/AddressesLabelSearchTableItem.tsx b/ui/addressesLabelSearch/AddressesLabelSearchTableItem.tsx index ae421bc20a..b768a56783 100644 --- a/ui/addressesLabelSearch/AddressesLabelSearchTableItem.tsx +++ b/ui/addressesLabelSearch/AddressesLabelSearchTableItem.tsx @@ -17,7 +17,7 @@ const AddressesLabelSearchTableItem = ({ isLoading, }: Props) => { - const addressBalance = BigNumber(item.coin_balance).div(BigNumber(10 ** config.chain.currency.decimals)); + const addressBalance = BigNumber(item.coin_balance || 0).div(BigNumber(10 ** config.chain.currency.decimals)); const addressBalanceChunks = addressBalance.dp(8).toFormat().split('.'); return ( diff --git a/ui/pages/AccountsLabelSearch.pw.tsx b/ui/pages/AccountsLabelSearch.pw.tsx index 315affcc36..86f637ca86 100644 --- a/ui/pages/AccountsLabelSearch.pw.tsx +++ b/ui/pages/AccountsLabelSearch.pw.tsx @@ -28,7 +28,7 @@ const addresses: AddressesMetadataSearchResult = { { ...addressMocks.eoa, tx_count: '420', - coin_balance: '123456', + coin_balance: null, }, ], next_page_params: null, diff --git a/ui/pages/AccountsLabelSearch.tsx b/ui/pages/AccountsLabelSearch.tsx index fbd99a3e80..4a99be6b2f 100644 --- a/ui/pages/AccountsLabelSearch.tsx +++ b/ui/pages/AccountsLabelSearch.tsx @@ -32,7 +32,7 @@ const AccountsLabelSearch = () => { options: { placeholderData: generateListStub<'addresses_metadata_search'>( TOP_ADDRESS, - 5, + 50, { next_page_params: null, }, @@ -83,7 +83,11 @@ const AccountsLabelSearch = () => { isLoaded={ !isPlaceholderData } display="inline-block" > - Found { num } matching result{ num > 1 ? 's' : '' } for + Found{ ' ' } + + { num }{ data?.next_page_params || pagination.page > 1 ? '+' : '' } + { ' ' } + matching result{ num > 1 ? 's' : '' } for