Small cleanups, spinners & useInactives (#2550)

This commit is contained in:
Jaco Greeff 2020-04-11 19:18:29 +02:00 committed by GitHub
parent fde1bdcf2c
commit 0bcb0229f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 9 additions and 19 deletions

View File

@ -66,7 +66,6 @@ function BondExtra ({ onClose, stashId }: Props): React.ReactElement<Props> {
onStart={onClose}
params={[maxAdditional]}
tx='staking.bondExtra'
withSpinner={false}
/>
</Modal.Actions>
</Modal>

View File

@ -55,13 +55,11 @@ function Nominate ({ className, controllerId, isOpen, next, nominees, onClose, s
>
<Modal.Content className='ui--signer-Signer-Content'>
<InputAddress
className='medium'
defaultValue={controllerId}
isDisabled
label={t('controller account')}
/>
<InputAddress
className='medium'
defaultValue={stashId}
isDisabled
label={t('stash account')}
@ -69,7 +67,6 @@ function Nominate ({ className, controllerId, isOpen, next, nominees, onClose, s
<InputAddressMulti
available={available}
availableLabel={t('candidate accounts')}
className='medium'
defaultValue={nominees}
help={t('Filter available candidates based on name, address or short account index.')}
maxCount={MAX_NOMINEES}

View File

@ -67,7 +67,6 @@ function SetControllerAccount ({ defaultControllerId, isValidating, onClose, sta
onStart={onClose}
params={[controllerId]}
tx='staking.setController'
withSpinner={false}
/>
</Modal.Actions>
</Modal>

View File

@ -52,7 +52,6 @@ function SetRewardDestination ({ controllerId, defaultDestination, onClose }: Pr
onStart={onClose}
params={[destination]}
tx={'staking.setPayee'}
withSpinner={false}
/>
</Modal.Actions>
</Modal>

View File

@ -75,7 +75,6 @@ function Unbond ({ className, controllerId, onClose, stakingLedger, stashId }: P
onStart={onClose}
params={[maxUnbond]}
tx='staking.unbond'
withSpinner={false}
/>
</Modal.Actions>
</Modal>

View File

@ -64,7 +64,6 @@ function Validate ({ controllerId, onClose, stashId }: Props): React.ReactElemen
onStart={onClose}
params={[prefs]}
tx='staking.validate'
withSpinner={false}
/>
</Modal.Actions>
</Modal>

View File

@ -24,15 +24,15 @@ export default function useInactives (stashId: string, nominees?: string[]): str
? nominees.map((id) => [api.query.staking.erasStakers, [indexes.activeEra, id]])
: nominees.map((id) => [api.query.staking.stakers, id]),
(exposures: Exposure[]): void => {
const inactives: string[] = [];
exposures.forEach((exposure, index): void => {
if (!exposure.others.some((indv): boolean => indv.who.eq(stashId))) {
inactives.push(nominees[index].toString());
}
});
mountedRef.current && setInactives(inactives);
mountedRef.current && setInactives(
exposures
.map((exposure, index) =>
exposure.others.some(({ who }) => who.eq(stashId))
? null
: nominees[index].toString()
)
.filter((inactiveId): inactiveId is string => !!inactiveId)
);
}
)
.then((_unsub): void => {

View File

@ -90,7 +90,6 @@ function Stash ({ className, isDisabled, payout: { available, rewards, stashId }
isDisabled={!extrinsic || isDisabled}
isPrimary={false}
label={t('Payout')}
withSpinner={false}
/>
)}
</td>

View File

@ -39,7 +39,6 @@ function Propose ({ isMine, sudoKey }: Props): React.ReactElement<Props> {
label={t('Submit Sudo')}
params={[method]}
tx='sudo.sudo'
withSpinner={false}
/>
</Button.Group>
</section>