import React, {Component, PropTypes} from 'react'
import {connect} from 'react-redux'
import LoadingScreen from './loading-screen'
import {createNewVaultAndRestore, hideWarning} from '../../../../ui/app/actions'
class ImportSeedPhraseScreen extends Component {
static propTypes = {
warning: PropTypes.string,
back: PropTypes.func.isRequired,
next: PropTypes.func.isRequired,
createNewVaultAndRestore: PropTypes.func.isRequired,
hideWarning: PropTypes.func.isRequired,
isLoading: PropTypes.bool.isRequired,
};
state = {
seedPhrase: '',
password: '',
confirmPassword: '',
}
onClick = () => {
const { password, seedPhrase } = this.state
const { createNewVaultAndRestore, next } = this.props
createNewVaultAndRestore(password, seedPhrase)
.then(next)
}
isValid () {
const { seedPhrase, password, confirmPassword } = this.state
if (seedPhrase.split(' ').length !== 12) {
return false
}
if (password.length < 8) {
return false
}
if (password !== confirmPassword) {
return false
}
return true
}
render () {
return this.props.isLoading
?