From 9cb65d0560ab228d399e10524535b096364729b2 Mon Sep 17 00:00:00 2001 From: Jaco Date: Mon, 9 Jan 2023 23:04:52 +0200 Subject: [PATCH] Add check for inactiveIssuance (#8740) --- .../page-referenda/src/Referenda/Summary.tsx | 50 ++++++++++--------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/packages/page-referenda/src/Referenda/Summary.tsx b/packages/page-referenda/src/Referenda/Summary.tsx index d9f364a1fb..e77f4cd259 100644 --- a/packages/page-referenda/src/Referenda/Summary.tsx +++ b/packages/page-referenda/src/Referenda/Summary.tsx @@ -7,8 +7,9 @@ import type { Summary as SummaryType } from '../types'; import React from 'react'; import { CardSummary, SummaryBox } from '@polkadot/react-components'; +import { useApi } from '@polkadot/react-hooks'; import { FormatBalance } from '@polkadot/react-query'; -import { formatNumber } from '@polkadot/util'; +import { formatNumber, isFunction } from '@polkadot/util'; import { useTranslation } from '../translate'; @@ -23,6 +24,7 @@ interface Props { function Summary ({ className, issuanceActive, issuanceInactive, issuanceTotal, summary: { refActive, refCount }, withIssuance }: Props): React.ReactElement { const { t } = useTranslation(); + const { api } = useApi(); return ( @@ -42,28 +44,6 @@ function Summary ({ className, issuanceActive, issuanceInactive, issuanceTotal, {withIssuance && (
- {issuanceInactive && ( - ('inactive issuance')} - > - - - )} - {issuanceActive && issuanceInactive && ( - ('active issuance')} - > - - - )} ('total issuance')}> + {isFunction(api.query.balances.inactiveIssuance) && ( + <> + ('inactive issuance')} + > + + + ('active issuance')} + > + + + + )}
)}