From e86fb8de438d9f5ca59abd2288234678bc666dda Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Mon, 21 Jan 2019 14:10:52 +0100 Subject: [PATCH] Add setting of ValidatorPrefs (#624) * Add setting of ValidatorPrefs * Bump API * Pull through initial values in InputNumber --- .../app-staking/src/StakeList/Account.tsx | 45 +++++- .../app-staking/src/StakeList/Nominating.tsx | 3 +- .../app-staking/src/StakeList/Preferences.tsx | 152 ++++++++++++++++++ packages/ui-api/package.json | 4 +- packages/ui-app/package.json | 6 +- packages/ui-app/src/InputNumber.tsx | 8 +- packages/ui-app/src/styles/components.css | 4 + packages/ui-reactive/package.json | 4 +- packages/ui-signer/src/Modal.tsx | 4 +- yarn.lock | 104 ++++++------ 10 files changed, 266 insertions(+), 68 deletions(-) create mode 100644 packages/app-staking/src/StakeList/Preferences.tsx diff --git a/packages/app-staking/src/StakeList/Account.tsx b/packages/app-staking/src/StakeList/Account.tsx index 7d5fdf1411..3ba9de5303 100644 --- a/packages/app-staking/src/StakeList/Account.tsx +++ b/packages/app-staking/src/StakeList/Account.tsx @@ -9,11 +9,12 @@ import { QueueTx$ExtrinsicAdd } from '@polkadot/ui-app/Status/types'; import { ApiProps } from '@polkadot/ui-api/types'; import React from 'react'; -import { AccountId, Balance } from '@polkadot/types'; +import { AccountId, Balance, ValidatorPrefs } from '@polkadot/types'; import { AddressMini, AddressSummary, Button } from '@polkadot/ui-app/index'; import { withCall, withMulti } from '@polkadot/ui-api/index'; import Nominating from './Nominating'; +import Preferences from './Preferences'; import UnnominateButton from './UnnominateButton'; import translate from '../translate'; @@ -32,7 +33,8 @@ type Props = ApiProps & I18nProps & { type State = { isNominateOpen: boolean, - isNominating: boolean + isNominating: boolean, + isPrefsOpen: boolean }; class Account extends React.PureComponent { @@ -41,7 +43,8 @@ class Account extends React.PureComponent { this.state = { isNominateOpen: false, - isNominating: false + isNominating: false, + isPrefsOpen: false }; } @@ -55,7 +58,7 @@ class Account extends React.PureComponent { render () { const { accountId, balanceArray, intentions, name } = this.props; - const { isNominateOpen } = this.state; + const { isNominateOpen, isPrefsOpen } = this.state; return (
@@ -65,6 +68,12 @@ class Account extends React.PureComponent { onNominate={this.nominate} intentions={intentions} /> + { onClick={this.unstake} text={t('Unstake')} /> + +