Fix nominate display, add commission display (#1703)
* Fix nominating display, Closes https://github.com/polkadot-js/apps/issues/1701 * Add commission display on staking overview
This commit is contained in:
parent
fe9b97e1d2
commit
024a55e3d0
@ -208,7 +208,7 @@ class Account extends React.PureComponent<Props, State> {
|
||||
withValidatorPrefs={isStashValidating}
|
||||
/>
|
||||
</div>
|
||||
{nominees && nominees.length && (
|
||||
{nominees && nominees.length !== 0 && (
|
||||
<div className='staking--Account-Nominee'>
|
||||
<label className='staking--label'>{t('nominating')}</label>
|
||||
{nominees.map((nomineeId, index): React.ReactNode => (
|
||||
|
||||
@ -132,8 +132,9 @@ class Address extends React.PureComponent<Props, State> {
|
||||
key={stashId || controllerId || undefined}
|
||||
value={stashId || address}
|
||||
withBalance={{ bonded }}
|
||||
withValidatorPrefs={{ validatorPayment: true }}
|
||||
>
|
||||
{nominators.length && (
|
||||
{nominators.length !== 0 && (
|
||||
<details>
|
||||
<summary>
|
||||
{t('Nominators ({{count}})', {
|
||||
|
||||
@ -154,10 +154,9 @@ function renderValidatorPrefs ({ staking_info, t, withValidatorPrefs = false }:
|
||||
return null;
|
||||
}
|
||||
|
||||
// start with a spacer
|
||||
return (
|
||||
<>
|
||||
<div className='spacer'></div>
|
||||
<div />
|
||||
{validatorPrefsDisplay.unstakeThreshold && (staking_info.validatorPrefs as ValidatorPrefs0to145).unstakeThreshold && (
|
||||
<>
|
||||
<Label label={t('unstake threshold')} />
|
||||
@ -168,7 +167,7 @@ function renderValidatorPrefs ({ staking_info, t, withValidatorPrefs = false }:
|
||||
)}
|
||||
{validatorPrefsDisplay.validatorPayment && staking_info.validatorPrefs.validatorPayment && (
|
||||
<>
|
||||
<Label label={t('commision')} />
|
||||
<Label label={t('commission')} />
|
||||
<div className='result'>{
|
||||
formatBalance(staking_info.validatorPrefs.validatorPayment)
|
||||
}</div>
|
||||
@ -303,10 +302,6 @@ export default withMulti(
|
||||
background: white !important;
|
||||
}
|
||||
}
|
||||
|
||||
.spacer {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
}
|
||||
`,
|
||||
translate,
|
||||
|
||||
@ -14,7 +14,7 @@ import { withCalls, withMulti } from '@polkadot/react-api';
|
||||
import BaseIdentityIcon from '@polkadot/react-identicon';
|
||||
import keyring from '@polkadot/ui-keyring';
|
||||
|
||||
import AddressInfo, { BalanceActiveType } from './AddressInfo';
|
||||
import AddressInfo, { BalanceActiveType, ValidatorPrefsType } from './AddressInfo';
|
||||
import { classes, getAddressName, getAddressTags, toShortAddress } from './util';
|
||||
import CopyButton from './CopyButton';
|
||||
import IdentityIcon, { getIdentityTheme } from './IdentityIcon';
|
||||
@ -30,6 +30,7 @@ export interface Props extends I18nProps, RowProps {
|
||||
withAddressOrName?: boolean;
|
||||
withBalance?: boolean | BalanceActiveType;
|
||||
withIndex?: boolean;
|
||||
withValidatorPrefs?: boolean | ValidatorPrefsType;
|
||||
}
|
||||
|
||||
const DEFAULT_ADDR = '5'.padEnd(16, 'x');
|
||||
@ -160,10 +161,10 @@ class AddressRow extends Row<ApiProps & Props, State> {
|
||||
}
|
||||
|
||||
private renderBalances (): React.ReactNode {
|
||||
const { accounts_idAndIndex = [], withBalance } = this.props;
|
||||
const { accounts_idAndIndex = [], withBalance, withValidatorPrefs } = this.props;
|
||||
const [accountId] = accounts_idAndIndex;
|
||||
|
||||
if (!withBalance || !accountId) {
|
||||
if (!(withBalance || withValidatorPrefs) || !accountId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -172,6 +173,7 @@ class AddressRow extends Row<ApiProps & Props, State> {
|
||||
<AddressInfo
|
||||
address={accountId}
|
||||
withBalance={withBalance}
|
||||
withValidatorPrefs={withValidatorPrefs}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user