diff options
author | kumavis <kumavis@users.noreply.github.com> | 2018-04-10 01:55:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-10 01:55:46 +0800 |
commit | 4cae3d3b0d2a9cc0279e44de256e7fc7e219dca1 (patch) | |
tree | 3439d92871f38765cf5dfa4ac310b11aeb5068bb /ui/app/accounts/new-account | |
parent | 2511a9e634234135862259510a38b69308c2b81b (diff) | |
parent | 1e6f062bb6bbc39d6ab21a351fdb0d3bcab4d7d5 (diff) | |
download | tangerine-wallet-browser-4cae3d3b0d2a9cc0279e44de256e7fc7e219dca1.tar.gz tangerine-wallet-browser-4cae3d3b0d2a9cc0279e44de256e7fc7e219dca1.tar.zst tangerine-wallet-browser-4cae3d3b0d2a9cc0279e44de256e7fc7e219dca1.zip |
Merge pull request #3921 from MetaMask/gh-3736-react-router
Add react-router integration
Diffstat (limited to 'ui/app/accounts/new-account')
-rw-r--r-- | ui/app/accounts/new-account/create-form.js | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/ui/app/accounts/new-account/create-form.js b/ui/app/accounts/new-account/create-form.js deleted file mode 100644 index 48c74192a..000000000 --- a/ui/app/accounts/new-account/create-form.js +++ /dev/null @@ -1,105 +0,0 @@ -const { Component } = require('react') -const PropTypes = require('prop-types') -const h = require('react-hyperscript') -const connect = require('react-redux').connect -const actions = require('../../actions') - -class NewAccountCreateForm extends Component { - constructor (props, context) { - super(props) - - const { numberOfExistingAccounts = 0 } = props - const newAccountNumber = numberOfExistingAccounts + 1 - - this.state = { - newAccountName: '', - defaultAccountName: context.t('newAccountNumberName', [newAccountNumber]), - } - } - - render () { - const { newAccountName, defaultAccountName } = this.state - - - return h('div.new-account-create-form', [ - - h('div.new-account-create-form__input-label', {}, [ - this.context.t('accountName'), - ]), - - h('div.new-account-create-form__input-wrapper', {}, [ - h('input.new-account-create-form__input', { - value: newAccountName, - placeholder: defaultAccountName, - onChange: event => this.setState({ newAccountName: event.target.value }), - }, []), - ]), - - h('div.new-account-create-form__buttons', {}, [ - - h('button.btn-secondary--lg.new-account-create-form__button', { - onClick: () => this.props.goHome(), - }, [ - this.context.t('cancel'), - ]), - - h('button.btn-primary--lg.new-account-create-form__button', { - onClick: () => this.props.createAccount(newAccountName || defaultAccountName), - }, [ - this.context.t('create'), - ]), - - ]), - - ]) - } -} - -NewAccountCreateForm.propTypes = { - hideModal: PropTypes.func, - showImportPage: PropTypes.func, - createAccount: PropTypes.func, - goHome: PropTypes.func, - numberOfExistingAccounts: PropTypes.number, - t: PropTypes.func, -} - -const mapStateToProps = state => { - const { metamask: { network, selectedAddress, identities = {} } } = state - const numberOfExistingAccounts = Object.keys(identities).length - - return { - network, - address: selectedAddress, - numberOfExistingAccounts, - } -} - -const mapDispatchToProps = dispatch => { - return { - toCoinbase: (address) => { - dispatch(actions.buyEth({ network: '1', address, amount: 0 })) - }, - hideModal: () => { - dispatch(actions.hideModal()) - }, - createAccount: (newAccountName) => { - dispatch(actions.addNewAccount()) - .then((newAccountAddress) => { - if (newAccountName) { - dispatch(actions.saveAccountLabel(newAccountAddress, newAccountName)) - } - dispatch(actions.goHome()) - }) - }, - showImportPage: () => dispatch(actions.showImportPage()), - goHome: () => dispatch(actions.goHome()), - } -} - -NewAccountCreateForm.contextTypes = { - t: PropTypes.func, -} - -module.exports = connect(mapStateToProps, mapDispatchToProps)(NewAccountCreateForm) - |