diff --git a/packages/page-explorer/src/Summary.tsx b/packages/page-explorer/src/Summary.tsx index 51c69d9067..056ad8daad 100644 --- a/packages/page-explorer/src/Summary.tsx +++ b/packages/page-explorer/src/Summary.tsx @@ -5,7 +5,7 @@ import React from 'react'; import { CardSummary, SummaryBox } from '@polkadot/react-components'; import { useApi } from '@polkadot/react-hooks'; -import { BestFinalized, BestNumber, BlockToTime, TimeNow, TotalIssuance } from '@polkadot/react-query'; +import { BestFinalized, BestNumber, BlockToTime, TimeNow, TotalInactive, TotalIssuance } from '@polkadot/react-query'; import { BN_ONE, formatNumber } from '@polkadot/util'; import SummarySession from './SummarySession'; @@ -36,20 +36,30 @@ function Summary ({ eventCount }: Props): React.ReactElement { )} {api.query.balances && ( - ('total issuance')} - > - - + <> + ('total issuance')} + > + + + {!!api.query.balances.inactiveIssuance && ( + ('inactive issuance')} + > + + + )} + )} -
+
('last events')} > {formatNumber(eventCount)} diff --git a/packages/page-referenda/src/Referenda/Summary.tsx b/packages/page-referenda/src/Referenda/Summary.tsx index d301787aed..18b935b8d0 100644 --- a/packages/page-referenda/src/Referenda/Summary.tsx +++ b/packages/page-referenda/src/Referenda/Summary.tsx @@ -1,21 +1,27 @@ // Copyright 2017-2022 @polkadot/app-referenda authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { BN } from '@polkadot/util'; import type { Summary as SummaryType } from '../types'; import React from 'react'; import { CardSummary, Spinner, SummaryBox } from '@polkadot/react-components'; +import { FormatBalance } from '@polkadot/react-query'; import { formatNumber } from '@polkadot/util'; import { useTranslation } from '../translate'; interface Props { className?: string; + issuanceActive?: BN; + issuanceInactive?: BN; + issuanceTotal?: BN; summary: SummaryType; + withIssuance?: boolean; } -function Summary ({ className, summary: { refActive, refCount } }: Props): React.ReactElement { +function Summary ({ className, issuanceActive, issuanceInactive, issuanceTotal, summary: { refActive, refCount }, withIssuance }: Props): React.ReactElement { const { t } = useTranslation(); return ( @@ -34,6 +40,34 @@ function Summary ({ className, summary: { refActive, refCount } }: Props): React }
+ {withIssuance && ( +
+ {issuanceTotal && ( + ('total issuance')}> + + + )} + {issuanceInactive && ( + ('inactive issuance')}> + + + )} + {issuanceActive && issuanceInactive && ( + ('active issuance')}> + + + )} +
+ )} ); } diff --git a/packages/page-referenda/src/Referenda/index.tsx b/packages/page-referenda/src/Referenda/index.tsx index 759658713a..2bf817615c 100644 --- a/packages/page-referenda/src/Referenda/index.tsx +++ b/packages/page-referenda/src/Referenda/index.tsx @@ -23,13 +23,14 @@ export { useCounterNamed as useCounter } from '../useCounter'; interface Props { className?: string; + isConvictionVote?: boolean; members?: string[]; palletReferenda: PalletReferenda; palletVote: PalletVote; ranks?: BN[]; } -function Referenda ({ className, members, palletReferenda, palletVote, ranks }: Props): React.ReactElement { +function Referenda ({ className, isConvictionVote, members, palletReferenda, palletVote, ranks }: Props): React.ReactElement { const { t } = useTranslation(); const { api } = useApi(); const totalIssuance = useCall(api.query.balances.totalIssuance); @@ -72,7 +73,13 @@ function Referenda ({ className, members, palletReferenda, palletVote, ranks }: return (
- + { items={tabsRef.current} /> diff --git a/packages/react-query/src/TotalInactive.tsx b/packages/react-query/src/TotalInactive.tsx new file mode 100644 index 0000000000..05876d5a7f --- /dev/null +++ b/packages/react-query/src/TotalInactive.tsx @@ -0,0 +1,36 @@ +// Copyright 2017-2022 @polkadot/react-query authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +import React from 'react'; + +import { useApi, useCall } from '@polkadot/react-hooks'; + +import FormatBalance from './FormatBalance'; + +interface Props { + children?: React.ReactNode; + className?: string; + label?: React.ReactNode; +} + +function TotalInactive ({ children, className = '', label }: Props): React.ReactElement | null { + const { api } = useApi(); + const inactiveIssuance = useCall(api.query.balances?.inactiveIssuance); + + if (!inactiveIssuance) { + return null; + } + + return ( +
+ {label || ''} + + {children} +
+ ); +} + +export default React.memo(TotalInactive); diff --git a/packages/react-query/src/index.ts b/packages/react-query/src/index.ts index a0ba8da369..c076dd1112 100644 --- a/packages/react-query/src/index.ts +++ b/packages/react-query/src/index.ts @@ -19,4 +19,5 @@ export { default as NodeVersion } from './NodeVersion'; export { default as Nonce } from './Nonce'; export { default as SessionToTime } from './SessionToTime'; export { default as TimeNow } from './TimeNow'; +export { default as TotalInactive } from './TotalInactive'; export { default as TotalIssuance } from './TotalIssuance';