diff --git a/packages/app-address-book/src/Address.tsx b/packages/app-address-book/src/Address.tsx index 83a4ffe3fa..350e23d624 100644 --- a/packages/app-address-book/src/Address.tsx +++ b/packages/app-address-book/src/Address.tsx @@ -20,7 +20,7 @@ interface Props extends I18nProps { className?: string; } -const WITH_BALANCE = { available: true, bonded: true, free: true, total: true }; +const WITH_BALANCE = { available: true, bonded: true, free: true, reserved: true, total: true }; const WITH_EXTENDED = { nonce: true }; const isEditable = true; diff --git a/packages/app-council/src/Overview/Summary.tsx b/packages/app-council/src/Overview/Summary.tsx index 232b637625..ca5ee1c27c 100644 --- a/packages/app-council/src/Overview/Summary.tsx +++ b/packages/app-council/src/Overview/Summary.tsx @@ -4,6 +4,7 @@ // of the Apache-2.0 license. See the LICENSE file for details. import { I18nProps } from '@polkadot/react-components/types'; +import { BlockNumber } from '@polkadot/types/interfaces'; import { ComponentProps } from './types'; import React from 'react'; @@ -12,9 +13,11 @@ import { formatNumber } from '@polkadot/util'; import translate from '../translate'; -interface Props extends I18nProps, ComponentProps {} +interface Props extends I18nProps, ComponentProps { + bestNumber?: BlockNumber; +} -function Summary ({ electionsInfo: { members, candidateCount, desiredSeats, termDuration, voteCount }, t }: Props): React.ReactElement { +function Summary ({ bestNumber, electionsInfo: { members, candidateCount, desiredSeats, termDuration, voteCount }, t }: Props): React.ReactElement { return (
@@ -32,11 +35,17 @@ function Summary ({ electionsInfo: { members, candidateCount, desiredSeats, term
)} -
- - {formatNumber(termDuration)} - -
+ {bestNumber && termDuration && termDuration.gtn(0) && ( +
+ +
+ )}
); } diff --git a/packages/app-council/src/Overview/index.tsx b/packages/app-council/src/Overview/index.tsx index 2f102723b4..00519a7bb0 100644 --- a/packages/app-council/src/Overview/index.tsx +++ b/packages/app-council/src/Overview/index.tsx @@ -3,7 +3,8 @@ // of the Apache-2.0 license. See the LICENSE file for details. import { DerivedElectionsInfo } from '@polkadot/api-derive/types'; -import { ComponentProps as Props } from './types'; +import { BlockNumber } from '@polkadot/types/interfaces'; +import { ComponentProps } from './types'; import React from 'react'; import { withCalls } from '@polkadot/react-api'; @@ -15,6 +16,10 @@ import SubmitCandidacy from './SubmitCandidacy'; import Summary from './Summary'; import Vote from './Vote'; +interface Props extends ComponentProps { + bestNumber?: BlockNumber; +} + const NULL_INFO: DerivedElectionsInfo = { candidates: [], candidateCount: createType('u32'), @@ -23,10 +28,13 @@ const NULL_INFO: DerivedElectionsInfo = { termDuration: createType('BlockNumber') }; -function Overview ({ electionsInfo = NULL_INFO }: Props): React.ReactElement { +function Overview ({ bestNumber, electionsInfo = NULL_INFO }: Props): React.ReactElement { return ( <> - + @@ -40,5 +48,8 @@ function Overview ({ electionsInfo = NULL_INFO }: Props): React.ReactElement( ['derive.elections.info', { propName: 'electionsInfo' + }], + ['derive.chain.bestNumber', { + propName: 'bestNumber' }] )(Overview); diff --git a/packages/react-components/src/AddressInfo.tsx b/packages/react-components/src/AddressInfo.tsx index 6301e94150..9e97f2ee3a 100644 --- a/packages/react-components/src/AddressInfo.tsx +++ b/packages/react-components/src/AddressInfo.tsx @@ -23,6 +23,7 @@ export interface BalanceActiveType { available?: boolean; bonded?: boolean | BN[]; redeemable?: boolean; + reserved?: boolean; total?: boolean; unlocking?: boolean; } @@ -49,10 +50,11 @@ interface Props extends BareProps, I18nProps { withValidatorPrefs?: boolean | ValidatorPrefsType; } -const DEFAULT_BALANCES = { +const DEFAULT_BALANCES: BalanceActiveType = { available: true, bonded: true, redeemable: true, + reserved: true, total: true, unlocking: true }; @@ -207,6 +209,12 @@ function renderBalances (props: Props): React.ReactNode {
{formatBalance(balances_all.availableBalance)}
)} + {balanceDisplay.reserved && balances_all.reservedBalance && balances_all.reservedBalance.gtn(0) && ( + <> +