1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-22 17:33:23 +01:00

Develop import subviews

This commit is contained in:
Dan Finlay 2016-11-04 15:08:50 -07:00
parent a7af47db92
commit b3cb675a8b
6 changed files with 87 additions and 17 deletions

View File

@ -1,5 +1,6 @@
{
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 6,
"ecmaFeatures": {
"experimentalObjectRestSpread": true,

View File

@ -62,7 +62,7 @@ AddAccountScreen.prototype.render = function () {
}
AddAccountScreen.prototype.goHome = function() {
this.props.dispatch(actions.showAccountPage())
this.props.dispatch(actions.showAccountsPage())
}
AddAccountScreen.prototype.renderNewOrImport = function() {

View File

@ -4,6 +4,10 @@ const h = require('react-hyperscript')
const connect = require('react-redux').connect
import Select from 'react-select'
// Subviews
const JsonImportView = require('./json.js')
const SeedImportView = require('./seed.js')
module.exports = connect(mapStateToProps)(AccountImportSubview)
function mapStateToProps (state) {
@ -31,24 +35,18 @@ AccountImportSubview.prototype.render = function () {
h('div', {
style: {
padding: '10px',
background: 'rgb(242,242,242)',
color: 'rgb(174, 174, 174)',
},
}, [
h('h3', 'SELECT TYPE'),
]),
h('style', `
.has-value.Select--single > .Select-control .Select-value .Select-value-label, .Select-value-label {
color: rgb(174,174,174);
}
`),
h('h3', { style: { padding: '3px' } }, 'SELECT TYPE'),
h('style', `
.has-value.Select--single > .Select-control .Select-value .Select-value-label, .Select-value-label {
color: rgb(174,174,174);
}
`),
h('div', {
style: {
padding: '10px',
},
}, [
h(Select, {
name: 'import-type-select',
clearable: false,
@ -62,9 +60,23 @@ AccountImportSubview.prototype.render = function () {
onChange: (opt) => {
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)
}
}

View 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!`,
])
)
}

View 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'),
])
)
}

View File

@ -10,7 +10,7 @@ var cssFiles = {
'index.css': fs.readFileSync(path.join(__dirname, '/app/css/index.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-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 () {