// Copyright 2015-2018 Parity Technologies (UK) Ltd.
// This file is part of Parity.
//
// SPDX-License-Identifier: BSD-3-Clause
import React, { Component } from 'react';
import { AccountCard, Card, Form as FetherForm } from 'fether-ui';
import Blockies from 'react-blockies';
import { inject, observer } from 'mobx-react';
import { Link } from 'react-router-dom';
@inject('createAccountStore')
@observer
class AccountName extends Component {
componentDidMount () {
const { createAccountStore } = this.props;
// Generate a new public address if there's none yet
if (!createAccountStore.address) {
createAccountStore.generateNewAccount();
}
}
handleChangeName = ({ target: { value } }) =>
this.props.createAccountStore.setName(value);
render () {
const {
createAccountStore: { isImport }
} = this.props;
return isImport ? this.renderCardWhenImported() : this.renderCardWhenNew();
}
renderCardWhenImported = () => {
const {
createAccountStore: { address, name }
} = this.props;
return (
Please give this account a name: