aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/accounts
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/accounts')
-rw-r--r--ui/app/accounts/add.js79
-rw-r--r--ui/app/accounts/import/index.js82
-rw-r--r--ui/app/accounts/import/json.js27
-rw-r--r--ui/app/accounts/import/seed.js30
-rw-r--r--ui/app/accounts/index.js7
-rw-r--r--ui/app/accounts/new.js30
6 files changed, 255 insertions, 0 deletions
diff --git a/ui/app/accounts/add.js b/ui/app/accounts/add.js
new file mode 100644
index 000000000..898f89be2
--- /dev/null
+++ b/ui/app/accounts/add.js
@@ -0,0 +1,79 @@
+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 () {
+
+ 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.showAccountsPage())
+}
+
+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)
+ }
+}
diff --git a/ui/app/accounts/import/index.js b/ui/app/accounts/import/index.js
new file mode 100644
index 000000000..a7c3252cd
--- /dev/null
+++ b/ui/app/accounts/import/index.js
@@ -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
+import Select from 'react-select'
+
+// Subviews
+const JsonImportView = require('./json.js')
+const SeedImportView = require('./seed.js')
+
+module.exports = connect(mapStateToProps)(AccountImportSubview)
+
+function mapStateToProps (state) {
+ return {
+ types: state.metamask.keyringTypes,
+ }
+}
+
+inherits(AccountImportSubview, Component)
+function AccountImportSubview () {
+ Component.call(this)
+}
+
+AccountImportSubview.prototype.render = function () {
+ const props = this.props
+ const state = this.state || {}
+ const { types } = props
+ const { type } = state
+
+ return (
+ h('div', {
+ style: {
+ },
+ }, [
+ h('div', {
+ style: {
+ padding: '10px',
+ 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(Select, {
+ name: 'import-type-select',
+ clearable: false,
+ value: type || types[0],
+ options: types.map((type) => {
+ return {
+ value: type,
+ label: type,
+ }
+ }),
+ 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)
+ }
+}
diff --git a/ui/app/accounts/import/json.js b/ui/app/accounts/import/json.js
new file mode 100644
index 000000000..22cf95cfd
--- /dev/null
+++ b/ui/app/accounts/import/json.js
@@ -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!`,
+ ])
+ )
+}
+
diff --git a/ui/app/accounts/import/seed.js b/ui/app/accounts/import/seed.js
new file mode 100644
index 000000000..b4a7c0afa
--- /dev/null
+++ b/ui/app/accounts/import/seed.js
@@ -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'),
+ ])
+ )
+}
+
diff --git a/ui/app/accounts/index.js b/ui/app/accounts/index.js
index edb15eafe..5ab31a1c0 100644
--- a/ui/app/accounts/index.js
+++ b/ui/app/accounts/index.js
@@ -154,6 +154,13 @@ AccountsScreen.prototype.addNewAccount = function () {
this.props.dispatch(actions.addNewAccount(0))
}
+/* An optional view proposed in this design:
+ * https://consensys.quip.com/zZVrAysM5znY
+AccountsScreen.prototype.addNewAccount = function () {
+ this.props.dispatch(actions.navigateToNewAccountScreen())
+}
+*/
+
AccountsScreen.prototype.goHome = function () {
this.props.dispatch(actions.goHome())
}
diff --git a/ui/app/accounts/new.js b/ui/app/accounts/new.js
new file mode 100644
index 000000000..07fc1e672
--- /dev/null
+++ b/ui/app/accounts/new.js
@@ -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: 'red',
+ },
+ }, [
+ `Hello, ${props.sender}`,
+ ])
+ )
+}
+