diff --git a/packages/app-settings/src/Developer.tsx b/packages/app-settings/src/Developer.tsx index 95ff151afa..f3cd2c98f3 100644 --- a/packages/app-settings/src/Developer.tsx +++ b/packages/app-settings/src/Developer.tsx @@ -7,7 +7,7 @@ import { AppProps, I18nProps } from '@polkadot/ui-app/types'; import React from 'react'; import store from 'store'; import { getTypeRegistry } from '@polkadot/types'; -import { Button, Editor, InputFile } from '@polkadot/ui-app'; +import { Button, Editor, InputFile, Labelled } from '@polkadot/ui-app'; import { ActionStatus } from '@polkadot/ui-app/Status/types'; import { isJsonObject, stringToU8a, u8aToString } from '@polkadot/util'; @@ -64,17 +64,14 @@ class Developer extends React.PureComponent {
-
- -
- -
-
+ + + >
diff --git a/packages/app-staking/src/Account/Bonding.tsx b/packages/app-staking/src/Account/Bonding.tsx index 5b34d869d0..b8a8c25ee5 100644 --- a/packages/app-staking/src/Account/Bonding.tsx +++ b/packages/app-staking/src/Account/Bonding.tsx @@ -96,6 +96,7 @@ class Bonding extends React.PureComponent { { { diff --git a/packages/app-staking/src/Account/Validating.tsx b/packages/app-staking/src/Account/Validating.tsx index 049841987c..d1008e9bfb 100644 --- a/packages/app-staking/src/Account/Validating.tsx +++ b/packages/app-staking/src/Account/Validating.tsx @@ -37,8 +37,6 @@ class Staking extends React.PureComponent { return null; } - console.error('preferences', props.preferences); - const { unstakeThreshold, validatorPayment } = props.preferences; return { @@ -103,7 +101,7 @@ class Staking extends React.PureComponent { return ( <> - {t('Staking')} + {t('Validating')} { autoFocus bitLength={32} className='medium' + help={t('The number of allowed slashes for this validator before being automatically unstaked (maximum of 10 allowed)')} label={t('unstake threshold')} onChange={this.onChangeThreshold} value={ unstakeThreshold ? unstakeThreshold.toString() - : '0' + : '3' } /> { {instances.toString()}
- {t('Reported offline {{instances}} times since block #{{blockNumber}}', { + {t('Reported offline {{instances}} times, last at block #{{blockNumber}}', { replace: { instances: instances.toString(), - blockNumber + blockNumber: formatNumber(blockNumber) } })}
diff --git a/packages/app-staking/src/Overview/Summary.tsx b/packages/app-staking/src/Overview/Summary.tsx index 94be7ec1e0..68b54ed9da 100644 --- a/packages/app-staking/src/Overview/Summary.tsx +++ b/packages/app-staking/src/Overview/Summary.tsx @@ -2,14 +2,13 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedBalances, DerivedBalancesMap } from '@polkadot/api-derive/types'; +import { DerivedBalancesMap } from '@polkadot/api-derive/types'; import { I18nProps } from '@polkadot/ui-app/types'; import BN from 'bn.js'; import React from 'react'; import SummarySession from '@polkadot/app-explorer/SummarySession'; import { SummaryBox, CardSummary } from '@polkadot/ui-app'; -import { formatBalance } from '@polkadot/util'; import { withCall, withMulti } from '@polkadot/ui-api'; import translate from '../translate'; @@ -25,6 +24,9 @@ type Props = I18nProps & { class Summary extends React.PureComponent { render () { const { className, intentions, style, t, staking_validatorCount, validators } = this.props; + const waiting = intentions.length > validators.length + ? (intentions.length - validators.length) + : 0; return ( { {validators.length}/{staking_validatorCount ? staking_validatorCount.toString() : '-'} - - {intentions.length} + + {waiting}
- {this.renderBalances()}
); } - - private renderBalances () { - const { intentions, t } = this.props; - - if (!intentions || !intentions.length) { - return null; - } - - return ( -
- - {this.renderBalancesCalculation()} - -
- ); - } - - private renderBalancesCalculation () { - const { t } = this.props; - const intentionHigh = this.calcIntentionsHigh(); - const validatorLow = this.calcValidatorLow(); - const nominatedLow = validatorLow && validatorLow.nominatedBalance.gtn(0) - ? `(+${formatBalance(validatorLow.nominatedBalance)})` - : ''; - const nominatedHigh = intentionHigh && intentionHigh.nominatedBalance.gtn(0) - ? `(+${formatBalance(intentionHigh.nominatedBalance)})` - : ''; - - return ( -
-
{t('lowest validator {{validatorLow}}', { - replace: { - validatorLow: validatorLow && validatorLow.stakingBalance - ? `${formatBalance(validatorLow.stakingBalance)} ${nominatedLow}` - : '-' - } - })}
-
{t('highest intention {{intentionHigh}}', { - replace: { - intentionHigh: intentionHigh - ? `${formatBalance(intentionHigh.stakingBalance)} ${nominatedHigh}` - : '-' - } - })}
-
- ); - } - - private calcIntentionsHigh (): DerivedBalances | null { - const { balances, intentions, validators } = this.props; - - return intentions.reduce((high: DerivedBalances | null, addr) => { - const balance = validators.includes(addr) || !balances[addr] - ? null - : balances[addr]; - - if (high === null || (balance && high.stakingBalance.lt(balance.stakingBalance))) { - return balance; - } - - return high; - }, null); - } - - private calcValidatorLow (): DerivedBalances | null { - const { balances, validators } = this.props; - - return validators.reduce((low: DerivedBalances | null, addr) => { - const balance = balances[addr] || null; - - if (low === null || (balance && low.stakingBalance.gt(balance.stakingBalance))) { - return balance; - } - - return low; - }, null); - } } export default withMulti( diff --git a/packages/ui-app/src/CardSummary.tsx b/packages/ui-app/src/CardSummary.tsx index a2b8cc050d..d5f7854108 100644 --- a/packages/ui-app/src/CardSummary.tsx +++ b/packages/ui-app/src/CardSummary.tsx @@ -75,13 +75,14 @@ type ProgressProps = { type Props = BareProps & { children?: React.ReactNode, + help?: React.ReactNode, label: React.ReactNode, progress?: ProgressProps }; export default class CardSummary extends React.PureComponent { render () { - const { children, className, label, progress, style } = this.props; + const { children, className, help, label, progress, style } = this.props; const value = progress && progress.value; const total = progress && progress.total; const left = progress && !isUndefined(value) && !isUndefined(total) && value.gten(0) && total.gtn(0) @@ -110,6 +111,7 @@ export default class CardSummary extends React.PureComponent { style={style} > diff --git a/packages/ui-app/src/Dropdown.tsx b/packages/ui-app/src/Dropdown.tsx index c87ded6f0b..d5111bd32c 100644 --- a/packages/ui-app/src/Dropdown.tsx +++ b/packages/ui-app/src/Dropdown.tsx @@ -14,6 +14,7 @@ import Labelled from './Labelled'; type Props