aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2017-01-18 05:58:54 +0800
committerDan Finlay <dan@danfinlay.com>2017-01-18 05:58:54 +0800
commit958cbfbde44c201cf71f5dfcb7b1748bb43e597f (patch)
tree17949bcdd27172541ff374d8b8bf44ccd570af92 /ui
parent77bd010543855fafe21ac37e282bc8137ef7a7d8 (diff)
parentb3cb675a8bd406bd16aa74ff209032075f9b31d7 (diff)
downloadtangerine-wallet-browser-958cbfbde44c201cf71f5dfcb7b1748bb43e597f.tar
tangerine-wallet-browser-958cbfbde44c201cf71f5dfcb7b1748bb43e597f.tar.gz
tangerine-wallet-browser-958cbfbde44c201cf71f5dfcb7b1748bb43e597f.tar.bz2
tangerine-wallet-browser-958cbfbde44c201cf71f5dfcb7b1748bb43e597f.tar.lz
tangerine-wallet-browser-958cbfbde44c201cf71f5dfcb7b1748bb43e597f.tar.xz
tangerine-wallet-browser-958cbfbde44c201cf71f5dfcb7b1748bb43e597f.tar.zst
tangerine-wallet-browser-958cbfbde44c201cf71f5dfcb7b1748bb43e597f.zip
Merge branch 'i328-MultiVault-v1' into i715-AddImportMenu
Diffstat (limited to 'ui')
-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
-rw-r--r--ui/app/actions.js8
-rw-r--r--ui/app/app.js6
-rw-r--r--ui/app/components/buy-button-subview.js82
-rw-r--r--ui/app/components/tab-bar.js35
-rw-r--r--ui/app/css/lib.css8
-rw-r--r--ui/app/import/index.js36
-rw-r--r--ui/app/reducers/app.js9
-rw-r--r--ui/app/unlock.js2
-rw-r--r--ui/css.js1
15 files changed, 368 insertions, 74 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}`,
+ ])
+ )
+}
+
diff --git a/ui/app/actions.js b/ui/app/actions.js
index 1f1a707b5..87b02966b 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -44,6 +44,8 @@ var actions = {
createNewVaultInProgress: createNewVaultInProgress,
addNewKeyring,
addNewAccount,
+ NEW_ACCOUNT_SCREEN: 'NEW_ACCOUNT_SCREEN',
+ navigateToNewAccountScreen,
showNewVaultSeed: showNewVaultSeed,
showInfoPage: showInfoPage,
// seed recovery actions
@@ -254,6 +256,12 @@ function addNewKeyring (type, opts) {
return callBackgroundThenUpdate(background.addNewKeyring, type, opts)
}
+function navigateToNewAccountScreen() {
+ return {
+ type: this.NEW_ACCOUNT_SCREEN,
+ }
+}
+
function addNewAccount (ringNumber = 0) {
return callBackgroundThenUpdate(background.addNewAccount, ringNumber)
}
diff --git a/ui/app/app.js b/ui/app/app.js
index c6377a2cf..67c78b31c 100644
--- a/ui/app/app.js
+++ b/ui/app/app.js
@@ -20,7 +20,7 @@ const NoticeScreen = require('./components/notice')
const generateLostAccountsNotice = require('../lib/lost-accounts-notice')
// other views
const ConfigScreen = require('./config')
-const Import = require('./import')
+const Import = require('./accounts/import')
const InfoScreen = require('./info')
const LoadingIndicator = require('./components/loading')
const SandwichExpando = require('sandwich-expando')
@@ -33,6 +33,7 @@ const QrView = require('./components/qr-code')
const HDCreateVaultComplete = require('./keychains/hd/create-vault-complete')
const HDRestoreVaultScreen = require('./keychains/hd/restore-vault')
const RevealSeedConfirmation = require('./keychains/hd/recover-seed/confirmation')
+const AddAccountScreen = require('./accounts/add')
module.exports = connect(mapStateToProps)(App)
@@ -407,6 +408,9 @@ App.prototype.renderPrimary = function () {
case 'accountDetail':
return h(AccountDetailScreen, {key: 'account-detail'})
+ case 'new-account':
+ return h(AddAccountScreen, {key: 'new-account'})
+
case 'sendTransaction':
return h(SendTransactionScreen, {key: 'send-transaction'})
diff --git a/ui/app/components/buy-button-subview.js b/ui/app/components/buy-button-subview.js
index 35eda647e..afda5bf59 100644
--- a/ui/app/components/buy-button-subview.js
+++ b/ui/app/components/buy-button-subview.js
@@ -7,6 +7,7 @@ const CoinbaseForm = require('./coinbase-form')
const ShapeshiftForm = require('./shapeshift-form')
const extension = require('../../../app/scripts/lib/extension')
const Loading = require('./loading')
+const TabBar = require('./tab-bar')
module.exports = connect(mapStateToProps)(BuyButtonSubview)
@@ -29,7 +30,6 @@ function BuyButtonSubview () {
BuyButtonSubview.prototype.render = function () {
const props = this.props
- const currentForm = props.buyView.formView
const isLoading = props.isSubLoading
return (
@@ -53,43 +53,53 @@ BuyButtonSubview.prototype.render = function () {
h(Loading, { isLoading }),
- h('h3.flex-row.text-transform-uppercase', {
- style: {
- background: '#EBEBEB',
- color: '#AEAEAE',
- paddingTop: '4px',
- justifyContent: 'space-around',
+ h(TabBar, {
+ tabs: [
+ {
+ content: [
+ 'Coinbase',
+ h('a', {
+ onClick: (event) => this.navigateTo('https://github.com/MetaMask/faq/blob/master/COINBASE.md'),
+ }, [
+ h('i.fa.fa-question-circle', {
+ style: {
+ margin: '0px 5px',
+ },
+ }),
+ ]),
+ ],
+ key: 'coinbase',
+ },
+ {
+ content: [
+ 'Shapeshift',
+ h('a', {
+ href: 'https://github.com/MetaMask/faq/blob/master/COINBASE.md',
+ onClick: (event) => this.navigateTo('https://info.shapeshift.io/about'),
+ }, [
+ h('i.fa.fa-question-circle', {
+ style: {
+ margin: '0px 5px',
+ },
+ }),
+ ]),
+ ],
+ key: 'shapeshift',
+ },
+ ],
+ defaultTab: 'coinbase',
+ tabSelected: (key) => {
+ switch (key) {
+ case 'coinbase':
+ props.dispatch(actions.coinBaseSubview())
+ break
+ case 'shapeshift':
+ props.dispatch(actions.shapeShiftSubview(props.provider.type))
+ break
+ }
},
- }, [
- h(currentForm.coinbase ? '.activeForm' : '.inactiveForm.pointer', {
- onClick: () => props.dispatch(actions.coinBaseSubview()),
- }, 'Coinbase'),
- h('a', {
- onClick: (event) => this.navigateTo('https://github.com/MetaMask/faq/blob/master/COINBASE.md'),
- }, [
- h('i.fa.fa-question-circle', {
- style: {
- position: 'relative',
- right: '33px',
- },
- }),
- ]),
- h(currentForm.shapeshift ? '.activeForm' : '.inactiveForm.pointer', {
- onClick: () => props.dispatch(actions.shapeShiftSubview(props.provider.type)),
- }, 'Shapeshift'),
+ }),
- h('a', {
- href: 'https://github.com/MetaMask/faq/blob/master/COINBASE.md',
- onClick: (event) => this.navigateTo('https://info.shapeshift.io/about'),
- }, [
- h('i.fa.fa-question-circle', {
- style: {
- position: 'relative',
- right: '28px',
- },
- }),
- ]),
- ]),
this.formVersionSubview(),
])
)
diff --git a/ui/app/components/tab-bar.js b/ui/app/components/tab-bar.js
new file mode 100644
index 000000000..65078e0a4
--- /dev/null
+++ b/ui/app/components/tab-bar.js
@@ -0,0 +1,35 @@
+const Component = require('react').Component
+const h = require('react-hyperscript')
+const inherits = require('util').inherits
+
+module.exports = TabBar
+
+inherits(TabBar, Component)
+function TabBar () {
+ Component.call(this)
+}
+
+TabBar.prototype.render = function () {
+ const props = this.props
+ const state = this.state || {}
+ const { tabs = [], defaultTab, tabSelected } = props
+ const { subview = defaultTab } = state
+
+ return (
+ h('.flex-row.space-around.text-transform-uppercase', {
+ style: {
+ background: '#EBEBEB',
+ color: '#AEAEAE',
+ paddingTop: '4px',
+ },
+ }, tabs.map((tab) => {
+ const { key, content } = tab
+ return h(subview === key ? '.activeForm' : '.inactiveForm.pointer', {
+ onClick: () => {
+ this.setState({ subview: key })
+ tabSelected(key)
+ },
+ }, content)
+ }))
+ )
+}
diff --git a/ui/app/css/lib.css b/ui/app/css/lib.css
index abbf8667e..a8df1d115 100644
--- a/ui/app/css/lib.css
+++ b/ui/app/css/lib.css
@@ -23,6 +23,14 @@
flex-direction: column;
}
+.space-between {
+ justify-content: space-between;
+}
+
+.space-around {
+ justify-content: space-around;
+}
+
.flex-column-bottom {
display: flex;
flex-direction: column-reverse;
diff --git a/ui/app/import/index.js b/ui/app/import/index.js
deleted file mode 100644
index 89c79bedc..000000000
--- a/ui/app/import/index.js
+++ /dev/null
@@ -1,36 +0,0 @@
-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)(ImportIndex)
-
-function mapStateToProps (state) {
- return {}
-}
-
-inherits(ImportIndex, Component)
-function ImportIndex () {
- Component.call(this)
-}
-
-ImportIndex.prototype.render = function () {
- const props = this.props
-
-
- return (
-
- h('.accounts-section.flex-grow', [
-
- // subtitle and nav
- h('.section-title.flex-center', [
- h('i.fa.fa-arrow-left.fa-lg.cursor-pointer', {
- onClick: this.goHome.bind(this),
- }),
- h('h2.page-subtitle', 'Select Account'),
- ]),
-
- ])
- )
-}
-
diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js
index cfa98442a..ae91272cc 100644
--- a/ui/app/reducers/app.js
+++ b/ui/app/reducers/app.js
@@ -136,6 +136,15 @@ function reduceApp (state, action) {
isLoading: false,
})
+ case actions.NEW_ACCOUNT_SCREEN:
+ return extend(appState, {
+ currentView: {
+ name: 'new-account',
+ context: appState.currentView.context,
+ },
+ transForward: true,
+ })
+
case actions.SHOW_SEND_PAGE:
return extend(appState, {
currentView: {
diff --git a/ui/app/unlock.js b/ui/app/unlock.js
index 19f5eaec2..1aee3c5d0 100644
--- a/ui/app/unlock.js
+++ b/ui/app/unlock.js
@@ -26,7 +26,7 @@ UnlockScreen.prototype.render = function () {
const state = this.props
const warning = state.warning
return (
- h('.flex-column.hey-im-here', [
+ h('.flex-column', [
h('.unlock-screen.flex-column.flex-center.flex-grow', [
h(Mascot, {
diff --git a/ui/css.js b/ui/css.js
index 01f317acd..043363cd7 100644
--- a/ui/css.js
+++ b/ui/css.js
@@ -10,6 +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'),
}
function bundleCss () {