mirror of
https://github.com/status-im/nimbus-gui.git
synced 2025-02-12 19:36:35 +00:00
feat: add pasting entire mnemonic
This commit is contained in:
parent
e8f55ba18d
commit
0ce5e3350a
@ -3,7 +3,7 @@ import { useDispatch, useSelector } from 'react-redux'
|
||||
import wordlist from 'web-bip39/wordlists/english'
|
||||
|
||||
import { RootState } from '../../../redux/store'
|
||||
import { setWord } from '../../../redux/ValidatorOnboarding/KeyGeneration/slice'
|
||||
import { setMnemonic, setWord } from '../../../redux/ValidatorOnboarding/KeyGeneration/slice'
|
||||
|
||||
type AutocompleteInputProps = {
|
||||
index: number
|
||||
@ -20,7 +20,22 @@ const AutocompleteInput = ({ index }: AutocompleteInputProps) => {
|
||||
|
||||
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const value = e.target.value
|
||||
dispatch(setWord({ index, word: value }))
|
||||
|
||||
if (value.split(' ').length > 1) {
|
||||
const mnemonic = value.trim().split(' ')
|
||||
|
||||
if (mnemonic.length < 24) {
|
||||
for (let i = 0; i < 24; i++) {
|
||||
if (!mnemonic[i]) {
|
||||
mnemonic.push('')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dispatch(setMnemonic(mnemonic))
|
||||
} else {
|
||||
dispatch(setWord({ index, word: value }))
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
Loading…
x
Reference in New Issue
Block a user