mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Develop import subviews
This commit is contained in:
parent
a7af47db92
commit
b3cb675a8b
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
|
"sourceType": "module",
|
||||||
"ecmaVersion": 6,
|
"ecmaVersion": 6,
|
||||||
"ecmaFeatures": {
|
"ecmaFeatures": {
|
||||||
"experimentalObjectRestSpread": true,
|
"experimentalObjectRestSpread": true,
|
||||||
|
@ -62,7 +62,7 @@ AddAccountScreen.prototype.render = function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AddAccountScreen.prototype.goHome = function() {
|
AddAccountScreen.prototype.goHome = function() {
|
||||||
this.props.dispatch(actions.showAccountPage())
|
this.props.dispatch(actions.showAccountsPage())
|
||||||
}
|
}
|
||||||
|
|
||||||
AddAccountScreen.prototype.renderNewOrImport = function() {
|
AddAccountScreen.prototype.renderNewOrImport = function() {
|
||||||
|
@ -4,6 +4,10 @@ const h = require('react-hyperscript')
|
|||||||
const connect = require('react-redux').connect
|
const connect = require('react-redux').connect
|
||||||
import Select from 'react-select'
|
import Select from 'react-select'
|
||||||
|
|
||||||
|
// Subviews
|
||||||
|
const JsonImportView = require('./json.js')
|
||||||
|
const SeedImportView = require('./seed.js')
|
||||||
|
|
||||||
module.exports = connect(mapStateToProps)(AccountImportSubview)
|
module.exports = connect(mapStateToProps)(AccountImportSubview)
|
||||||
|
|
||||||
function mapStateToProps (state) {
|
function mapStateToProps (state) {
|
||||||
@ -31,12 +35,11 @@ AccountImportSubview.prototype.render = function () {
|
|||||||
h('div', {
|
h('div', {
|
||||||
style: {
|
style: {
|
||||||
padding: '10px',
|
padding: '10px',
|
||||||
background: 'rgb(242,242,242)',
|
|
||||||
color: 'rgb(174, 174, 174)',
|
color: 'rgb(174, 174, 174)',
|
||||||
},
|
},
|
||||||
}, [
|
}, [
|
||||||
h('h3', 'SELECT TYPE'),
|
|
||||||
]),
|
h('h3', { style: { padding: '3px' } }, 'SELECT TYPE'),
|
||||||
|
|
||||||
h('style', `
|
h('style', `
|
||||||
.has-value.Select--single > .Select-control .Select-value .Select-value-label, .Select-value-label {
|
.has-value.Select--single > .Select-control .Select-value .Select-value-label, .Select-value-label {
|
||||||
@ -44,11 +47,6 @@ AccountImportSubview.prototype.render = function () {
|
|||||||
}
|
}
|
||||||
`),
|
`),
|
||||||
|
|
||||||
h('div', {
|
|
||||||
style: {
|
|
||||||
padding: '10px',
|
|
||||||
},
|
|
||||||
}, [
|
|
||||||
h(Select, {
|
h(Select, {
|
||||||
name: 'import-type-select',
|
name: 'import-type-select',
|
||||||
clearable: false,
|
clearable: false,
|
||||||
@ -62,9 +60,23 @@ AccountImportSubview.prototype.render = function () {
|
|||||||
onChange: (opt) => {
|
onChange: (opt) => {
|
||||||
this.setState({ type: opt.value })
|
this.setState({ type: opt.value })
|
||||||
},
|
},
|
||||||
})
|
}),
|
||||||
])
|
]),
|
||||||
|
|
||||||
|
this.renderImportView(),
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AccountImportSubview.prototype.renderImportView = function() {
|
||||||
|
const props = this.props
|
||||||
|
const state = this.state || {}
|
||||||
|
const { type } = state || props.types[0]
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case 'HD Key Tree':
|
||||||
|
return h(SeedImportView)
|
||||||
|
default:
|
||||||
|
return h(JsonImportView)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
27
ui/app/accounts/import/json.js
Normal file
27
ui/app/accounts/import/json.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
const inherits = require('util').inherits
|
||||||
|
const Component = require('react').Component
|
||||||
|
const h = require('react-hyperscript')
|
||||||
|
const connect = require('react-redux').connect
|
||||||
|
|
||||||
|
module.exports = connect(mapStateToProps)(JsonImportSubview)
|
||||||
|
|
||||||
|
function mapStateToProps (state) {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
|
||||||
|
inherits(JsonImportSubview, Component)
|
||||||
|
function JsonImportSubview () {
|
||||||
|
Component.call(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonImportSubview.prototype.render = function () {
|
||||||
|
return (
|
||||||
|
h('div', {
|
||||||
|
style: {
|
||||||
|
},
|
||||||
|
}, [
|
||||||
|
`Upload your json file here!`,
|
||||||
|
])
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
30
ui/app/accounts/import/seed.js
Normal file
30
ui/app/accounts/import/seed.js
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
const inherits = require('util').inherits
|
||||||
|
const Component = require('react').Component
|
||||||
|
const h = require('react-hyperscript')
|
||||||
|
const connect = require('react-redux').connect
|
||||||
|
|
||||||
|
module.exports = connect(mapStateToProps)(SeedImportSubview)
|
||||||
|
|
||||||
|
function mapStateToProps (state) {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
|
||||||
|
inherits(SeedImportSubview, Component)
|
||||||
|
function SeedImportSubview () {
|
||||||
|
Component.call(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
SeedImportSubview.prototype.render = function () {
|
||||||
|
return (
|
||||||
|
h('div', {
|
||||||
|
style: {
|
||||||
|
},
|
||||||
|
}, [
|
||||||
|
`Paste your seed phrase here!`,
|
||||||
|
h('textarea'),
|
||||||
|
h('br'),
|
||||||
|
h('button', 'Submit'),
|
||||||
|
])
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -10,7 +10,7 @@ var cssFiles = {
|
|||||||
'index.css': fs.readFileSync(path.join(__dirname, '/app/css/index.css'), 'utf8'),
|
'index.css': fs.readFileSync(path.join(__dirname, '/app/css/index.css'), 'utf8'),
|
||||||
'transitions.css': fs.readFileSync(path.join(__dirname, '/app/css/transitions.css'), 'utf8'),
|
'transitions.css': fs.readFileSync(path.join(__dirname, '/app/css/transitions.css'), 'utf8'),
|
||||||
'react-tooltip-component.css': fs.readFileSync(path.join(__dirname, '..', 'node_modules', 'react-tooltip-component', 'dist', 'react-tooltip-component.css'), 'utf8'),
|
'react-tooltip-component.css': fs.readFileSync(path.join(__dirname, '..', 'node_modules', 'react-tooltip-component', 'dist', 'react-tooltip-component.css'), 'utf8'),
|
||||||
'react-css': fs.readFileSync(path.join(__dirname, '..', 'node_modules', 'react-select', 'dist', 'react-select.css'), 'utf8')
|
'react-css': fs.readFileSync(path.join(__dirname, '..', 'node_modules', 'react-select', 'dist', 'react-select.css'), 'utf8'),
|
||||||
}
|
}
|
||||||
|
|
||||||
function bundleCss () {
|
function bundleCss () {
|
||||||
|
Loading…
Reference in New Issue
Block a user