From d868adae8887dde53dce1eeadd400731ea9bd980 Mon Sep 17 00:00:00 2001 From: Thibaut Sardan <33178835+Tbaut@users.noreply.github.com> Date: Thu, 13 Jun 2019 12:04:01 +0800 Subject: [PATCH] Redo staking process and overview (#1268) * remove filtering on actions tab * remove unused balances on actions * remove unused balances on actions * only show stash * show stashed including validators and nominators * some buttons * new stake button * bond edit init * BondEdit button * combined session and validating button * remove comments * remove css hack * phrasing * validator prefs * can edit validator prefs * fix validatorPrefs undifined and nits * validate unstakeThreshold (<11) * with setting button noautoclose * fix nominee styling * change session and process feeling * lint * change nominees without defaultValue * display and change reward destination * change controller * add balances on bond and unbond * available balance, setting button right, nameOrAddress * back to the old flow with set session key, cleanup logs * balance off on chrome * fix comments + a design hickup on chrome * fix conflicts * nits * Various small UI fixes * Types for getAddress defaults * use name * type props for Row * lint --- packages/app-accounts/src/Account.tsx | 2 +- packages/app-accounts/src/modals/Transfer.tsx | 1 - packages/app-address-book/src/Address.tsx | 2 +- .../src/Account/UnnominateButton.tsx | 56 -- packages/app-staking/src/Account/index.tsx | 467 ------------- packages/app-staking/src/Accounts.tsx | 93 --- .../src/{ => Actions}/Account/BondExtra.tsx | 71 +- .../Account/InputValidationController.tsx} | 20 +- .../Account/InputValidationSession.tsx} | 2 +- .../InputValidationUnstakeThreshold.tsx | 64 ++ .../Account/Nominate.tsx} | 23 +- .../Actions/Account/SetControllerAccount.tsx | 139 ++++ .../Actions/Account/SetRewardDestination.tsx | 107 +++ .../Account/SetSessionAccount.tsx} | 63 +- .../src/{ => Actions}/Account/Unbond.tsx | 30 +- .../Account/Validate.tsx} | 80 ++- .../app-staking/src/Actions/Account/index.tsx | 655 ++++++++++++++++++ packages/app-staking/src/Actions/Accounts.tsx | 104 +++ .../Bond.tsx => Actions/NewStake.tsx} | 131 +--- .../app-staking/src/Actions/constants.tsx | 9 + .../app-staking/src/Overview/CurrentList.tsx | 2 +- packages/app-staking/src/Overview/index.tsx | 4 + packages/app-staking/src/index.tsx | 2 +- packages/app-staking/src/types.ts | 2 +- packages/ui-app/src/AddressInfo.tsx | 109 ++- packages/ui-app/src/AddressRow.tsx | 30 +- packages/ui-app/src/CodeRow.tsx | 20 +- packages/ui-app/src/InputAddress.tsx | 23 +- packages/ui-app/src/InputBalanceBonded.tsx | 161 +++++ packages/ui-app/src/Row.tsx | 38 +- packages/ui-app/src/constants.ts | 6 + packages/ui-app/src/index.tsx | 1 + packages/ui-app/src/styles/components.css | 6 +- packages/ui-signer/src/index.css | 9 +- 34 files changed, 1643 insertions(+), 889 deletions(-) delete mode 100644 packages/app-staking/src/Account/UnnominateButton.tsx delete mode 100644 packages/app-staking/src/Account/index.tsx delete mode 100644 packages/app-staking/src/Accounts.tsx rename packages/app-staking/src/{ => Actions}/Account/BondExtra.tsx (76%) rename packages/app-staking/src/{Account/ValidateController.tsx => Actions/Account/InputValidationController.tsx} (78%) rename packages/app-staking/src/{Account/ValidateSession.tsx => Actions/Account/InputValidationSession.tsx} (97%) create mode 100644 packages/app-staking/src/Actions/Account/InputValidationUnstakeThreshold.tsx rename packages/app-staking/src/{Account/Nominating.tsx => Actions/Account/Nominate.tsx} (82%) create mode 100644 packages/app-staking/src/Actions/Account/SetControllerAccount.tsx create mode 100644 packages/app-staking/src/Actions/Account/SetRewardDestination.tsx rename packages/app-staking/src/{Account/SessionKey.tsx => Actions/Account/SetSessionAccount.tsx} (61%) rename packages/app-staking/src/{ => Actions}/Account/Unbond.tsx (81%) rename packages/app-staking/src/{Account/Validating.tsx => Actions/Account/Validate.tsx} (56%) create mode 100644 packages/app-staking/src/Actions/Account/index.tsx create mode 100644 packages/app-staking/src/Actions/Accounts.tsx rename packages/app-staking/src/{Account/Bond.tsx => Actions/NewStake.tsx} (57%) create mode 100644 packages/app-staking/src/Actions/constants.tsx create mode 100644 packages/ui-app/src/InputBalanceBonded.tsx diff --git a/packages/app-accounts/src/Account.tsx b/packages/app-accounts/src/Account.tsx index 8aa13c8a5d..6475abc8a1 100644 --- a/packages/app-accounts/src/Account.tsx +++ b/packages/app-accounts/src/Account.tsx @@ -60,9 +60,9 @@ class Account extends React.PureComponent { > {this.renderModals()} ); diff --git a/packages/app-accounts/src/modals/Transfer.tsx b/packages/app-accounts/src/modals/Transfer.tsx index 5cd3cf8e49..5ba523f623 100644 --- a/packages/app-accounts/src/modals/Transfer.tsx +++ b/packages/app-accounts/src/modals/Transfer.tsx @@ -84,7 +84,6 @@ class Transfer extends React.PureComponent { componentDidUpdate (prevProps: Props, prevState: State) { const { balances_fees } = this.props; const { extrinsic, recipientId, senderId } = this.state; - const hasLengthChanged = ((extrinsic && extrinsic.encodedLength) || 0) !== ((prevState.extrinsic && prevState.extrinsic.encodedLength) || 0); if ((recipientId && prevState.recipientId !== recipientId) || diff --git a/packages/app-address-book/src/Address.tsx b/packages/app-address-book/src/Address.tsx index b8298d6edd..5ae47c1e42 100644 --- a/packages/app-address-book/src/Address.tsx +++ b/packages/app-address-book/src/Address.tsx @@ -57,9 +57,9 @@ class Address extends React.PureComponent { > {this.renderModals()} ); diff --git a/packages/app-staking/src/Account/UnnominateButton.tsx b/packages/app-staking/src/Account/UnnominateButton.tsx deleted file mode 100644 index 93bdd7badf..0000000000 --- a/packages/app-staking/src/Account/UnnominateButton.tsx +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2017-2019 @polkadot/app-staking authors & contributors -// This software may be modified and distributed under the terms -// of the Apache-2.0 license. See the LICENSE file for details. - -import { I18nProps } from '@polkadot/ui-app/types'; - -import React from 'react'; -import { Button } from '@polkadot/ui-app'; -import { withCalls, withMulti } from '@polkadot/ui-api'; -import { AccountId, Vector } from '@polkadot/types'; - -import translate from '../translate'; - -type Props = I18nProps & { - accountId: string, - nominating: AccountId, - staking_nominatorsFor: Vector, - onClick: (index: number) => void -}; - -class UnnominateButton extends React.Component { - render () { - const { nominating, staking_nominatorsFor, style, t } = this.props; - - if (!nominating || !staking_nominatorsFor) { - return null; - } - - return ( -