From 50092a7b743d8b7717e0576bbcb8ec84319ff11e Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Wed, 27 Mar 2019 12:10:12 +0100 Subject: [PATCH] Rename Stake -> Validate, show controller/stash (#853) * Rename Stake -> Validate, show controller/stash * Small styling updates * account -> controller account --- CHANGELOG.md | 5 + packages/app-staking/src/Account/Bonding.tsx | 6 +- .../app-staking/src/Account/Nominating.tsx | 2 +- .../Account/{Staking.tsx => Validating.tsx} | 2 +- packages/app-staking/src/Account/index.tsx | 157 +++++++++++------- packages/app-staking/src/index.css | 20 ++- packages/apps/package.json | 2 +- packages/ui-api/package.json | 2 +- packages/ui-app/package.json | 8 +- yarn.lock | 46 ++--- 10 files changed, 150 insertions(+), 100 deletions(-) rename packages/app-staking/src/Account/{Staking.tsx => Validating.tsx} (98%) diff --git a/CHANGELOG.md b/CHANGELOG.md index a389f181ed..260a73d361 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 0.27.1 + +- Bring in new staking & nominating functions +- New faster crypto algorithms + # 0.26.1 - Swap keyring to HDKD derivation, mnemonic keys are now not backwards compatible with those created earlier. (Defaults are still for ed25519) diff --git a/packages/app-staking/src/Account/Bonding.tsx b/packages/app-staking/src/Account/Bonding.tsx index 92b945bfa8..f5afd757f9 100644 --- a/packages/app-staking/src/Account/Bonding.tsx +++ b/packages/app-staking/src/Account/Bonding.tsx @@ -12,7 +12,7 @@ import translate from '../translate'; type Props = I18nProps & { accountId: string, - sessionId: string, + bondedId: string, isOpen: boolean, onClose: () => void }; @@ -76,7 +76,7 @@ class Bonding extends React.PureComponent { } private renderContent () { - const { accountId, sessionId, t } = this.props; + const { accountId, bondedId, t } = this.props; const { controllerId } = this.state; return ( @@ -93,7 +93,7 @@ class Bonding extends React.PureComponent { /> { className='medium' defaultValue={accountId} isDisabled - label={t('account')} + label={t('controller account')} /> { className='medium' defaultValue={accountId} isDisabled - label={t('account')} + label={t('controller account')} /> { state: State = { isBondingOpen: false, - isKeyOpen: false, + isSessionKeyOpen: false, isNominateOpen: false, - isStakingOpen: false, + isValidatingOpen: false, isUnbondOpen: false, bondedId: null, sessionId: null, @@ -82,8 +82,8 @@ class Account extends React.PureComponent {
{this.renderBonding()} {this.renderNominating()} - {this.renderKey()} - {this.renderStaking()} + {this.renderSessionKey()} + {this.renderValidating()} { >
{this.renderButtons()} + {this.renderBondedId()} + {this.renderStashId()} {this.renderNominee()} {this.renderNominators()}
@@ -102,50 +104,50 @@ class Account extends React.PureComponent { private renderBonding () { const { accountId } = this.props; - const { sessionId, isBondingOpen } = this.state; + const { bondedId, isBondingOpen } = this.state; - if (!sessionId) { + if (!bondedId) { return null; } return ( ); } - private renderStaking () { + private renderValidating () { const { accountId, staking_validators } = this.props; - const { isStakingOpen, stashId } = this.state; + const { isValidatingOpen, stashId } = this.state; - if (!staking_validators || !isStakingOpen || !stashId) { + if (!staking_validators || !isValidatingOpen || !stashId) { return null; } return ( - ); } - private renderKey () { + private renderSessionKey () { const { accountId } = this.props; - const { isKeyOpen } = this.state; + const { isSessionKeyOpen } = this.state; return ( ); } @@ -177,11 +179,14 @@ class Account extends React.PureComponent { } return ( - +
+ + +
); } @@ -193,15 +198,54 @@ class Account extends React.PureComponent { } return ( -
- {staking_nominatorsFor.map((nominator) => ( - - ))} +
+ +
+ {staking_nominatorsFor.map((nominator) => ( + + ))} +
+
+ ); + } + + private renderBondedId () { + const { bondedId } = this.state; + + if (!bondedId) { + return null; + } + + return ( +
+ + +
+ ); + } + + private renderStashId () { + const { stashId } = this.state; + + if (!stashId) { + return null; + } + + return ( +
+ +
); } @@ -232,17 +276,7 @@ class Account extends React.PureComponent { const buttons = []; if (!stashId) { - buttons.push( -