mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Add account adding subview placeholders
This commit is contained in:
parent
919ac066d9
commit
19f7041ba4
82
ui/app/accounts/add.js
Normal file
82
ui/app/accounts/add.js
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
const inherits = require('util').inherits
|
||||||
|
const Component = require('react').Component
|
||||||
|
const h = require('react-hyperscript')
|
||||||
|
const connect = require('react-redux').connect
|
||||||
|
const actions = require('../../actions')
|
||||||
|
|
||||||
|
// Components
|
||||||
|
const TabBar = require('../components/tab-bar')
|
||||||
|
|
||||||
|
// Subviews
|
||||||
|
const NewAccountView = require('./new')
|
||||||
|
const ImportAccountView = require('./import')
|
||||||
|
|
||||||
|
module.exports = connect(mapStateToProps)(AddAccountScreen)
|
||||||
|
|
||||||
|
function mapStateToProps (state) {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
|
||||||
|
inherits(AddAccountScreen, Component)
|
||||||
|
function AddAccountScreen () {
|
||||||
|
Component.call(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
AddAccountScreen.prototype.render = function () {
|
||||||
|
const props = this.props
|
||||||
|
const state = this.state || {}
|
||||||
|
const subview = state.subview || 'new'
|
||||||
|
|
||||||
|
return (
|
||||||
|
h('.flex-column', {
|
||||||
|
style: {
|
||||||
|
},
|
||||||
|
}, [
|
||||||
|
|
||||||
|
// title and nav
|
||||||
|
h('.flex-row.space-between', {
|
||||||
|
style: {
|
||||||
|
alignItems: 'center',
|
||||||
|
padding: '0px 20px',
|
||||||
|
}
|
||||||
|
}, [
|
||||||
|
h('i.fa.fa-arrow-left.fa-lg.cursor-pointer', {
|
||||||
|
onClick: this.goHome.bind(this),
|
||||||
|
}),
|
||||||
|
h('h2.page-subtitle', 'Add Account'),
|
||||||
|
h('i', { style: { width: '18px' } }),
|
||||||
|
]),
|
||||||
|
|
||||||
|
h(TabBar, {
|
||||||
|
tabs: [
|
||||||
|
{ content: 'Create New', key: 'new' },
|
||||||
|
{ content: 'Import', key: 'import' },
|
||||||
|
],
|
||||||
|
defaultTab: 'new',
|
||||||
|
tabSelected: (key) => {
|
||||||
|
this.setState({ subview: key })
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
|
||||||
|
this.renderNewOrImport(),
|
||||||
|
|
||||||
|
])
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
AddAccountScreen.prototype.goHome = function() {
|
||||||
|
this.props.dispatch(actions.showAccountPage())
|
||||||
|
}
|
||||||
|
|
||||||
|
AddAccountScreen.prototype.renderNewOrImport = function() {
|
||||||
|
const state = this.state || {}
|
||||||
|
const subview = state.subview || 'new'
|
||||||
|
|
||||||
|
switch (subview) {
|
||||||
|
case 'new':
|
||||||
|
return h(NewAccountView)
|
||||||
|
|
||||||
|
case 'import':
|
||||||
|
return h(ImportAccountView)
|
||||||
|
}
|
||||||
|
}
|
30
ui/app/accounts/import.js
Normal file
30
ui/app/accounts/import.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)(COMPONENTNAME)
|
||||||
|
|
||||||
|
function mapStateToProps (state) {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
|
||||||
|
inherits(COMPONENTNAME, Component)
|
||||||
|
function COMPONENTNAME () {
|
||||||
|
Component.call(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
COMPONENTNAME.prototype.render = function () {
|
||||||
|
const props = this.props
|
||||||
|
|
||||||
|
return (
|
||||||
|
h('div', {
|
||||||
|
style: {
|
||||||
|
background: 'blue',
|
||||||
|
},
|
||||||
|
}, [
|
||||||
|
`Hello, ${props.sender}`,
|
||||||
|
])
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -2,59 +2,29 @@ const inherits = require('util').inherits
|
|||||||
const Component = require('react').Component
|
const Component = require('react').Component
|
||||||
const h = require('react-hyperscript')
|
const h = require('react-hyperscript')
|
||||||
const connect = require('react-redux').connect
|
const connect = require('react-redux').connect
|
||||||
const TabBar = require('../components/tab-bar')
|
|
||||||
|
|
||||||
module.exports = connect(mapStateToProps)(NewAccountScreen)
|
module.exports = connect(mapStateToProps)(COMPONENTNAME)
|
||||||
|
|
||||||
function mapStateToProps (state) {
|
function mapStateToProps (state) {
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
|
|
||||||
inherits(NewAccountScreen, Component)
|
inherits(COMPONENTNAME, Component)
|
||||||
function NewAccountScreen () {
|
function COMPONENTNAME () {
|
||||||
Component.call(this)
|
Component.call(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
NewAccountScreen.prototype.render = function () {
|
COMPONENTNAME.prototype.render = function () {
|
||||||
const props = this.props
|
const props = this.props
|
||||||
const state = this.state || {}
|
|
||||||
const subview = state.subview || 'new'
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
h('.flex-column', {
|
h('div', {
|
||||||
style: {
|
style: {
|
||||||
|
background: 'red',
|
||||||
},
|
},
|
||||||
}, [
|
}, [
|
||||||
|
`Hello, ${props.sender}`,
|
||||||
// title and nav
|
|
||||||
h('.flex-row.space-between', {
|
|
||||||
style: {
|
|
||||||
alignItems: 'center',
|
|
||||||
padding: '0px 20px',
|
|
||||||
}
|
|
||||||
}, [
|
|
||||||
h('i.fa.fa-arrow-left.fa-lg.cursor-pointer', {
|
|
||||||
onClick: this.goHome.bind(this),
|
|
||||||
}),
|
|
||||||
h('h2.page-subtitle', 'Add Account'),
|
|
||||||
h('i', { style: { width: '18px' } }),
|
|
||||||
]),
|
|
||||||
|
|
||||||
h(TabBar, {
|
|
||||||
tabs: [
|
|
||||||
{ content: 'Create New', key: 'new' },
|
|
||||||
{ content: 'Import', key: 'import' },
|
|
||||||
],
|
|
||||||
defaultTab: 'new',
|
|
||||||
tabSelected: (key) => {
|
|
||||||
console.log('selected ' + key)
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
NewAccountScreen.prototype.goHome = function() {
|
|
||||||
this.props.dispatch(actions.showAccountPage())
|
|
||||||
}
|
|
||||||
|
@ -29,7 +29,7 @@ const QrView = require('./components/qr-code')
|
|||||||
const HDCreateVaultComplete = require('./keychains/hd/create-vault-complete')
|
const HDCreateVaultComplete = require('./keychains/hd/create-vault-complete')
|
||||||
const HDRestoreVaultScreen = require('./keychains/hd/restore-vault')
|
const HDRestoreVaultScreen = require('./keychains/hd/restore-vault')
|
||||||
const RevealSeedConfirmation = require('./keychains/hd/recover-seed/confirmation')
|
const RevealSeedConfirmation = require('./keychains/hd/recover-seed/confirmation')
|
||||||
const NewAccountScreen = require('./accounts/new')
|
const AddAccountScreen = require('./accounts/add')
|
||||||
|
|
||||||
module.exports = connect(mapStateToProps)(App)
|
module.exports = connect(mapStateToProps)(App)
|
||||||
|
|
||||||
@ -402,7 +402,7 @@ App.prototype.renderPrimary = function () {
|
|||||||
return h(AccountDetailScreen, {key: 'account-detail'})
|
return h(AccountDetailScreen, {key: 'account-detail'})
|
||||||
|
|
||||||
case 'new-account':
|
case 'new-account':
|
||||||
return h(NewAccountScreen, {key: 'new-account'})
|
return h(AddAccountScreen, {key: 'new-account'})
|
||||||
|
|
||||||
case 'sendTransaction':
|
case 'sendTransaction':
|
||||||
return h(SendTransactionScreen, {key: 'send-transaction'})
|
return h(SendTransactionScreen, {key: 'send-transaction'})
|
||||||
|
Loading…
Reference in New Issue
Block a user