Adjust focus for Validate/Session partials (#5321)

This commit is contained in:
Jaco 2021-05-19 11:19:41 +03:00 committed by GitHub
parent 04719f5ccb
commit 92443b64b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 3 deletions

View File

@ -30,6 +30,7 @@ function SetSessionKey ({ controllerId, onClose, stashId }: Props): React.ReactE
controllerId={controllerId}
onChange={setTx}
stashId={stashId}
withFocus
withSenders
/>
</Modal.Content>

View File

@ -30,6 +30,7 @@ function Validate ({ controllerId, onClose, stashId }: Props): React.ReactElemen
controllerId={controllerId}
onChange={setTx}
stashId={stashId}
withFocus
withSenders
/>
</Modal.Content>

View File

@ -80,6 +80,7 @@ function NewValidator ({ isInElection }: Props): React.ReactElement<Props> {
controllerId={controllerId}
onChange={setSessionInfo}
stashId={stashId}
withFocus
/>
<ValidatePartial
controllerId={controllerId}

View File

@ -16,12 +16,13 @@ interface Props {
controllerId: string;
onChange: (info: SessionInfo) => void;
stashId: string;
withFocus?: boolean;
withSenders?: boolean;
}
const EMPTY_PROOF = new Uint8Array();
function SessionKey ({ className = '', controllerId, onChange, stashId, withSenders }: Props): React.ReactElement<Props> {
function SessionKey ({ className = '', controllerId, onChange, stashId, withFocus, withSenders }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const [keys, setKeys] = useState<string | null>(null);
@ -58,7 +59,7 @@ function SessionKey ({ className = '', controllerId, onChange, stashId, withSend
)}
<Modal.Columns hint={t<string>('The hex output from author_rotateKeys, as executed on the validator node. The keys will show as pending until applied at the start of a new session.')}>
<Input
autoFocus
autoFocus={withFocus}
help={t<string>('Changing the key only takes effect at the start of the next session. The input here is generates from the author_rotateKeys command')}
isError={!keys}
label={t<string>('Keys from rotateKeys')}

View File

@ -17,12 +17,13 @@ interface Props {
controllerId: string;
onChange: (info: ValidateInfo) => void;
stashId: string;
withFocus?: boolean;
withSenders?: boolean;
}
const COMM_MUL = new BN(1e7);
function Validate ({ className = '', controllerId, onChange, stashId, withSenders }: Props): React.ReactElement<Props> {
function Validate ({ className = '', controllerId, onChange, stashId, withFocus, withSenders }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const [commission, setCommission] = useState<BN | number>(1);
@ -73,6 +74,7 @@ function Validate ({ className = '', controllerId, onChange, stashId, withSender
)}
<Modal.Columns hint={t<string>('The commission is deducted from all rewards before the remainder is split with nominators.')}>
<InputNumber
autoFocus={withFocus}
help={t<string>('The percentage reward (0-100) that should be applied for the validator')}
isZeroable
label={t<string>('reward commission percentage')}