Newer
Older
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
// This file is part of Parity.
//
import React, { Component } from 'react';
import { AccountCard, Card, Form as FetherForm } from 'fether-ui';
class AccountRewritePhrase extends Component {
isLoading: false,
handleChange = ({ target: { value } }) => {
this.setState({ value });
};
location: { pathname },
const currentStep = pathname.slice(-1);
// If we're importing, derive address from recovery phrase when we submit
this.setState({ isLoading: true });
await setPhrase(value);
}
history.push(`/accounts/new/${+currentStep + 1}`);
};
const currentStep = pathname.slice(-1);
Axel Chalon
committed
const body = [
<form key='createAccount' onSubmit={this.handleSubmit}>
Axel Chalon
committed
{isImport ? (
Axel Chalon
committed
) : (
<p>
Type your secret phrase to confirm that you wrote it down
correctly:
</p>
)}
</div>
as='textarea'
label='Recovery phrase'
onChange={this.handleChange}
required
value={value}
/>
Axel Chalon
committed
{currentStep > 1 && (
Axel Chalon
committed
Back
</button>
)}
{this.renderButton()}
</nav>
Axel Chalon
committed
];
return isImport ? (
<Card>{body}</Card>
) : (
createAccountStore: { isImport, bip39Phrase }
// If we are creating a new account, the button just checks the phrase has
// been correctly written by the user.
<button className='button' disabled={value !== bip39Phrase}>
// If we are importing an existing account, the button goes to the next step
<button className='button' disabled={!value.length || isLoading}>
export default AccountRewritePhrase;