Browse Source

Autofocus on send/receive/import modals

master
meriadec 7 years ago
parent
commit
a15e609b55
No known key found for this signature in database GPG Key ID: 1D2FC2305E2CB399
  1. 1
      src/components/modals/ImportAccounts/index.js
  2. 1
      src/components/modals/ImportAccounts/steps/01-step-choose-currency.js
  3. 2
      src/components/modals/Receive/01-step-account.js
  4. 1
      src/components/modals/Send/01-step-amount.js
  5. 4
      src/components/modals/Send/RecipientField.js

1
src/components/modals/ImportAccounts/index.js

@ -70,7 +70,6 @@ type Props = {
}
type StepId = 'chooseCurrency' | 'connectDevice' | 'import' | 'finish'
type ScanStatus = 'idle' | 'scanning' | 'error' | 'finished'
type State = {

1
src/components/modals/ImportAccounts/steps/01-step-choose-currency.js

@ -12,6 +12,7 @@ import type { StepProps } from '../index'
function StepChooseCurrency({ currency, setState }: StepProps) {
return (
<SelectCurrency
autoFocus
onChange={currency => {
setState({
currency: isArray(currency) && currency.length === 0 ? null : currency,

2
src/components/modals/Receive/01-step-account.js

@ -18,6 +18,6 @@ type Props = {
export default (props: Props) => (
<Box flow={1}>
<Label>{props.t('app:receive.steps.chooseAccount.label')}</Label>
<SelectAccount onChange={props.onChangeAccount} value={props.account} />
<SelectAccount autoFocus onChange={props.onChangeAccount} value={props.account} />
</Box>
)

1
src/components/modals/Send/01-step-amount.js

@ -63,6 +63,7 @@ function StepAmount({
{account && bridge && transaction ? (
<Fragment key={account.id}>
<RecipientField
autoFocus
account={account}
bridge={bridge}
transaction={transaction}

4
src/components/modals/Send/RecipientField.js

@ -14,6 +14,7 @@ type Props<Transaction> = {
bridge: WalletBridge<Transaction>,
transaction: Transaction,
onChangeTransaction: Transaction => void,
autoFocus?: boolean,
}
class RecipientField<Transaction> extends Component<Props<Transaction>, { isValid: boolean }> {
@ -59,7 +60,7 @@ class RecipientField<Transaction> extends Component<Props<Transaction>, { isVali
}
render() {
const { bridge, account, transaction, t } = this.props
const { bridge, account, transaction, t, autoFocus } = this.props
const { isValid } = this.state
const value = bridge.getTransactionRecipient(account, transaction)
return (
@ -69,6 +70,7 @@ class RecipientField<Transaction> extends Component<Props<Transaction>, { isVali
<LabelInfoTooltip ml={1} text={t('app:send.steps.amount.recipientAddress')} />
</Label>
<RecipientAddress
autoFocus={autoFocus}
withQrCode
error={!value || isValid ? null : `This is not a valid ${account.currency.name} address`}
value={value}

Loading…
Cancel
Save