From eb6b27750aa71fbb8a488417ecdd281b103f20d3 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Mon, 20 Apr 2020 08:30:16 +0200 Subject: [PATCH] Remove unneeded InputBalanceBonded indirection (#2585) --- packages/apps/src/WarmUp.tsx | 3 +- .../page-staking/src/Actions/NewStake.tsx | 12 +-- .../src/InputBalanceBonded.tsx | 101 ------------------ packages/react-components/src/index.tsx | 1 - 4 files changed, 3 insertions(+), 114 deletions(-) delete mode 100644 packages/react-components/src/InputBalanceBonded.tsx diff --git a/packages/apps/src/WarmUp.tsx b/packages/apps/src/WarmUp.tsx index 7c629d21fc..345c89e6a0 100644 --- a/packages/apps/src/WarmUp.tsx +++ b/packages/apps/src/WarmUp.tsx @@ -7,7 +7,6 @@ import { useApi, useCall } from '@polkadot/react-hooks'; function WarmUp (): React.ReactElement { const { api, isApiReady } = useApi(); - const fees = useCall(isApiReady && api.derive.balances?.fees, []); const indexes = useCall(isApiReady && api.derive.accounts?.indexes, []); const registrars = useCall(isApiReady && api.query.identity?.registrars, []); const staking = null; // useCall(isApiReady && api.derive.staking?.overview, []); @@ -15,7 +14,7 @@ function WarmUp (): React.ReactElement { const [hasValues, setHasValues] = useState(false); useEffect((): void => { - setHasValues(!!fees || !!indexes || !!issuance || !!registrars || !!staking); + setHasValues(!!indexes || !!issuance || !!registrars || !!staking); // eslint-disable-next-line react-hooks/exhaustive-deps }, []); diff --git a/packages/page-staking/src/Actions/NewStake.tsx b/packages/page-staking/src/Actions/NewStake.tsx index 4de37fe837..9ce4ed9a80 100644 --- a/packages/page-staking/src/Actions/NewStake.tsx +++ b/packages/page-staking/src/Actions/NewStake.tsx @@ -6,7 +6,7 @@ import { SubmittableExtrinsic } from '@polkadot/api/types'; import BN from 'bn.js'; import React, { useEffect, useState } from 'react'; -import { Button, Dropdown, InputAddress, InputBalanceBonded, Modal, TxButton } from '@polkadot/react-components'; +import { Button, Dropdown, InputAddress, InputBalance, Modal, TxButton } from '@polkadot/react-components'; import { useApi, useToggle } from '@polkadot/react-hooks'; import { useTranslation } from '../translate'; @@ -61,14 +61,12 @@ function NewStake ({ className, isInElection }: Props): React.ReactElement - void; - onEnter?: () => void; - onEscape?: () => void; - placeholder?: string; - stashId: string; - value?: BN | string; - withEllipsis?: boolean; - withLabel?: boolean; - withMax?: boolean; -} - -interface State { - maxBalance?: BN; - extrinsic: SubmittableExtrinsic | null; -} - -const ZERO = new BN(0); -const DEFAULT_BITLENGTH = BitLengthOption.CHAIN_SPEC as BitLength; - -class InputBalanceBonded extends React.PureComponent { - public state: State; - - constructor (props: Props) { - super(props); - - this.state = { - extrinsic: null, - maxBalance: ZERO - }; - } - - public render (): React.ReactNode { - const { autoFocus, className, defaultValue, help, isDisabled, isError, isFull, isZeroable, label, onChange, onEnter, onEscape, placeholder, style, value, withEllipsis, withLabel, withMax } = this.props; - const { maxBalance } = this.state; - - return ( - - ); - } -} - -export default withMulti( - InputBalanceBonded, - withApi, - withCalls( - 'derive.balances.fees', - ['derive.balances.all', { paramName: 'stashId' }] - ) -); diff --git a/packages/react-components/src/index.tsx b/packages/react-components/src/index.tsx index 03c76ec85a..66b426a330 100644 --- a/packages/react-components/src/index.tsx +++ b/packages/react-components/src/index.tsx @@ -46,7 +46,6 @@ export { default as InputAddress } from './InputAddress'; export { default as InputAddressMulti } from './InputAddressMulti'; export { default as InputAddressSimple } from './InputAddressSimple'; export { default as InputBalance } from './InputBalance'; -export { default as InputBalanceBonded } from './InputBalanceBonded'; export { default as InputConsts } from './InputConsts'; export { default as InputError } from './InputError'; export { default as InputExtrinsic } from './InputExtrinsic';