// Copyright 2015, 2016 Ethcore (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // Parity is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with Parity. If not, see . import React, { Component, PropTypes } from 'react'; import ActionDone from 'material-ui/svg-icons/action/done'; import ActionDoneAll from 'material-ui/svg-icons/action/done-all'; import ContentClear from 'material-ui/svg-icons/content/clear'; import NavigationArrowBack from 'material-ui/svg-icons/navigation/arrow-back'; import NavigationArrowForward from 'material-ui/svg-icons/navigation/arrow-forward'; import PrintIcon from 'material-ui/svg-icons/action/print'; import { Button, Modal } from '~/ui'; import AccountDetails from './AccountDetails'; import AccountDetailsGeth from './AccountDetailsGeth'; import CreationType from './CreationType'; import NewAccount from './NewAccount'; import NewGeth from './NewGeth'; import NewImport from './NewImport'; import RawKey from './RawKey'; import RecoveryPhrase from './RecoveryPhrase'; import { createIdentityImg } from '~/api/util/identity'; import print from './print'; import recoveryPage from './recovery-page.ejs'; import ParityLogo from '../../../assets/images/parity-logo-black-no-text.svg'; const TITLES = { type: 'creation type', create: 'create account', info: 'account information', import: 'import wallet' }; const STAGE_NAMES = [TITLES.type, TITLES.create, TITLES.info]; const STAGE_IMPORT = [TITLES.type, TITLES.import, TITLES.info]; export default class CreateAccount extends Component { static contextTypes = { api: PropTypes.object.isRequired, store: PropTypes.object.isRequired } static propTypes = { accounts: PropTypes.object.isRequired, onClose: PropTypes.func, onUpdate: PropTypes.func } state = { address: null, name: null, passwordHint: null, password: null, phrase: null, windowsPhrase: false, rawKey: null, json: null, canCreate: false, createType: null, gethAddresses: [], stage: 0 } render () { const { createType, stage } = this.state; const steps = createType === 'fromNew' ? STAGE_NAMES : STAGE_IMPORT; return ( { this.renderPage() } ); } renderPage () { const { createType, stage } = this.state; const { accounts } = this.props; switch (stage) { case 0: return ( ); case 1: if (createType === 'fromNew') { return ( ); } else if (createType === 'fromGeth') { return ( ); } else if (createType === 'fromPhrase') { return ( ); } else if (createType === 'fromRaw') { return ( ); } return ( ); case 2: if (createType === 'fromGeth') { return ( ); } return ( ); } } renderDialogActions () { const { createType, stage } = this.state; switch (stage) { case 0: return [