diff --git a/packages/app-staking/src/Account/Preferences.tsx b/packages/app-staking/src/Account/Staking.tsx similarity index 75% rename from packages/app-staking/src/Account/Preferences.tsx rename to packages/app-staking/src/Account/Staking.tsx index 0f369b8095..6f74231cb8 100644 --- a/packages/app-staking/src/Account/Preferences.tsx +++ b/packages/app-staking/src/Account/Staking.tsx @@ -7,7 +7,7 @@ import { I18nProps } from '@polkadot/ui-app/types'; import BN from 'bn.js'; import React from 'react'; import { ValidatorPrefs } from '@polkadot/types'; -import { Button, InputBalance, InputNumber, Modal } from '@polkadot/ui-app'; +import { Button, InputAddress, InputBalance, InputNumber, Modal, TxButton } from '@polkadot/ui-app'; import translate from '../translate'; @@ -15,8 +15,7 @@ type Props = I18nProps & { accountId: string, isOpen: boolean, onClose: () => void, - onSetPrefs: (prefs: ValidatorPrefs) => void, - validatorPreferences?: ValidatorPrefs + preferences: ValidatorPrefs }; type State = { @@ -24,17 +23,17 @@ type State = { validatorPayment?: BN }; -class Preferences extends React.PureComponent { +class Staking extends React.PureComponent { state: State = {}; // inject the preferences are returned via RPC once into the state (from this // point forward it will be entirely managed by the actual inputs) static getDerivedStateFromProps (props: Props, state: State): State | null { - if (state.unstakeThreshold || !props.validatorPreferences) { + if (state.unstakeThreshold) { return null; } - const { unstakeThreshold, validatorPayment } = props.validatorPreferences; + const { unstakeThreshold, validatorPayment } = props.preferences; return { unstakeThreshold: unstakeThreshold.toBn(), @@ -51,7 +50,7 @@ class Preferences extends React.PureComponent { return ( { } private renderButtons () { - const { onClose, t } = this.props; + const { accountId, onClose, t } = this.props; + const { unstakeThreshold, validatorPayment } = this.state; return (