From bbacfd3f147c380995dcb167cc12cfb057998ebf Mon Sep 17 00:00:00 2001 From: isstuev Date: Thu, 12 Oct 2023 16:41:01 +0200 Subject: [PATCH] update tabs counters type --- stubs/address.ts | 1 - types/api/address.ts | 15 +++++++-------- ui/pages/Address.tsx | 1 - ui/shared/Tabs/TabCounter.tsx | 8 ++++---- ui/shared/Tabs/types.ts | 2 +- 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/stubs/address.ts b/stubs/address.ts index 22615996f1..f4c3ec2f52 100644 --- a/stubs/address.ts +++ b/stubs/address.ts @@ -43,7 +43,6 @@ export const ADDRESS_COUNTERS: AddressCounters = { }; export const ADDRESS_TABS_COUNTERS: AddressTabsCounters = { - coin_balances_count: 10, internal_txs_count: 10, logs_count: 10, token_balances_count: 10, diff --git a/types/api/address.ts b/types/api/address.ts index 069af70c20..10dc6aa757 100644 --- a/types/api/address.ts +++ b/types/api/address.ts @@ -152,12 +152,11 @@ export type AddressWithdrawalsItem = { } export type AddressTabsCounters = { - coin_balances_count: number; - internal_txs_count: number; - logs_count: number; - token_balances_count: number; - token_transfers_count: number; - transactions_count: number; - validations_count: number; - withdrawals_count: number; + internal_txs_count: number | null; + logs_count: number | null; + token_balances_count: number | null; + token_transfers_count: number | null; + transactions_count: number | null; + validations_count: number | null; + withdrawals_count: number | null; } diff --git a/ui/pages/Address.tsx b/ui/pages/Address.tsx index 994db587c9..7f1264373e 100644 --- a/ui/pages/Address.tsx +++ b/ui/pages/Address.tsx @@ -105,7 +105,6 @@ const AddressPageContent = () => { { id: 'coin_balance_history', title: 'Coin balance history', - count: addressTabsCountersQuery.data?.coin_balances_count, component: , }, config.chain.verificationType === 'validation' && addressTabsCountersQuery.data?.validations_count ? diff --git a/ui/shared/Tabs/TabCounter.tsx b/ui/shared/Tabs/TabCounter.tsx index 8b5d72adc7..139e98a4b3 100644 --- a/ui/shared/Tabs/TabCounter.tsx +++ b/ui/shared/Tabs/TabCounter.tsx @@ -5,15 +5,15 @@ import React from 'react'; const COUNTER_OVERLOAD = 50; type Props = { - count?: number; + count?: number | null; parentClassName: string; } -const TasCounter = ({ count, parentClassName }: Props) => { +const TabCounter = ({ count, parentClassName }: Props) => { const zeroCountColor = useColorModeValue('blackAlpha.400', 'whiteAlpha.400'); - if (count === undefined) { + if (count === undefined || count === null) { return null; } @@ -35,4 +35,4 @@ const TasCounter = ({ count, parentClassName }: Props) => { ); }; -export default TasCounter; +export default TabCounter; diff --git a/ui/shared/Tabs/types.ts b/ui/shared/Tabs/types.ts index 553cc8d0eb..d790d5245e 100644 --- a/ui/shared/Tabs/types.ts +++ b/ui/shared/Tabs/types.ts @@ -3,7 +3,7 @@ import type React from 'react'; export interface TabItem { id: string; title: string | (() => React.ReactNode); - count?: number; + count?: number | null; component: React.ReactNode; }