Adjust remaining staking modals with columns (#2696)

This commit is contained in:
Jaco Greeff 2020-05-07 10:15:36 +02:00 committed by GitHub
parent 8a503091d2
commit 6241dfa97e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 123 additions and 72 deletions

View File

@ -78,36 +78,58 @@ function InjectKeys ({ onClose }: Props): React.ReactElement<Props> | null {
return (
<Modal
header={t('Inject Keys')}
size='small'
size='large'
>
<Modal.Content>
<Input
isError={publicKey.length !== 66}
label={t('suri (seed & derivation)')}
onChange={setSuri}
value={suri}
/>
<Dropdown
label={t('key type to set')}
onChange={setKeyType}
options={keyTypeOpt}
value={keyType}
/>
<Dropdown
isDisabled={_cryptoOptions.length === 1}
label={t('crypto type to use')}
onChange={setCrypto}
options={_cryptoOptions}
value={crypto}
/>
<Input
isDisabled
label={t('generated public key')}
value={publicKey}
/>
<article className='warning'>
<div><Icon name='warning sign' />{t('This operation will submit the seed via an RPC call. Do not perform this operation on a public RPC node, but ensure that the node is local, connected to your validator and secure.')}</div>
</article>
<Modal.Columns>
<Modal.Column>
<Input
autoFocus
isError={publicKey.length !== 66}
label={t('suri (seed & derivation)')}
onChange={setSuri}
value={suri}
/>
<article className='warning'>
<div><Icon name='warning sign' />{t('This operation will submit the seed via an RPC call. Do not perform this operation on a public RPC node, but ensure that the node is local, connected to your validator and secure.')}</div>
</article>
</Modal.Column>
<Modal.Column>
<p>{t('The seed and derivation path will be submitted to the validator node. this is an advanced operation, only to be performed when you are sure of the security and connection risks.')}</p>
</Modal.Column>
</Modal.Columns>
<Modal.Columns>
<Modal.Column>
<Dropdown
label={t('key type to set')}
onChange={setKeyType}
options={keyTypeOpt}
value={keyType}
/>
<Dropdown
isDisabled={_cryptoOptions.length === 1}
label={t('crypto type to use')}
onChange={setCrypto}
options={_cryptoOptions}
value={crypto}
/>
</Modal.Column>
<Modal.Column>
<p>{t('The key type and crypto type to use for this key. Be aware that different keys have different crypto requirements. You should be familiar with the type requirements for the different keys.')}</p>
</Modal.Column>
</Modal.Columns>
<Modal.Columns>
<Modal.Column>
<Input
isDisabled
label={t('generated public key')}
value={publicKey}
/>
</Modal.Column>
<Modal.Column>
<p>{t('This pubic key is what will be visible in your queued keys list. It is generated based on the seed and the crypto used.')}</p>
</Modal.Column>
</Modal.Columns>
</Modal.Content>
<Modal.Actions onCancel={onClose}>
<Button

View File

@ -21,32 +21,43 @@ function SetControllerAccount ({ defaultControllerId, onClose, stashId }: Props)
return (
<Modal
className='staking--SetControllerAccount'
header={t('Change controller account')}
size='small'
size='large'
>
<Modal.Content className='ui--signer-Signer-Content'>
<InputAddress
className='medium'
isDisabled
label={t('stash account')}
value={stashId}
/>
<InputAddress
className='medium'
defaultValue={defaultControllerId}
help={t('The controller is the account that will be used to control any nominating or validating actions. Should not match another stash or controller.')}
label={t('controller account')}
onChange={setControllerId}
type='account'
value={controllerId}
/>
<InputValidationController
accountId={stashId}
controllerId={controllerId}
defaultController={defaultControllerId}
onError={setControllerError}
/>
<Modal.Content>
<Modal.Columns>
<Modal.Column>
<InputAddress
isDisabled
label={t('stash account')}
value={stashId}
/>
</Modal.Column>
<Modal.Column>
<p>{t('The stash account that is used. This will allow the controller to perform all non-funds related operations on behalf of the account.')}</p>
</Modal.Column>
</Modal.Columns>
<Modal.Columns>
<Modal.Column>
<InputAddress
defaultValue={defaultControllerId}
help={t('The controller is the account that will be used to control any nominating or validating actions. Should not match another stash or controller.')}
label={t('controller account')}
onChange={setControllerId}
type='account'
value={controllerId}
/>
<InputValidationController
accountId={stashId}
controllerId={controllerId}
defaultController={defaultControllerId}
onError={setControllerError}
/>
</Modal.Column>
<Modal.Column>
<p>{t('The selected controller tied to this stash. Once set, this account will be able to control the actions performed by the stash account.')}</p>
</Modal.Column>
</Modal.Columns>
</Modal.Content>
<Modal.Actions onCancel={onClose}>
<TxButton

View File

@ -12,35 +12,52 @@ interface Props {
defaultDestination?: number;
controllerId: string;
onClose: () => void;
stashId: string;
}
function SetRewardDestination ({ controllerId, defaultDestination, onClose }: Props): React.ReactElement<Props> {
function SetRewardDestination ({ controllerId, defaultDestination, onClose, stashId }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const [destination, setDestination] = useState(0);
return (
<Modal
className='staking--Bonding'
header={t('Bonding Preferences')}
size='small'
size='large'
>
<Modal.Content className='ui--signer-Signer-Content'>
<InputAddress
className='medium'
defaultValue={controllerId}
help={t('The controller is the account that is be used to control any nominating or validating actions. I will sign this transaction.')}
isDisabled
label={t('controller account')}
/>
<Dropdown
className='medium'
defaultValue={defaultDestination}
help={t('The destination account for any payments as either a nominator or validator')}
label={t('payment destination')}
onChange={setDestination}
options={rewardDestinationOptions}
value={destination}
/>
<Modal.Content>
<Modal.Columns>
<Modal.Column>
<InputAddress
defaultValue={stashId}
isDisabled
label={t('stash account')}
/>
<InputAddress
defaultValue={controllerId}
help={t('The controller is the account that is be used to control any nominating or validating actions. I will sign this transaction.')}
isDisabled
label={t('controller account')}
/>
</Modal.Column>
<Modal.Column>
<p>{t('The stash and controller pair as linked. This operation will be performed via the controller.')}</p>
</Modal.Column>
</Modal.Columns>
<Modal.Columns>
<Modal.Column>
<Dropdown
defaultValue={defaultDestination}
help={t('The destination account for any payments as either a nominator or validator')}
label={t('payment destination')}
onChange={setDestination}
options={rewardDestinationOptions}
value={destination}
/>
</Modal.Column>
<Modal.Column>
<p>{t('All rewards will go towards the selected output destination when a payout is made.')}</p>
</Modal.Column>
</Modal.Columns>
</Modal.Content>
<Modal.Actions onCancel={onClose}>
<TxButton

View File

@ -86,6 +86,7 @@ function Account ({ className, info: { controllerId, destination, destinationId,
controllerId={controllerId}
defaultDestination={destinationId}
onClose={toggleRewardDestination}
stashId={stashId}
/>
)}
{isSetSessionOpen && controllerId && (