diff options
author | Dan Finlay <dan@danfinlay.com> | 2017-01-18 08:22:22 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2017-01-18 08:24:45 +0800 |
commit | 1ff4894b674bbcbac1998228454129018e4642b6 (patch) | |
tree | 5ddf81cc89253ea6ca8a19f19cee0efe328c2742 /ui/app/accounts/import/index.js | |
parent | 958cbfbde44c201cf71f5dfcb7b1748bb43e597f (diff) | |
download | tangerine-wallet-browser-1ff4894b674bbcbac1998228454129018e4642b6.tar.gz tangerine-wallet-browser-1ff4894b674bbcbac1998228454129018e4642b6.tar.zst tangerine-wallet-browser-1ff4894b674bbcbac1998228454129018e4642b6.zip |
Allow importing of private key strings
Fixes #1021
A top-right menu item now allows `Account Import`. It has a menu (with one item for now) that allows importing a private key string.
Errors are displayed, and a success navigates the user to their account list, where the imported account is labeled `LOOSE`.
Diffstat (limited to 'ui/app/accounts/import/index.js')
-rw-r--r-- | ui/app/accounts/import/index.js | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/ui/app/accounts/import/index.js b/ui/app/accounts/import/index.js index a7c3252cd..18a6b985c 100644 --- a/ui/app/accounts/import/index.js +++ b/ui/app/accounts/import/index.js @@ -7,12 +7,17 @@ import Select from 'react-select' // Subviews const JsonImportView = require('./json.js') const SeedImportView = require('./seed.js') +const PrivateKeyImportView = require('./private-key.js') + +const menuItems = [ + 'Private Key', +] module.exports = connect(mapStateToProps)(AccountImportSubview) function mapStateToProps (state) { return { - types: state.metamask.keyringTypes, + menuItems, } } @@ -24,7 +29,7 @@ function AccountImportSubview () { AccountImportSubview.prototype.render = function () { const props = this.props const state = this.state || {} - const { types } = props + const { menuItems } = props const { type } = state return ( @@ -50,8 +55,8 @@ AccountImportSubview.prototype.render = function () { h(Select, { name: 'import-type-select', clearable: false, - value: type || types[0], - options: types.map((type) => { + value: type || menuItems[0], + options: menuItems.map((type) => { return { value: type, label: type, @@ -71,11 +76,15 @@ AccountImportSubview.prototype.render = function () { AccountImportSubview.prototype.renderImportView = function() { const props = this.props const state = this.state || {} - const { type } = state || props.types[0] + const { type } = state + const { menuItems } = props + const current = type || menuItems[0] - switch (type) { + switch (current) { case 'HD Key Tree': return h(SeedImportView) + case 'Private Key': + return h(PrivateKeyImportView) default: return h(JsonImportView) } |