From a167bbc5a0f29568ec8e53ecdd942724aa15604b Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 16 Aug 2016 17:32:54 -0700 Subject: MVP Popup Notifications Working I'm unsure which will be more performant: A notification using a trimmed down version of the UI, or using them both, letting the browser cache them both. In any case, here I've modified the normal UI to recognize when it's a popup, and change the UX accordingly in a few ways: - Hide the menu bar - Hide the back button from the notifications view. - When confirming the last tx, close the window. --- ui/app/app.js | 5 +++++ ui/app/conf-tx.js | 5 +++-- ui/app/reducers/app.js | 12 ++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) (limited to 'ui/app') diff --git a/ui/app/app.js b/ui/app/app.js index 2d8b46ce8..3b21e4477 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -95,6 +95,11 @@ App.prototype.render = function () { } App.prototype.renderAppBar = function () { + + if (window.METAMASK_UI_TYPE === 'notification') { + return null + } + const props = this.props const state = this.state || {} const isNetworkMenuOpen = state.isNetworkMenuOpen || false diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js index db876dd9b..8c6a136bf 100644 --- a/ui/app/conf-tx.js +++ b/ui/app/conf-tx.js @@ -36,6 +36,7 @@ ConfirmTxScreen.prototype.render = function () { var unconfTxList = txHelper(unconfTxs, unconfMsgs) var index = state.index !== undefined ? state.index : 0 var txData = unconfTxList[index] || {} + var isNotification = window.METAMASK_UI_TYPE === 'notification' return ( @@ -43,9 +44,9 @@ ConfirmTxScreen.prototype.render = function () { // subtitle and nav h('.section-title.flex-row.flex-center', [ - h('i.fa.fa-arrow-left.fa-lg.cursor-pointer', { + !isNotification ? h('i.fa.fa-arrow-left.fa-lg.cursor-pointer', { onClick: this.goHome.bind(this), - }), + }) : null, h('h2.page-subtitle', 'Confirm Transaction'), ]), diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index 95b60f929..cbf64bf95 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -1,6 +1,7 @@ const extend = require('xtend') const actions = require('../actions') const txHelper = require('../../lib/tx-helper') +const extension = require('../../../app/scripts/lib/extension') module.exports = reduceApp @@ -250,6 +251,17 @@ function reduceApp (state, action) { warning: null, }) } else { + + const isNotification = window.METAMASK_UI_TYPE === 'notification' + if (isNotification) { + return extension.windows.getCurrent({}, function(win) { + extension.windows.remove(win.id, function(err) { + if (err) console.err(err) + }) + }) + } else { + debugger + } return extend(appState, { transForward: false, warning: null, -- cgit From dfaac78e39ef1bd06e224ab56e493b4fa3201bef Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 16 Aug 2016 17:50:51 -0700 Subject: Linted --- ui/app/reducers/app.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'ui/app') diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index cbf64bf95..deebf02be 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -254,14 +254,11 @@ function reduceApp (state, action) { const isNotification = window.METAMASK_UI_TYPE === 'notification' if (isNotification) { - return extension.windows.getCurrent({}, function(win) { - extension.windows.remove(win.id, function(err) { - if (err) console.err(err) - }) - }) - } else { - debugger + extension.windows.getCurrent({}, (win) => { + extension.windows.remove(win.id, console.error) + }) } + return extend(appState, { transForward: false, warning: null, -- cgit From a9b53530b64cbe33f85d62c8042a72dd41353f26 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 22 Aug 2016 17:29:47 -0700 Subject: Fix back button hiding on popup --- ui/app/conf-tx.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ui/app') diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js index 8c6a136bf..f832b8a4b 100644 --- a/ui/app/conf-tx.js +++ b/ui/app/conf-tx.js @@ -5,6 +5,7 @@ const h = require('react-hyperscript') const connect = require('react-redux').connect const actions = require('./actions') const txHelper = require('../lib/tx-helper') +const isPopupOrNotification = require('../../app/scripts/lib/is-popup-or-notification') const PendingTx = require('./components/pending-tx') const PendingMsg = require('./components/pending-msg') @@ -36,7 +37,7 @@ ConfirmTxScreen.prototype.render = function () { var unconfTxList = txHelper(unconfTxs, unconfMsgs) var index = state.index !== undefined ? state.index : 0 var txData = unconfTxList[index] || {} - var isNotification = window.METAMASK_UI_TYPE === 'notification' + var isNotification = isPopupOrNotification() === 'notification' return ( -- cgit From 4fb49dfb4b3f23a5510c5a958671e9454d214a11 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 23 Aug 2016 11:40:08 -0700 Subject: Close popup even if last tx is dismissed from main UI --- ui/app/reducers/app.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'ui/app') diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index 94b7e8bf7..7bd1dfd1f 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -2,6 +2,7 @@ const extend = require('xtend') const actions = require('../actions') const txHelper = require('../../lib/tx-helper') const extension = require('../../../app/scripts/lib/extension') +const notification = require('../../../app/scripts/lib/notifications') module.exports = reduceApp @@ -252,12 +253,7 @@ function reduceApp (state, action) { }) } else { - const isNotification = window.METAMASK_UI_TYPE === 'notification' - if (isNotification) { - extension.windows.getCurrent({}, (win) => { - extension.windows.remove(win.id, console.error) - }) - } + closePopupIfOpen() return extend(appState, { transForward: false, @@ -524,4 +520,9 @@ function indexForPending (state, txId) { return idx } - +function closePopupIfOpen() { + notification.getPopup((popup) => { + if (!popup) return + extension.windows.remove(popup.id, console.error) + }) +} -- cgit From 671ca33abb93fafeb55a18543e81942c5963da8e Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 23 Aug 2016 15:44:50 -0700 Subject: Close notification on opening main UI --- ui/app/reducers/app.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'ui/app') diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index 7bd1dfd1f..132e73f69 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -253,7 +253,7 @@ function reduceApp (state, action) { }) } else { - closePopupIfOpen() + notification.closePopup() return extend(appState, { transForward: false, @@ -520,9 +520,3 @@ function indexForPending (state, txId) { return idx } -function closePopupIfOpen() { - notification.getPopup((popup) => { - if (!popup) return - extension.windows.remove(popup.id, console.error) - }) -} -- cgit From 65f765648735fec9b5180d3a7706048d611e48ba Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 23 Aug 2016 15:48:16 -0700 Subject: Linted --- ui/app/reducers/app.js | 1 - 1 file changed, 1 deletion(-) (limited to 'ui/app') diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index 132e73f69..da2c6e371 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -1,7 +1,6 @@ const extend = require('xtend') const actions = require('../actions') const txHelper = require('../../lib/tx-helper') -const extension = require('../../../app/scripts/lib/extension') const notification = require('../../../app/scripts/lib/notifications') module.exports = reduceApp -- cgit From d81bde9f6c83c72dd693550494503f8be23a1a20 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 25 Aug 2016 12:18:04 -0700 Subject: Make restore vault form persist --- ui/app/first-time/restore-vault.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'ui/app') diff --git a/ui/app/first-time/restore-vault.js b/ui/app/first-time/restore-vault.js index 684781e50..4c1f21008 100644 --- a/ui/app/first-time/restore-vault.js +++ b/ui/app/first-time/restore-vault.js @@ -1,14 +1,14 @@ const inherits = require('util').inherits -const Component = require('react').Component +const PersistentForm = require('../../lib/persistent-form') const connect = require('react-redux').connect const h = require('react-hyperscript') const actions = require('../actions') module.exports = connect(mapStateToProps)(RestoreVaultScreen) -inherits(RestoreVaultScreen, Component) +inherits(RestoreVaultScreen, PersistentForm) function RestoreVaultScreen () { - Component.call(this) + PersistentForm.call(this) } function mapStateToProps (state) { @@ -19,6 +19,8 @@ function mapStateToProps (state) { RestoreVaultScreen.prototype.render = function () { var state = this.props + this.persistentFormParentId = 'restore-vault-form' + return ( h('.initialize-screen.flex-column.flex-center.flex-grow', [ @@ -39,6 +41,9 @@ RestoreVaultScreen.prototype.render = function () { // wallet seed entry h('h3', 'Wallet Seed'), h('textarea.twelve-word-phrase.letter-spacey', { + dataset: { + persistentFormId: 'wallet-seed', + }, placeholder: 'Enter your secret twelve word phrase here to restore your vault.', }), @@ -47,6 +52,9 @@ RestoreVaultScreen.prototype.render = function () { type: 'password', id: 'password-box', placeholder: 'New Password (min 8 chars)', + dataset: { + persistentFormId: 'password', + }, style: { width: 260, marginTop: 12, @@ -59,6 +67,9 @@ RestoreVaultScreen.prototype.render = function () { id: 'password-box-confirm', placeholder: 'Confirm Password', onKeyPress: this.onMaybeCreate.bind(this), + dataset: { + persistentFormId: 'password-confirmation', + }, style: { width: 260, marginTop: 16, -- cgit From b39bd5333b8bb55cc11a191313c742c60a623650 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 25 Aug 2016 14:10:07 -0700 Subject: Persist send tx form field values --- ui/app/send.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'ui/app') diff --git a/ui/app/send.js b/ui/app/send.js index 06ea199f4..0cc3a032f 100644 --- a/ui/app/send.js +++ b/ui/app/send.js @@ -1,5 +1,5 @@ const inherits = require('util').inherits -const Component = require('react').Component +const PersistentForm = require('../lib/persistent-form') const h = require('react-hyperscript') const connect = require('react-redux').connect const Identicon = require('./components/identicon') @@ -29,12 +29,14 @@ function mapStateToProps (state) { return result } -inherits(SendTransactionScreen, Component) +inherits(SendTransactionScreen, PersistentForm) function SendTransactionScreen () { - Component.call(this) + PersistentForm.call(this) } SendTransactionScreen.prototype.render = function () { + this.persistentFormParentId = 'send-tx-form' + var state = this.props var address = state.address var account = state.account @@ -137,6 +139,9 @@ SendTransactionScreen.prototype.render = function () { h('input.large-input', { name: 'address', placeholder: 'Recipient Address', + dataset: { + persistentFormId: 'recipient-address', + }, }), ]), @@ -150,6 +155,9 @@ SendTransactionScreen.prototype.render = function () { style: { marginRight: 6, }, + dataset: { + persistentFormId: 'tx-amount', + }, }), h('button.primary', { @@ -185,11 +193,12 @@ SendTransactionScreen.prototype.render = function () { width: '100%', resize: 'none', }, + dataset: { + persistentFormId: 'tx-data', + }, }), ]), - ]) - ) } -- cgit From 483a7fee0a815812ef43601f64083ed26825d0a4 Mon Sep 17 00:00:00 2001 From: Frankie Date: Tue, 23 Aug 2016 17:17:08 -0700 Subject: Add a back button on lock screen to go back to init menu --- ui/app/actions.js | 18 ++++++++++ ui/app/app.js | 59 ++++++++++++++++++++++++++++++- ui/app/first-time/init-menu.js | 2 -- ui/app/reducers/app.js | 21 +++++++++++ ui/app/unlock.js | 79 +++++++++++++++++++++--------------------- 5 files changed, 136 insertions(+), 43 deletions(-) (limited to 'ui/app') diff --git a/ui/app/actions.js b/ui/app/actions.js index c6c932296..c92138f68 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -137,6 +137,12 @@ var actions = { getQr: getQr, reshowQrCode: reshowQrCode, SHOW_QR_VIEW: 'SHOW_QR_VIEW', +// FORGOT PASSWORD: + BACK_TO_INIT_MENU: 'BACK_TO_INIT_MENU', + goBackToInitView: goBackToInitView, + RECOVERY_IN_PROGRESS: 'RECOVERY_IN_PROGRESS', + BACK_TO_UNLOCK_VIEW: 'BACK_TO_UNLOCK_VIEW', + backToUnlockView: backToUnlockView, } module.exports = actions @@ -370,6 +376,12 @@ function showNewVaultSeed (seed) { } } +function backToUnlockView () { + return { + type: actions.BACK_TO_UNLOCK_VIEW, + } +} + // // unlock screen // @@ -498,6 +510,12 @@ function showConfigPage (transitionForward = true) { } } +function goBackToInitView () { + return { + type: actions.BACK_TO_INIT_MENU, + } +} + // // config // diff --git a/ui/app/app.js b/ui/app/app.js index 84ff16ec8..b1c258270 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -51,6 +51,7 @@ function mapStateToProps (state) { menuOpen: state.appState.menuOpen, network: state.metamask.network, provider: state.metamask.provider, + forgottenPassword: state.appState.forgottenPassword, } } @@ -89,6 +90,7 @@ App.prototype.render = function () { transitionLeaveTimeout: 300, }, [ this.renderPrimary(), + this.renderBackToInitButton(), ]), ]), ]) @@ -294,6 +296,61 @@ App.prototype.renderDropdown = function () { ]) } +App.prototype.renderBackToInitButton = function () { + var props = this.props + var button = null + var backButton = h('.flex-row', { + key: 'leftArrow', + transForward: false, + style: { + position: 'absolute', + bottom: '10px', + left: '8px', + fontSize: '21px', + fontFamily: 'Montserrat Light', + color: '#7F8082', + width: '71.969px', + alignItems: 'flex-end', + }, + }, [ + h('i.fa.fa-arrow-left.cursor-pointer'), + h('div.cursor-pointer', { + style: { + marginLeft: '3px', + }, + onClick: () => props.dispatch(actions.goBackToInitView()), + }, 'Back'), + ]) + if (!props.isUnlocked) { + if (props.currentView.name === 'InitMenu') { + button = props.forgottenPassword ? h('.flex-row', { + key: 'rightArrow', + style: { + position: 'absolute', + bottom: '10px', + right: '8px', + fontSize: '21px', + fontFamily: 'Montserrat Light', + color: '#7F8082', + width: '77.578px', + alignItems: 'flex-end', + }, + }, [ + h('div.cursor-pointer', { + style: { + marginRight: '3px', + }, + onClick: () => props.dispatch(actions.backToUnlockView()), + }, 'Login'), + h('i.fa.fa-arrow-right.cursor-pointer'), + ]) : null + } else if (props.isInitialized) { + button = backButton + } + } + return button +} + App.prototype.renderPrimary = function () { var props = this.props @@ -306,7 +363,7 @@ App.prototype.renderPrimary = function () { } // show initialize screen - if (!props.isInitialized) { + if (!props.isInitialized || props.forgottenPassword) { // show current view switch (props.currentView.name) { diff --git a/ui/app/first-time/init-menu.js b/ui/app/first-time/init-menu.js index e63c30fc5..94a9d3df6 100644 --- a/ui/app/first-time/init-menu.js +++ b/ui/app/first-time/init-menu.js @@ -73,9 +73,7 @@ InitializeMenuScreen.prototype.renderMenu = function () { margin: 12, }, }, 'Restore Existing Vault'), - ]) - ) } diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index 8c2696877..f982cc0c8 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -123,6 +123,7 @@ function reduceApp (state, action) { case actions.UNLOCK_METAMASK: return extend(appState, { + forgottenPassword: appState.forgottenPassword ? !appState.forgottenPassword : null, detailView: {}, transForward: true, isLoading: false, @@ -136,6 +137,25 @@ function reduceApp (state, action) { warning: null, }) + case actions.BACK_TO_INIT_MENU: + return extend(appState, { + warning: null, + transForward: false, + forgottenPassword: true, + currentView: { + name: 'InitMenu', + }, + }) + + case actions.BACK_TO_UNLOCK_VIEW: + return extend(appState, { + warning: null, + transForward: true, + forgottenPassword: !appState.forgottenPassword, + currentView: { + name: 'UnlockScreen', + }, + }) // reveal seed words case actions.REVEAL_SEED_CONFIRMATION: @@ -170,6 +190,7 @@ function reduceApp (state, action) { case actions.SHOW_ACCOUNT_DETAIL: return extend(appState, { + forgottenPassword: appState.forgottenPassword ? !appState.forgottenPassword : null, currentView: { name: 'accountDetail', context: action.value, diff --git a/ui/app/unlock.js b/ui/app/unlock.js index a7896d640..eeaedc434 100644 --- a/ui/app/unlock.js +++ b/ui/app/unlock.js @@ -25,47 +25,46 @@ UnlockScreen.prototype.render = function () { const state = this.props const warning = state.warning return ( - - h('.unlock-screen.flex-column.flex-center.flex-grow', [ - - h(Mascot, { - animationEventEmitter: this.animationEventEmitter, - }), - - h('h1', { - style: { - fontSize: '1.4em', - textTransform: 'uppercase', - color: '#7F8082', - }, - }, 'MetaMask'), - - h('input.large-input', { - type: 'password', - id: 'password-box', - placeholder: 'enter password', - style: { - - }, - onKeyPress: this.onKeyPress.bind(this), - onInput: this.inputChanged.bind(this), - }), - - h('.error', { - style: { - display: warning ? 'block' : 'none', - }, - }, warning), - - h('button.primary.cursor-pointer', { - onClick: this.onSubmit.bind(this), - style: { - margin: 10, - }, - }, 'Unlock'), - + h('.flex-column.hey-im-here', [ + h('.unlock-screen.flex-column.flex-center.flex-grow', [ + + h(Mascot, { + animationEventEmitter: this.animationEventEmitter, + }), + + h('h1', { + style: { + fontSize: '1.4em', + textTransform: 'uppercase', + color: '#7F8082', + }, + }, 'MetaMask'), + + h('input.large-input', { + type: 'password', + id: 'password-box', + placeholder: 'enter password', + style: { + + }, + onKeyPress: this.onKeyPress.bind(this), + onInput: this.inputChanged.bind(this), + }), + + h('.error', { + style: { + display: warning ? 'block' : 'none', + }, + }, warning), + + h('button.primary.cursor-pointer', { + onClick: this.onSubmit.bind(this), + style: { + margin: 10, + }, + }, 'Unlock'), + ]), ]) - ) } -- cgit From a8e40ffe7a4e8a780fefe841ac73fe12e543f290 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 25 Aug 2016 14:19:09 -0700 Subject: Persist shapeshift form input values --- ui/app/components/shapeshift-form.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/shapeshift-form.js b/ui/app/components/shapeshift-form.js index b8650f7d5..58b7942c3 100644 --- a/ui/app/components/shapeshift-form.js +++ b/ui/app/components/shapeshift-form.js @@ -1,4 +1,4 @@ -const Component = require('react').Component +const PersistentForm = require('../../lib/persistent-form') const h = require('react-hyperscript') const inherits = require('util').inherits const connect = require('react-redux').connect @@ -17,12 +17,15 @@ function mapStateToProps(state) { } } -inherits(ShapeshiftForm, Component) +inherits(ShapeshiftForm, PersistentForm) function ShapeshiftForm () { - Component.call(this) + PersistentForm.call(this) + this.persistentFormParentId = 'shapeshift-buy-form' } + ShapeshiftForm.prototype.render = function () { + return h(ReactCSSTransitionGroup, { className: 'css-transition-group', transitionName: 'main', @@ -66,6 +69,9 @@ ShapeshiftForm.prototype.renderMain = function () { h('input#fromCoin.buy-inputs.ex-coins', { type: 'text', list: 'coinList', + dataset: { + persistentFormId: 'input-coin', + }, style: { boxSizing: 'border-box', }, @@ -159,6 +165,9 @@ ShapeshiftForm.prototype.renderMain = function () { h('input#fromCoinAddress.buy-inputs', { type: 'text', placeholder: `Your ${coin} Refund Address`, + dataset: { + persistentFormId: 'refund-address', + }, style: { boxSizing: 'border-box', width: '278px', -- cgit From 250cf8cc23305e33f4fc26a1711996ebc54fd9ad Mon Sep 17 00:00:00 2001 From: Frankie Date: Thu, 25 Aug 2016 16:05:44 -0700 Subject: Change style on back button to be more like the rest of the app --- ui/app/app.js | 80 ++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 55 insertions(+), 25 deletions(-) (limited to 'ui/app') diff --git a/ui/app/app.js b/ui/app/app.js index b1c258270..7b47732c4 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -299,28 +299,24 @@ App.prototype.renderDropdown = function () { App.prototype.renderBackToInitButton = function () { var props = this.props var button = null - var backButton = h('.flex-row', { - key: 'leftArrow', - transForward: false, - style: { - position: 'absolute', - bottom: '10px', - left: '8px', - fontSize: '21px', - fontFamily: 'Montserrat Light', - color: '#7F8082', - width: '71.969px', - alignItems: 'flex-end', - }, - }, [ - h('i.fa.fa-arrow-left.cursor-pointer'), - h('div.cursor-pointer', { - style: { - marginLeft: '3px', - }, - onClick: () => props.dispatch(actions.goBackToInitView()), - }, 'Back'), - ]) + var backButton = function (style, justArrow = false) { + return ( + h('.flex-row', { + key: 'leftArrow', + transForward: false, + style: style, + onClick: () => props.dispatch(actions.goBackToInitView()), + }, [ + h('i.fa.fa-arrow-left.cursor-pointer'), + justArrow ? null : h('div.cursor-pointer', { + style: { + marginLeft: '3px', + }, + onClick: () => props.dispatch(actions.goBackToInitView()), + }, 'BACK'), + ]) + ) + } if (!props.isUnlocked) { if (props.currentView.name === 'InitMenu') { button = props.forgottenPassword ? h('.flex-row', { @@ -328,7 +324,7 @@ App.prototype.renderBackToInitButton = function () { style: { position: 'absolute', bottom: '10px', - right: '8px', + right: '15px', fontSize: '21px', fontFamily: 'Montserrat Light', color: '#7F8082', @@ -341,11 +337,45 @@ App.prototype.renderBackToInitButton = function () { marginRight: '3px', }, onClick: () => props.dispatch(actions.backToUnlockView()), - }, 'Login'), + }, 'LOGIN'), h('i.fa.fa-arrow-right.cursor-pointer'), ]) : null } else if (props.isInitialized) { - button = backButton + var style + switch (props.currentView.name) { + case 'createVault': + style = { + position: 'absolute', + top: '41px', + left: '80px', + fontSize: '21px', + fontFamily: 'Montserrat Bold', + color: 'rgb(174, 174, 174)', + } + return backButton(style, true) + case 'restoreVault': + style = { + position: 'absolute', + top: '41px', + left: '70px', + fontSize: '21px', + fontFamily: 'Montserrat Bold', + color: 'rgb(174, 174, 174)', + } + return backButton(style, true) + default: + style = { + position: 'absolute', + bottom: '10px', + left: '15px', + fontSize: '21px', + fontFamily: 'Montserrat Light', + color: '#7F8082', + width: '71.969px', + alignItems: 'flex-end', + } + return backButton(style) + } } } return button -- cgit From ae3358666014e4c302284e7ef760ce0d24cd7094 Mon Sep 17 00:00:00 2001 From: Frankie Date: Fri, 26 Aug 2016 11:30:07 -0700 Subject: make the back button its own function --- ui/app/app.js | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) (limited to 'ui/app') diff --git a/ui/app/app.js b/ui/app/app.js index 6dbfbb86b..70a6fcd64 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -300,28 +300,29 @@ App.prototype.renderDropdown = function () { }), ]) } +App.prototype.renderBackButton = function (style, justArrow = false) { + var props = this.props + return ( + h('.flex-row', { + key: 'leftArrow', + transForward: false, + style: style, + onClick: () => props.dispatch(actions.goBackToInitView()), + }, [ + h('i.fa.fa-arrow-left.cursor-pointer'), + justArrow ? null : h('div.cursor-pointer', { + style: { + marginLeft: '3px', + }, + onClick: () => props.dispatch(actions.goBackToInitView()), + }, 'BACK'), + ]) + ) +} App.prototype.renderBackToInitButton = function () { var props = this.props var button = null - var backButton = function (style, justArrow = false) { - return ( - h('.flex-row', { - key: 'leftArrow', - transForward: false, - style: style, - onClick: () => props.dispatch(actions.goBackToInitView()), - }, [ - h('i.fa.fa-arrow-left.cursor-pointer'), - justArrow ? null : h('div.cursor-pointer', { - style: { - marginLeft: '3px', - }, - onClick: () => props.dispatch(actions.goBackToInitView()), - }, 'BACK'), - ]) - ) - } if (!props.isUnlocked) { if (props.currentView.name === 'InitMenu') { button = props.forgottenPassword ? h('.flex-row', { @@ -357,7 +358,7 @@ App.prototype.renderBackToInitButton = function () { fontFamily: 'Montserrat Bold', color: 'rgb(174, 174, 174)', } - return backButton(style, true) + return this.renderBackButton(style, true) case 'restoreVault': style = { position: 'absolute', @@ -367,7 +368,7 @@ App.prototype.renderBackToInitButton = function () { fontFamily: 'Montserrat Bold', color: 'rgb(174, 174, 174)', } - return backButton(style, true) + return this.renderBackButton(style, true) default: style = { position: 'absolute', @@ -379,7 +380,7 @@ App.prototype.renderBackToInitButton = function () { width: '71.969px', alignItems: 'flex-end', } - return backButton(style) + return this.renderBackButton(style) } } } -- cgit From 62179a37f76fab1cebffe80ca65628795e24ad4e Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Fri, 26 Aug 2016 15:08:02 -0700 Subject: Fix spelling error --- ui/app/components/network.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/app') diff --git a/ui/app/components/network.js b/ui/app/components/network.js index 2f1bf639a..6826e0685 100644 --- a/ui/app/components/network.js +++ b/ui/app/components/network.js @@ -61,7 +61,7 @@ Network.prototype.render = function () { style: { color: '#039396', }}, - 'Etherum Main Net'), + 'Ethereum Main Net'), ]) case 'morden-test-network': return h('.network-indicator', [ -- cgit From a8046296063e5d6cd60fa60ec46a4f15f0f2104f Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 29 Aug 2016 12:36:47 -0700 Subject: Show custom rpc menu item always --- ui/app/app.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'ui/app') diff --git a/ui/app/app.js b/ui/app/app.js index 70a6fcd64..b674efff1 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -249,6 +249,13 @@ App.prototype.renderNetworkDropdown = function () { activeNetworkRender: props.provider.rpcTarget, }), + h(DropMenuItem, { + label: 'Custom RPC', + closeMenu: () => this.setState({ isNetworkMenuOpen: false }), + action: () => this.props.dispatch(actions.showConfigPage()), + icon: h('i.fa.fa-question-circle.fa-lg', { ariaHidden: true }), + }), + this.renderCustomOption(props.provider.rpcTarget), ]) } @@ -501,12 +508,8 @@ App.prototype.toggleMetamaskActive = function () { App.prototype.renderCustomOption = function (rpcTarget) { switch (rpcTarget) { case undefined: - return h(DropMenuItem, { - label: 'Custom RPC', - closeMenu: () => this.setState({ isNetworkMenuOpen: false }), - action: () => this.props.dispatch(actions.showConfigPage()), - icon: h('i.fa.fa-question-circle.fa-lg', { ariaHidden: true }), - }) + return null + case 'http://localhost:8545': return h(DropMenuItem, { label: 'Custom RPC', -- cgit From 7f947f8ab2f22d57f5c7c84c30b942a721049a17 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 1 Sep 2016 11:29:17 -0700 Subject: Skip loading indication from send screen --- ui/app/send.js | 1 - 1 file changed, 1 deletion(-) (limited to 'ui/app') diff --git a/ui/app/send.js b/ui/app/send.js index 0cc3a032f..cf1b43b1d 100644 --- a/ui/app/send.js +++ b/ui/app/send.js @@ -236,7 +236,6 @@ SendTransactionScreen.prototype.onSubmit = function () { } this.props.dispatch(actions.hideWarning()) - this.props.dispatch(actions.showLoadingIndication()) var txParams = { from: this.props.address, -- cgit From 7b1bbb7a1976ce2efcf49e99c6dfb5bd96311a65 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 1 Sep 2016 11:30:42 -0700 Subject: Show conf screen after send request --- ui/app/actions.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'ui/app') diff --git a/ui/app/actions.js b/ui/app/actions.js index c92138f68..d49223e71 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -276,8 +276,6 @@ function signMsg (msgData) { function signTx (txData) { return (dispatch) => { - dispatch(actions.showLoadingIndication()) - web3.eth.sendTransaction(txData, (err, data) => { dispatch(actions.hideLoadingIndication()) @@ -285,6 +283,7 @@ function signTx (txData) { dispatch(actions.hideWarning()) dispatch(actions.goHome()) }) + dispatch(this.showConfTxPage()) } } -- cgit From b2ebb6032d3f99eb0e9eb90364a0cd95c7775bde Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Sat, 3 Sep 2016 14:20:27 -0700 Subject: Continuing fiat balance modularization --- ui/app/components/account-eth-balance.js | 81 ++++++-------------------------- ui/app/components/eth-balance.js | 18 ++++--- ui/app/components/fiat-value.js | 80 +++++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+), 73 deletions(-) create mode 100644 ui/app/components/fiat-value.js (limited to 'ui/app') diff --git a/ui/app/components/account-eth-balance.js b/ui/app/components/account-eth-balance.js index 8d693685f..1e4437405 100644 --- a/ui/app/components/account-eth-balance.js +++ b/ui/app/components/account-eth-balance.js @@ -1,20 +1,12 @@ const Component = require('react').Component const h = require('react-hyperscript') const inherits = require('util').inherits -const connect = require('react-redux').connect const formatBalance = require('../util').formatBalance const generateBalanceObject = require('../util').generateBalanceObject const Tooltip = require('./tooltip.js') +const FiatValue = require('./fiat-value') -module.exports = connect(mapStateToProps)(EthBalanceComponent) - -function mapStateToProps (state) { - return { - conversionRate: state.metamask.conversionRate, - conversionDate: state.metamask.conversionDate, - currentFiat: state.metamask.currentFiat, - } -} +module.exports = EthBalanceComponent inherits(EthBalanceComponent, Component) function EthBalanceComponent () { @@ -22,11 +14,10 @@ function EthBalanceComponent () { } EthBalanceComponent.prototype.render = function () { - var state = this.props - var style = state.style + var props = this.props + var style = props.style - const value = formatBalance(state.value, 6) - var width = state.width + var width = props.width return ( @@ -38,30 +29,23 @@ EthBalanceComponent.prototype.render = function () { display: 'inline', width: width, }, - }, this.renderBalance(value, state)), + }, this.renderBalance()), ]) - ) } -EthBalanceComponent.prototype.renderBalance = function (value, state) { + +EthBalanceComponent.prototype.renderBalance = function () { + const props = this.props + const value = formatBalance(props.value, 6) + if (value === 'None') return value - var balanceObj = generateBalanceObject(value, state.shorten ? 1 : 3) - var balance, fiatDisplayNumber, fiatTooltipNumber + var balanceObj = generateBalanceObject(value, props.shorten ? 1 : 3) + var balance var splitBalance = value.split(' ') var ethNumber = splitBalance[0] var ethSuffix = splitBalance[1] - - if (state.conversionRate !== 0) { - fiatTooltipNumber = Number(splitBalance[0]) * state.conversionRate - fiatDisplayNumber = fiatTooltipNumber.toFixed(2) - } else { - fiatDisplayNumber = 'N/A' - } - - var fiatSuffix = state.currentFiat - - if (state.shorten) { + if (props.shorten) { balance = balanceObj.shortBalance } else { balance = balanceObj.balance @@ -98,43 +82,8 @@ EthBalanceComponent.prototype.renderBalance = function (value, state) { }, label), ]), ]), - h(Tooltip, { - position: 'bottom', - title: `${fiatTooltipNumber} ${fiatSuffix}`, - }, [ - fiatDisplay(fiatDisplayNumber, fiatSuffix), - ]), + h(FiatValue, { value: props.value }), ]) ) } -function fiatDisplay (fiatDisplayNumber, fiatSuffix) { - if (fiatDisplayNumber !== 'N/A') { - return h('.flex-row', { - style: { - alignItems: 'flex-end', - lineHeight: '13px', - fontFamily: 'Montserrat Light', - textRendering: 'geometricPrecision', - }, - }, [ - h('div', { - style: { - width: '100%', - textAlign: 'right', - fontSize: '12px', - color: '#333333', - }, - }, fiatDisplayNumber), - h('div', { - style: { - color: '#AEAEAE', - marginLeft: '5px', - fontSize: '12px', - }, - }, fiatSuffix), - ]) - } else { - return h('div') - } -} diff --git a/ui/app/components/eth-balance.js b/ui/app/components/eth-balance.js index 498873faa..055cf6dd3 100644 --- a/ui/app/components/eth-balance.js +++ b/ui/app/components/eth-balance.js @@ -4,6 +4,7 @@ const inherits = require('util').inherits const formatBalance = require('../util').formatBalance const generateBalanceObject = require('../util').generateBalanceObject const Tooltip = require('./tooltip.js') +const FiatValue = require('./fiat-value.js') module.exports = EthBalanceComponent @@ -13,11 +14,12 @@ function EthBalanceComponent () { } EthBalanceComponent.prototype.render = function () { - var state = this.props - var style = state.style + var props = this.props + var style = props.style var needsParse = this.props.needsParse !== undefined ? this.props.needsParse : true - const value = formatBalance(state.value, 6, needsParse) - var width = state.width + const value = formatBalance(props.value, 6, needsParse) + var width = props.width + const showFiat = 'showFiat' in props ? props.showFiat : true return ( @@ -35,15 +37,15 @@ EthBalanceComponent.prototype.render = function () { ) } EthBalanceComponent.prototype.renderBalance = function (value) { - var state = this.props + var props = this.props if (value === 'None') return value - var balanceObj = generateBalanceObject(value, state.shorten ? 1 : 3) + var balanceObj = generateBalanceObject(value, props.shorten ? 1 : 3) var balance var splitBalance = value.split(' ') var ethNumber = splitBalance[0] var ethSuffix = splitBalance[1] - if (state.shorten) { + if (props.shorten) { balance = balanceObj.shortBalance } else { balance = balanceObj.balance @@ -77,6 +79,8 @@ EthBalanceComponent.prototype.renderBalance = function (value) { }, }, label), ]), + + fiatValue ? h(FiatValue, { value: props.value }) : null, ]) ) } diff --git a/ui/app/components/fiat-value.js b/ui/app/components/fiat-value.js new file mode 100644 index 000000000..0aa7d0bc5 --- /dev/null +++ b/ui/app/components/fiat-value.js @@ -0,0 +1,80 @@ +const Component = require('react').Component +const h = require('react-hyperscript') +const inherits = require('util').inherits +const connect = require('react-redux').connect +const formatBalance = require('../util').formatBalance +const generateBalanceObject = require('../util').generateBalanceObject +const Tooltip = require('./tooltip.js') + +module.exports = connect(mapStateToProps)(FiatValue) + +function mapStateToProps (state) { + return { + conversionRate: state.metamask.conversionRate, + currentFiat: state.metamask.currentFiat, + } +} + +inherits(FiatValue, Component) +function FiatValue () { + Component.call(this) +} + +FiatValue.prototype.render = function () { + const props = this.props + const value = formatBalance(props.value, 6) + + if (value === 'None') return value + var balanceObj = generateBalanceObject(value, props.shorten ? 1 : 3) + var fiatDisplayNumber, fiatTooltipNumber + var splitBalance = value.split(' ') + + if (props.conversionRate !== 0) { + fiatTooltipNumber = Number(splitBalance[0]) * props.conversionRate + fiatDisplayNumber = fiatTooltipNumber.toFixed(2) + } else { + fiatDisplayNumber = 'N/A' + } + + var fiatSuffix = props.currentFiat + + return ( + h(Tooltip, { + position: 'bottom', + title: `${fiatTooltipNumber} ${fiatSuffix}`, + }, [ + fiatDisplay(fiatDisplayNumber, fiatSuffix), + ]) + ) +} + +function fiatDisplay (fiatDisplayNumber, fiatSuffix) { + if (fiatDisplayNumber !== 'N/A') { + return h('.flex-row', { + style: { + alignItems: 'flex-end', + lineHeight: '13px', + fontFamily: 'Montserrat Light', + textRendering: 'geometricPrecision', + }, + }, [ + h('div', { + style: { + width: '100%', + textAlign: 'right', + fontSize: '12px', + color: '#333333', + }, + }, fiatDisplayNumber), + h('div', { + style: { + color: '#AEAEAE', + marginLeft: '5px', + fontSize: '12px', + }, + }, fiatSuffix), + ]) + } else { + return h('div') + } +} -- cgit From f213ca695c665450ba9a3fe7475c9ed6f3e98a14 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 6 Sep 2016 10:03:10 -0700 Subject: Fix typos and refine wording. --- ui/app/components/buy-button-subview.js | 2 +- ui/app/eth-store-warning.js | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/buy-button-subview.js b/ui/app/components/buy-button-subview.js index 742241e5b..c3e9e5d7b 100644 --- a/ui/app/components/buy-button-subview.js +++ b/ui/app/components/buy-button-subview.js @@ -106,7 +106,7 @@ BuyButtonSubview.prototype.formVersionSubview = function () { style: { width: '225px', }, - }, 'In order to access this feature please switch too the Main Network'), + }, 'In order to access this feature please switch to the Main Network'), h('h3.text-transform-uppercase', 'or:'), this.props.network === '2' ? h('button.text-transform-uppercase', { onClick: () => this.props.dispatch(actions.buyEth()), diff --git a/ui/app/eth-store-warning.js b/ui/app/eth-store-warning.js index 55274996b..fe3c7ce5d 100644 --- a/ui/app/eth-store-warning.js +++ b/ui/app/eth-store-warning.js @@ -35,10 +35,9 @@ EthStoreWarning.prototype.render = function () { margin: '10px 10px 10px 10px', }, }, - `The MetaMask team would like to - remind you that MetaMask is currently in beta - so - don't store large - amounts of ether in MetaMask. + `MetaMask is currently in beta; use + caution in storing large + amounts of ether. `), h('i.fa.fa-exclamation-triangle.fa-4', { -- cgit From f4e131da0a4fef1f3a0d8c193999011b8d83e99d Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 6 Sep 2016 11:04:54 -0700 Subject: Fix capitalization. --- ui/app/components/account-info-link.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/app') diff --git a/ui/app/components/account-info-link.js b/ui/app/components/account-info-link.js index 4fe3b8b5d..49c42e9ec 100644 --- a/ui/app/components/account-info-link.js +++ b/ui/app/components/account-info-link.js @@ -14,7 +14,7 @@ function AccountInfoLink () { AccountInfoLink.prototype.render = function () { const { selected, network } = this.props - const title = 'View account on etherscan' + const title = 'View account on Etherscan' const url = genAccountLink(selected, network) if (!url) { -- cgit From 09dd854a96c2756be02d5043be40089a097cadc1 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 6 Sep 2016 16:45:06 -0700 Subject: Nearly finished factoring fiat value into eth-balance --- ui/app/account-detail.js | 4 +- ui/app/accounts/account-list-item.js | 4 +- ui/app/app.js | 15 +++-- ui/app/components/account-eth-balance.js | 89 ------------------------------ ui/app/components/eth-balance.js | 4 +- ui/app/components/fiat-value.js | 3 +- ui/app/components/network.js | 1 - ui/app/components/tooltip.js | 7 ++- ui/app/components/transaction-list-item.js | 1 + 9 files changed, 19 insertions(+), 109 deletions(-) delete mode 100644 ui/app/components/account-eth-balance.js (limited to 'ui/app') diff --git a/ui/app/account-detail.js b/ui/app/account-detail.js index 486a1a633..cc956fed3 100644 --- a/ui/app/account-detail.js +++ b/ui/app/account-detail.js @@ -10,7 +10,7 @@ const ReactCSSTransitionGroup = require('react-addons-css-transition-group') const valuesFor = require('./util').valuesFor const Identicon = require('./components/identicon') -const AccountEtherBalance = require('./components/account-eth-balance') +const EthBalance = require('./components/eth-balance') const TransactionList = require('./components/transaction-list') const ExportAccountView = require('./components/account-export') const ethUtil = require('ethereumjs-util') @@ -168,7 +168,7 @@ AccountDetailScreen.prototype.render = function () { }, }, [ - h(AccountEtherBalance, { + h(EthBalance, { value: account && account.balance, style: { lineHeight: '7px', diff --git a/ui/app/accounts/account-list-item.js b/ui/app/accounts/account-list-item.js index aa80e0e23..0b4acdfec 100644 --- a/ui/app/accounts/account-list-item.js +++ b/ui/app/accounts/account-list-item.js @@ -3,7 +3,7 @@ const h = require('react-hyperscript') const inherits = require('util').inherits const ethUtil = require('ethereumjs-util') -const AccountEtherBalance = require('../components/account-eth-balance') +const EthBalance = require('../components/eth-balance') const CopyButton = require('../components/copyButton') const Identicon = require('../components/identicon') @@ -50,7 +50,7 @@ NewComponent.prototype.render = function () { textOverflow: 'ellipsis', }, }, ethUtil.toChecksumAddress(identity.address)), - h(AccountEtherBalance, { + h(EthBalance, { value: account.balance, style: { lineHeight: '7px', diff --git a/ui/app/app.js b/ui/app/app.js index b674efff1..2e05f0038 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -245,7 +245,7 @@ App.prototype.renderNetworkDropdown = function () { label: 'Localhost 8545', closeMenu: () => this.setState({ isNetworkMenuOpen: false }), action: () => props.dispatch(actions.setRpcTarget('http://localhost:8545')), - icon: h('i.fa.fa-question-circle.fa-lg', { ariaHidden: true }), + icon: h('i.fa.fa-question-circle.fa-lg'), activeNetworkRender: props.provider.rpcTarget, }), @@ -253,7 +253,7 @@ App.prototype.renderNetworkDropdown = function () { label: 'Custom RPC', closeMenu: () => this.setState({ isNetworkMenuOpen: false }), action: () => this.props.dispatch(actions.showConfigPage()), - icon: h('i.fa.fa-question-circle.fa-lg', { ariaHidden: true }), + icon: h('i.fa.fa-question-circle.fa-lg'), }), this.renderCustomOption(props.provider.rpcTarget), @@ -289,21 +289,21 @@ App.prototype.renderDropdown = function () { label: 'Settings', closeMenu: () => this.setState({ isMainMenuOpen: !isOpen }), action: () => this.props.dispatch(actions.showConfigPage()), - icon: h('i.fa.fa-gear.fa-lg', { ariaHidden: true }), + icon: h('i.fa.fa-gear.fa-lg'), }), h(DropMenuItem, { label: 'Lock', closeMenu: () => this.setState({ isMainMenuOpen: !isOpen }), action: () => this.props.dispatch(actions.lockMetamask()), - icon: h('i.fa.fa-lock.fa-lg', { ariaHidden: true }), + icon: h('i.fa.fa-lock.fa-lg'), }), h(DropMenuItem, { label: 'Help', closeMenu: () => this.setState({ isMainMenuOpen: !isOpen }), action: () => this.props.dispatch(actions.showInfoPage()), - icon: h('i.fa.fa-question.fa-lg', { ariaHidden: true }), + icon: h('i.fa.fa-question.fa-lg'), }), ]) } @@ -312,7 +312,6 @@ App.prototype.renderBackButton = function (style, justArrow = false) { return ( h('.flex-row', { key: 'leftArrow', - transForward: false, style: style, onClick: () => props.dispatch(actions.goBackToInitView()), }, [ @@ -515,14 +514,14 @@ App.prototype.renderCustomOption = function (rpcTarget) { label: 'Custom RPC', closeMenu: () => this.setState({ isNetworkMenuOpen: false }), action: () => this.props.dispatch(actions.showConfigPage()), - icon: h('i.fa.fa-question-circle.fa-lg', { ariaHidden: true }), + icon: h('i.fa.fa-question-circle.fa-lg'), }) default: return h(DropMenuItem, { label: `${rpcTarget}`, closeMenu: () => this.setState({ isNetworkMenuOpen: false }), - icon: h('i.fa.fa-question-circle.fa-lg', { ariaHidden: true }), + icon: h('i.fa.fa-question-circle.fa-lg'), activeNetworkRender: 'custom', }) } diff --git a/ui/app/components/account-eth-balance.js b/ui/app/components/account-eth-balance.js deleted file mode 100644 index 1e4437405..000000000 --- a/ui/app/components/account-eth-balance.js +++ /dev/null @@ -1,89 +0,0 @@ -const Component = require('react').Component -const h = require('react-hyperscript') -const inherits = require('util').inherits -const formatBalance = require('../util').formatBalance -const generateBalanceObject = require('../util').generateBalanceObject -const Tooltip = require('./tooltip.js') -const FiatValue = require('./fiat-value') - -module.exports = EthBalanceComponent - -inherits(EthBalanceComponent, Component) -function EthBalanceComponent () { - Component.call(this) -} - -EthBalanceComponent.prototype.render = function () { - var props = this.props - var style = props.style - - var width = props.width - - return ( - - h('.ether-balance', { - style: style, - }, [ - h('.ether-balance-amount', { - style: { - display: 'inline', - width: width, - }, - }, this.renderBalance()), - ]) - ) -} - -EthBalanceComponent.prototype.renderBalance = function () { - const props = this.props - const value = formatBalance(props.value, 6) - - if (value === 'None') return value - var balanceObj = generateBalanceObject(value, props.shorten ? 1 : 3) - var balance - var splitBalance = value.split(' ') - var ethNumber = splitBalance[0] - var ethSuffix = splitBalance[1] - - if (props.shorten) { - balance = balanceObj.shortBalance - } else { - balance = balanceObj.balance - } - - var label = balanceObj.label - - return ( - h('.flex-column', [ - h(Tooltip, { - position: 'bottom', - title: `${ethNumber} ${ethSuffix}`, - }, [ - h('.flex-row', { - style: { - alignItems: 'flex-end', - lineHeight: '13px', - fontFamily: 'Montserrat Light', - textRendering: 'geometricPrecision', - marginBottom: '5px', - }, - }, [ - h('div', { - style: { - width: '100%', - textAlign: 'right', - }, - }, balance), - h('div', { - style: { - color: '#AEAEAE', - marginLeft: '5px', - }, - }, label), - ]), - ]), - h(FiatValue, { value: props.value }), - ]) - ) -} - diff --git a/ui/app/components/eth-balance.js b/ui/app/components/eth-balance.js index 055cf6dd3..c77bda626 100644 --- a/ui/app/components/eth-balance.js +++ b/ui/app/components/eth-balance.js @@ -19,7 +19,6 @@ EthBalanceComponent.prototype.render = function () { var needsParse = this.props.needsParse !== undefined ? this.props.needsParse : true const value = formatBalance(props.value, 6, needsParse) var width = props.width - const showFiat = 'showFiat' in props ? props.showFiat : true return ( @@ -44,6 +43,7 @@ EthBalanceComponent.prototype.renderBalance = function (value) { var splitBalance = value.split(' ') var ethNumber = splitBalance[0] var ethSuffix = splitBalance[1] + const showFiat = 'showFiat' in props ? props.showFiat : true if (props.shorten) { balance = balanceObj.shortBalance @@ -80,7 +80,7 @@ EthBalanceComponent.prototype.renderBalance = function (value) { }, label), ]), - fiatValue ? h(FiatValue, { value: props.value }) : null, + showFiat ? h(FiatValue, { value: props.value }) : null, ]) ) } diff --git a/ui/app/components/fiat-value.js b/ui/app/components/fiat-value.js index 0aa7d0bc5..7322e43e8 100644 --- a/ui/app/components/fiat-value.js +++ b/ui/app/components/fiat-value.js @@ -4,7 +4,7 @@ const inherits = require('util').inherits const connect = require('react-redux').connect const formatBalance = require('../util').formatBalance const generateBalanceObject = require('../util').generateBalanceObject -const Tooltip = require('./tooltip.js') +const Tooltip = require('./tooltip') module.exports = connect(mapStateToProps)(FiatValue) @@ -25,7 +25,6 @@ FiatValue.prototype.render = function () { const value = formatBalance(props.value, 6) if (value === 'None') return value - var balanceObj = generateBalanceObject(value, props.shorten ? 1 : 3) var fiatDisplayNumber, fiatTooltipNumber var splitBalance = value.split(' ') diff --git a/ui/app/components/network.js b/ui/app/components/network.js index 6826e0685..845861396 100644 --- a/ui/app/components/network.js +++ b/ui/app/components/network.js @@ -75,7 +75,6 @@ Network.prototype.render = function () { default: return h('.network-indicator', [ h('i.fa.fa-question-circle.fa-lg', { - ariaHidden: true, style: { margin: '10px', color: 'rgb(125, 128, 130)', diff --git a/ui/app/components/tooltip.js b/ui/app/components/tooltip.js index fb67c717e..440393b08 100644 --- a/ui/app/components/tooltip.js +++ b/ui/app/components/tooltip.js @@ -12,11 +12,12 @@ function Tooltip () { Tooltip.prototype.render = function () { const props = this.props + const { position, title, children } = props return h(ReactTooltip, { - position: props.position ? props.position : 'left', - title: props.title, + position: position || 'left', + title, fixed: false, - }, props.children) + }, children) } diff --git a/ui/app/components/transaction-list-item.js b/ui/app/components/transaction-list-item.js index 1b85464e1..66a232981 100644 --- a/ui/app/components/transaction-list-item.js +++ b/ui/app/components/transaction-list-item.js @@ -77,6 +77,7 @@ TransactionListItem.prototype.render = function () { value: txParams.value, width: '55px', shorten: true, + showFiat: false, style: {fontSize: '15px'}, }) : h('.flex-column'), ]) -- cgit From 90638f95c079bf1fbfccb9cdb9eea6bb0823e1bd Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 6 Sep 2016 16:55:52 -0700 Subject: Fix fiat-value --- ui/app/components/fiat-value.js | 1 - 1 file changed, 1 deletion(-) (limited to 'ui/app') diff --git a/ui/app/components/fiat-value.js b/ui/app/components/fiat-value.js index 7322e43e8..57c67e117 100644 --- a/ui/app/components/fiat-value.js +++ b/ui/app/components/fiat-value.js @@ -3,7 +3,6 @@ const h = require('react-hyperscript') const inherits = require('util').inherits const connect = require('react-redux').connect const formatBalance = require('../util').formatBalance -const generateBalanceObject = require('../util').generateBalanceObject const Tooltip = require('./tooltip') module.exports = connect(mapStateToProps)(FiatValue) -- cgit From c46de79c10ba36c67176e4e02bd2b4adcb0e268f Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 6 Sep 2016 17:08:56 -0700 Subject: Got basic fiat display modularized --- ui/app/components/eth-balance.js | 46 +++++++++++++++++++++------------------- ui/app/components/fiat-value.js | 1 + ui/app/components/tooltip.js | 1 + 3 files changed, 26 insertions(+), 22 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/eth-balance.js b/ui/app/components/eth-balance.js index c77bda626..b9caf65b9 100644 --- a/ui/app/components/eth-balance.js +++ b/ui/app/components/eth-balance.js @@ -57,30 +57,32 @@ EthBalanceComponent.prototype.renderBalance = function (value) { h(Tooltip, { position: 'bottom', title: `${ethNumber} ${ethSuffix}`, - }, [ - h('.flex-column', { - style: { - alignItems: 'flex-end', - lineHeight: '13px', - fontFamily: 'Montserrat Light', - textRendering: 'geometricPrecision', - }, - }, [ - h('div', { + }, h('div.flex-column', [ + h('.flex-row', { style: { - width: '100%', - textAlign: 'right', + alignItems: 'flex-end', + lineHeight: '13px', + fontFamily: 'Montserrat Light', + textRendering: 'geometricPrecision', }, - }, this.props.incoming ? `+${balance}` : balance), - h('div', { - style: { - color: ' #AEAEAE', - fontSize: '12px', - }, - }, label), - ]), + }, [ + h('div', { + style: { + width: '100%', + textAlign: 'right', + }, + }, this.props.incoming ? `+${balance}` : balance), + h('div', { + style: { + color: ' #AEAEAE', + fontSize: '12px', + marginLeft: '5px', + }, + }, label), + ]), - showFiat ? h(FiatValue, { value: props.value }) : null, - ]) + showFiat ? h(FiatValue, { value: props.value }) : null, + ]) + ) ) } diff --git a/ui/app/components/fiat-value.js b/ui/app/components/fiat-value.js index 57c67e117..406dcf23f 100644 --- a/ui/app/components/fiat-value.js +++ b/ui/app/components/fiat-value.js @@ -32,6 +32,7 @@ FiatValue.prototype.render = function () { fiatDisplayNumber = fiatTooltipNumber.toFixed(2) } else { fiatDisplayNumber = 'N/A' + fiatTooltipNumber = 'Unknown' } var fiatSuffix = props.currentFiat diff --git a/ui/app/components/tooltip.js b/ui/app/components/tooltip.js index 440393b08..757ad0cd6 100644 --- a/ui/app/components/tooltip.js +++ b/ui/app/components/tooltip.js @@ -11,6 +11,7 @@ function Tooltip () { } Tooltip.prototype.render = function () { + const props = this.props const { position, title, children } = props -- cgit From 1537e3f5da8d0ad5a48ded40301445c6468521f7 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 6 Sep 2016 17:28:25 -0700 Subject: Add fiat balances to tx conf view --- ui/app/components/pending-tx-details.js | 11 +++++------ ui/app/send.js | 5 ++--- 2 files changed, 7 insertions(+), 9 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/pending-tx-details.js b/ui/app/components/pending-tx-details.js index 2fb0eae3f..c2e39a1ca 100644 --- a/ui/app/components/pending-tx-details.js +++ b/ui/app/components/pending-tx-details.js @@ -4,9 +4,8 @@ const inherits = require('util').inherits const carratInline = require('fs').readFileSync('./images/forward-carrat.svg', 'utf8') const MiniAccountPanel = require('./mini-account-panel') -const EtherBalance = require('./eth-balance') +const EthBalance = require('./eth-balance') const addressSummary = require('../util').addressSummary -const formatBalance = require('../util').formatBalance const nameForAddress = require('../../lib/contract-namer') const ethUtil = require('ethereumjs-util') const BN = ethUtil.BN @@ -70,7 +69,7 @@ PTXP.render = function () { fontFamily: 'Montserrat Light, Montserrat, sans-serif', }, }, [ - h(EtherBalance, { + h(EthBalance, { value: balance, inline: true, labelColor: '#F7861C', @@ -107,12 +106,12 @@ PTXP.render = function () { h('.row', [ h('.cell.label', 'Amount'), - h('.cell.value', formatBalance(txParams.value)), + h(EthBalance, { value: txParams.value }), ]), h('.cell.row', [ h('.cell.label', 'Max Transaction Fee'), - h('.cell.value', formatBalance(txFee.toString(16))), + h(EthBalance, { value: txFee.toString(16) }), ]), h('.cell.row', { @@ -129,7 +128,7 @@ PTXP.render = function () { alignItems: 'center', }, }, [ - h(EtherBalance, { + h(EthBalance, { value: maxCost.toString(16), inline: true, labelColor: 'black', diff --git a/ui/app/send.js b/ui/app/send.js index cf1b43b1d..009866cf7 100644 --- a/ui/app/send.js +++ b/ui/app/send.js @@ -7,7 +7,7 @@ const actions = require('./actions') const util = require('./util') const numericBalance = require('./util').numericBalance const addressSummary = require('./util').addressSummary -const EtherBalance = require('./components/eth-balance') +const EthBalance = require('./components/eth-balance') const ethUtil = require('ethereumjs-util') module.exports = connect(mapStateToProps)(SendTransactionScreen) @@ -107,8 +107,7 @@ SendTransactionScreen.prototype.render = function () { // balance h('.flex-row.flex-center', [ - // h('div', formatBalance(account && account.balance)), - h(EtherBalance, { + h(EthBalance, { value: account && account.balance, }), -- cgit From 0186e05a0da718169c58e33b40760bdcf869b1c8 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 6 Sep 2016 17:30:38 -0700 Subject: Linted --- ui/app/components/eth-balance.js | 45 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 23 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/eth-balance.js b/ui/app/components/eth-balance.js index b9caf65b9..46127bed5 100644 --- a/ui/app/components/eth-balance.js +++ b/ui/app/components/eth-balance.js @@ -58,31 +58,30 @@ EthBalanceComponent.prototype.renderBalance = function (value) { position: 'bottom', title: `${ethNumber} ${ethSuffix}`, }, h('div.flex-column', [ - h('.flex-row', { + h('.flex-row', { + style: { + alignItems: 'flex-end', + lineHeight: '13px', + fontFamily: 'Montserrat Light', + textRendering: 'geometricPrecision', + }, + }, [ + h('div', { + style: { + width: '100%', + textAlign: 'right', + }, + }, this.props.incoming ? `+${balance}` : balance), + h('div', { style: { - alignItems: 'flex-end', - lineHeight: '13px', - fontFamily: 'Montserrat Light', - textRendering: 'geometricPrecision', + color: ' #AEAEAE', + fontSize: '12px', + marginLeft: '5px', }, - }, [ - h('div', { - style: { - width: '100%', - textAlign: 'right', - }, - }, this.props.incoming ? `+${balance}` : balance), - h('div', { - style: { - color: ' #AEAEAE', - fontSize: '12px', - marginLeft: '5px', - }, - }, label), - ]), + }, label), + ]), - showFiat ? h(FiatValue, { value: props.value }) : null, - ]) - ) + showFiat ? h(FiatValue, { value: props.value }) : null, + ])) ) } -- cgit From d6619a25e90f206eef6dad46b09406b529f84b80 Mon Sep 17 00:00:00 2001 From: John Weldon Date: Wed, 7 Sep 2016 14:44:56 -0700 Subject: Fix typo --- ui/app/info.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/app') diff --git a/ui/app/info.js b/ui/app/info.js index 4e540bd03..5c06409bd 100644 --- a/ui/app/info.js +++ b/ui/app/info.js @@ -67,7 +67,7 @@ InfoScreen.prototype.render = function () { `For more information on MetaMask you can visit our web site. If you want to contact us with questions or just - say 'Hi', you can find us on theise platforms:`), + say 'Hi', you can find us on these platforms:`), h('div', { style: { -- cgit From 5f8d3085d7603135849eb22ad22c70733c236c2d Mon Sep 17 00:00:00 2001 From: Frankie Date: Wed, 7 Sep 2016 20:56:51 -0700 Subject: Filter out pending txs based on network from tx history --- ui/app/account-detail.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/app') diff --git a/ui/app/account-detail.js b/ui/app/account-detail.js index 486a1a633..5ce6b6703 100644 --- a/ui/app/account-detail.js +++ b/ui/app/account-detail.js @@ -235,7 +235,7 @@ AccountDetailScreen.prototype.subview = function () { AccountDetailScreen.prototype.transactionList = function () { const { transactions, unconfTxs, unconfMsgs, address, network, shapeShiftTxList } = this.props - var txsToRender = transactions + var txsToRender = transactions.concat(unconfTxs) // only transactions that are from the current address .filter(tx => tx.txParams.from === address) // only transactions that are on the current network -- cgit From c3dbcb5b02a54bd3772fb768c1b28f2c94a74e58 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 8 Sep 2016 10:57:10 -0700 Subject: Fix double tooltip --- ui/app/components/fiat-value.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/fiat-value.js b/ui/app/components/fiat-value.js index 406dcf23f..a5c36e5cb 100644 --- a/ui/app/components/fiat-value.js +++ b/ui/app/components/fiat-value.js @@ -3,7 +3,6 @@ const h = require('react-hyperscript') const inherits = require('util').inherits const connect = require('react-redux').connect const formatBalance = require('../util').formatBalance -const Tooltip = require('./tooltip') module.exports = connect(mapStateToProps)(FiatValue) @@ -28,7 +27,6 @@ FiatValue.prototype.render = function () { var splitBalance = value.split(' ') if (props.conversionRate !== 0) { - fiatTooltipNumber = Number(splitBalance[0]) * props.conversionRate fiatDisplayNumber = fiatTooltipNumber.toFixed(2) } else { fiatDisplayNumber = 'N/A' @@ -37,14 +35,7 @@ FiatValue.prototype.render = function () { var fiatSuffix = props.currentFiat - return ( - h(Tooltip, { - position: 'bottom', - title: `${fiatTooltipNumber} ${fiatSuffix}`, - }, [ - fiatDisplay(fiatDisplayNumber, fiatSuffix), - ]) - ) + return fiatDisplay(fiatDisplayNumber, fiatSuffix) } function fiatDisplay (fiatDisplayNumber, fiatSuffix) { -- cgit From ab3b409438d4816e5154a3d6c71218a9963e3b5a Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 8 Sep 2016 11:03:47 -0700 Subject: Restore broken variable reference --- ui/app/components/fiat-value.js | 1 + 1 file changed, 1 insertion(+) (limited to 'ui/app') diff --git a/ui/app/components/fiat-value.js b/ui/app/components/fiat-value.js index a5c36e5cb..13ee48245 100644 --- a/ui/app/components/fiat-value.js +++ b/ui/app/components/fiat-value.js @@ -27,6 +27,7 @@ FiatValue.prototype.render = function () { var splitBalance = value.split(' ') if (props.conversionRate !== 0) { + fiatTooltipNumber = Number(splitBalance[0]) * props.conversionRate fiatDisplayNumber = fiatTooltipNumber.toFixed(2) } else { fiatDisplayNumber = 'N/A' -- cgit From 20ae4c2689ed82016a71e74b36565eaed78f3f4c Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 8 Sep 2016 11:20:55 -0700 Subject: Fix logo usage for metamask-logo v2.0.0 - No longer need to check for webGL compliance (svg rendered!) - logo.canvas has been replaced with logo.container, since svg doesn't render to canvas but to an element. Otherwise, worked with very little effort!! Fixes #624 --- ui/app/components/mascot.js | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/mascot.js b/ui/app/components/mascot.js index f2b00262b..d0d599ea0 100644 --- a/ui/app/components/mascot.js +++ b/ui/app/components/mascot.js @@ -14,7 +14,6 @@ function Mascot () { pxNotRatio: true, width: 200, height: 200, - staticImage: './images/icon-512.png', }) if (!this.logo.webGLSupport) return this.refollowMouse = debounce(this.logo.setFollowMouse.bind(this.logo, true), 1000) @@ -27,28 +26,18 @@ Mascot.prototype.render = function () { // and we dont get that until render this.handleAnimationEvents() - return ( - - h('#metamask-mascot-container') - - ) + return h('#metamask-mascot-container') } Mascot.prototype.componentDidMount = function () { var targetDivId = 'metamask-mascot-container' var container = document.getElementById(targetDivId) - if (!this.logo.webGLSupport) { - var staticLogo = this.logo.staticLogo - staticLogo.style.marginBottom = '40px' - container.appendChild(staticLogo) - } else { - container.appendChild(this.logo.canvas) - } + container.appendChild(this.logo.container) } Mascot.prototype.componentWillUnmount = function () { if (!this.logo.webGLSupport) return - this.logo.canvas.remove() + this.logo.container.remove() } Mascot.prototype.handleAnimationEvents = function () { -- cgit From 6f86c5f8ee6779eddfde1fbc32e356bbc80708f3 Mon Sep 17 00:00:00 2001 From: Frankie Date: Thu, 8 Sep 2016 12:56:04 -0700 Subject: Add network checks for unconfirmed Txs --- ui/app/accounts/index.js | 1 + ui/app/conf-tx.js | 4 +++- ui/app/reducers/app.js | 19 ++++++++++++++++--- 3 files changed, 20 insertions(+), 4 deletions(-) (limited to 'ui/app') diff --git a/ui/app/accounts/index.js b/ui/app/accounts/index.js index 6e12accc7..c20900c1e 100644 --- a/ui/app/accounts/index.js +++ b/ui/app/accounts/index.js @@ -11,6 +11,7 @@ module.exports = connect(mapStateToProps)(AccountsScreen) function mapStateToProps (state) { const pendingTxs = valuesFor(state.metamask.unconfTxs) + .filter(tx => tx.txParams.metamaskNetworkId === state.metamask.network) const pendingMsgs = valuesFor(state.metamask.unconfMsgs) const pending = pendingTxs.concat(pendingMsgs) diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js index 22d29383f..99b4bc9f1 100644 --- a/ui/app/conf-tx.js +++ b/ui/app/conf-tx.js @@ -21,6 +21,7 @@ function mapStateToProps (state) { unconfMsgs: state.metamask.unconfMsgs, index: state.appState.currentView.context, warning: state.appState.warning, + network: state.metamask.network, } } @@ -32,9 +33,10 @@ function ConfirmTxScreen () { ConfirmTxScreen.prototype.render = function () { var state = this.props + var network = state.network var unconfTxs = state.unconfTxs var unconfMsgs = state.unconfMsgs - var unconfTxList = txHelper(unconfTxs, unconfMsgs) + var unconfTxList = txHelper(unconfTxs, unconfMsgs, network) var index = state.index !== undefined ? state.index : 0 var txData = unconfTxList[index] || unconfTxList[0] || {} var isNotification = isPopupOrNotification() === 'notification' diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index bad11113a..29d5d9378 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -7,6 +7,7 @@ module.exports = reduceApp function reduceApp (state, action) { // clone and defaults + console.log(action.type) const selectedAccount = state.metamask.selectedAccount const pendingTxs = hasPendingTxs(state) let name = 'accounts' @@ -15,6 +16,15 @@ function reduceApp (state, action) { } if (pendingTxs) { name = 'confTx' + } else { + try { + if (state.appState.currentView.name === 'confTx') { + name = 'accountDetail' + } + } catch (e) { + null + } + } var defaultView = { @@ -258,8 +268,9 @@ function reduceApp (state, action) { case actions.COMPLETED_TX: var unconfTxs = state.metamask.unconfTxs var unconfMsgs = state.metamask.unconfMsgs + var network = state.metamask.network - var unconfTxList = txHelper(unconfTxs, unconfMsgs) + var unconfTxList = txHelper(unconfTxs, unconfMsgs, network) .filter(tx => tx !== tx.id) if (unconfTxList && unconfTxList.length > 0) { @@ -523,14 +534,16 @@ function reduceApp (state, action) { function hasPendingTxs (state) { var unconfTxs = state.metamask.unconfTxs var unconfMsgs = state.metamask.unconfMsgs - var unconfTxList = txHelper(unconfTxs, unconfMsgs) + var network = state.metamask.network + var unconfTxList = txHelper(unconfTxs, unconfMsgs, network) return unconfTxList.length > 0 } function indexForPending (state, txId) { var unconfTxs = state.metamask.unconfTxs var unconfMsgs = state.metamask.unconfMsgs - var unconfTxList = txHelper(unconfTxs, unconfMsgs) + var network = state.metamask.network + var unconfTxList = txHelper(unconfTxs, unconfMsgs, network) let idx unconfTxList.forEach((tx, i) => { if (tx.id === txId) { -- cgit From 7d8491de106c798727f5f57b08453f2133d144e7 Mon Sep 17 00:00:00 2001 From: Frankie Date: Thu, 8 Sep 2016 13:13:43 -0700 Subject: Add to CHANGELOG.md and Remove unnecessary catch --- ui/app/reducers/app.js | 9 --------- 1 file changed, 9 deletions(-) (limited to 'ui/app') diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index 29d5d9378..9243e53e0 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -16,15 +16,6 @@ function reduceApp (state, action) { } if (pendingTxs) { name = 'confTx' - } else { - try { - if (state.appState.currentView.name === 'confTx') { - name = 'accountDetail' - } - } catch (e) { - null - } - } var defaultView = { -- cgit From 0d4bfe8038d2fe3617b769cf653152c6d5c47335 Mon Sep 17 00:00:00 2001 From: Frankie Date: Thu, 8 Sep 2016 13:44:32 -0700 Subject: Remove console.log --- ui/app/reducers/app.js | 1 - 1 file changed, 1 deletion(-) (limited to 'ui/app') diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index 9243e53e0..a6cd9ca1b 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -7,7 +7,6 @@ module.exports = reduceApp function reduceApp (state, action) { // clone and defaults - console.log(action.type) const selectedAccount = state.metamask.selectedAccount const pendingTxs = hasPendingTxs(state) let name = 'accounts' -- cgit From 6c05c221cd8e8bef2ce4efc5ae03ee7a39e3e0bf Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 8 Sep 2016 15:38:47 -0700 Subject: Fix new logo related errors Fixed logo deallocation related bugs, had to patch the logo repo itself to add a stopAnimating method. Also tuned up the logo to more closely resemble the old behavior. - Overlaps the title text - Points nose at cursor, not just front of eyes - Cursor is more "distant" from fox, to avoid extreme angles on edges. --- ui/app/components/mascot.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/mascot.js b/ui/app/components/mascot.js index d0d599ea0..ae998406b 100644 --- a/ui/app/components/mascot.js +++ b/ui/app/components/mascot.js @@ -26,7 +26,9 @@ Mascot.prototype.render = function () { // and we dont get that until render this.handleAnimationEvents() - return h('#metamask-mascot-container') + return h('#metamask-mascot-container', { + style: { zIndex: 2 }, + }) } Mascot.prototype.componentDidMount = function () { @@ -36,12 +38,13 @@ Mascot.prototype.componentDidMount = function () { } Mascot.prototype.componentWillUnmount = function () { - if (!this.logo.webGLSupport) return + this.animations = this.props.animationEventEmitter + this.animations.removeAllListeners() this.logo.container.remove() + this.logo.stopAnimation() } Mascot.prototype.handleAnimationEvents = function () { - if (!this.logo.webGLSupport) return // only setup listeners once if (this.animations) return this.animations = this.props.animationEventEmitter -- cgit From 7b6c018c3978f11d05fe3854a1f4072d3446b4b2 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 8 Sep 2016 19:53:54 -0700 Subject: Show loading indication during unlocking. --- ui/app/actions.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ui/app') diff --git a/ui/app/actions.js b/ui/app/actions.js index d49223e71..57c2bf3e8 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -162,8 +162,10 @@ function goHome () { function tryUnlockMetamask (password) { return (dispatch) => { + dispatch(actions.showLoadingIndication()) dispatch(actions.unlockInProgress()) _accountManager.submitPassword(password, (err, selectedAccount) => { + dispatch(actions.hideLoadingIndication()) if (err) { dispatch(actions.unlockFailed()) } else { -- cgit From a4e4c854534a73caeb857cffb321b3b8f98f395a Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 8 Sep 2016 20:31:42 -0700 Subject: Fix fox logo password following The new lightweight svg logo was not following text quite right. The new `lookAt` method was not using the same logic the module was using internally on mouse movement. I simply used that logic and exposed it via the old (expected) API, and got it behaving the way I like. --- ui/app/components/mascot.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/mascot.js b/ui/app/components/mascot.js index ae998406b..f015d0c4d 100644 --- a/ui/app/components/mascot.js +++ b/ui/app/components/mascot.js @@ -15,7 +15,7 @@ function Mascot () { width: 200, height: 200, }) - if (!this.logo.webGLSupport) return + this.refollowMouse = debounce(this.logo.setFollowMouse.bind(this.logo, true), 1000) this.unfollowMouse = this.logo.setFollowMouse.bind(this.logo, false) } @@ -53,7 +53,6 @@ Mascot.prototype.handleAnimationEvents = function () { } Mascot.prototype.lookAt = function (target) { - if (!this.logo.webGLSupport) return this.unfollowMouse() this.logo.lookAt(target) this.refollowMouse() -- cgit From 6d6130e2a6d79a29d67995cbf4fa22ea4870ef69 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Sat, 10 Sep 2016 11:23:11 -0700 Subject: Camelcase dataset key for react --- ui/app/components/shapeshift-form.js | 4 ++-- ui/app/first-time/restore-vault.js | 6 +++--- ui/app/send.js | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/shapeshift-form.js b/ui/app/components/shapeshift-form.js index 58b7942c3..77c0d12b1 100644 --- a/ui/app/components/shapeshift-form.js +++ b/ui/app/components/shapeshift-form.js @@ -69,7 +69,7 @@ ShapeshiftForm.prototype.renderMain = function () { h('input#fromCoin.buy-inputs.ex-coins', { type: 'text', list: 'coinList', - dataset: { + dataSet: { persistentFormId: 'input-coin', }, style: { @@ -165,7 +165,7 @@ ShapeshiftForm.prototype.renderMain = function () { h('input#fromCoinAddress.buy-inputs', { type: 'text', placeholder: `Your ${coin} Refund Address`, - dataset: { + dataSet: { persistentFormId: 'refund-address', }, style: { diff --git a/ui/app/first-time/restore-vault.js b/ui/app/first-time/restore-vault.js index 4c1f21008..c34cd7e66 100644 --- a/ui/app/first-time/restore-vault.js +++ b/ui/app/first-time/restore-vault.js @@ -41,7 +41,7 @@ RestoreVaultScreen.prototype.render = function () { // wallet seed entry h('h3', 'Wallet Seed'), h('textarea.twelve-word-phrase.letter-spacey', { - dataset: { + dataSet: { persistentFormId: 'wallet-seed', }, placeholder: 'Enter your secret twelve word phrase here to restore your vault.', @@ -52,7 +52,7 @@ RestoreVaultScreen.prototype.render = function () { type: 'password', id: 'password-box', placeholder: 'New Password (min 8 chars)', - dataset: { + dataSet: { persistentFormId: 'password', }, style: { @@ -67,7 +67,7 @@ RestoreVaultScreen.prototype.render = function () { id: 'password-box-confirm', placeholder: 'Confirm Password', onKeyPress: this.onMaybeCreate.bind(this), - dataset: { + dataSet: { persistentFormId: 'password-confirmation', }, style: { diff --git a/ui/app/send.js b/ui/app/send.js index 009866cf7..e660e90a8 100644 --- a/ui/app/send.js +++ b/ui/app/send.js @@ -138,7 +138,7 @@ SendTransactionScreen.prototype.render = function () { h('input.large-input', { name: 'address', placeholder: 'Recipient Address', - dataset: { + dataSet: { persistentFormId: 'recipient-address', }, }), @@ -154,7 +154,7 @@ SendTransactionScreen.prototype.render = function () { style: { marginRight: 6, }, - dataset: { + dataSet: { persistentFormId: 'tx-amount', }, }), @@ -192,7 +192,7 @@ SendTransactionScreen.prototype.render = function () { width: '100%', resize: 'none', }, - dataset: { + dataSet: { persistentFormId: 'tx-data', }, }), -- cgit From c2105c4070c63c7ad6fbdc4c5be8f3f182a16b52 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 12 Sep 2016 08:29:18 -0700 Subject: Fix account list formatting when only a single item. - Makes account list items no longer flex larger than they should be. - Makes the add account button not flex larger than it should be. - Adds a line under the add account button to define its size. --- ui/app/accounts/account-list-item.js | 13 +++++-------- ui/app/accounts/index.js | 4 ++-- 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'ui/app') diff --git a/ui/app/accounts/account-list-item.js b/ui/app/accounts/account-list-item.js index 0b4acdfec..4e0d69ed7 100644 --- a/ui/app/accounts/account-list-item.js +++ b/ui/app/accounts/account-list-item.js @@ -7,14 +7,14 @@ const EthBalance = require('../components/eth-balance') const CopyButton = require('../components/copyButton') const Identicon = require('../components/identicon') -module.exports = NewComponent +module.exports = AccountListItem -inherits(NewComponent, Component) -function NewComponent () { +inherits(AccountListItem, Component) +function AccountListItem () { Component.call(this) } -NewComponent.prototype.render = function () { +AccountListItem.prototype.render = function () { const identity = this.props.identity var isSelected = this.props.selectedAddress === identity.address var account = this.props.accounts[identity.address] @@ -23,9 +23,6 @@ NewComponent.prototype.render = function () { return ( h(`.accounts-list-option.flex-row.flex-space-between.pointer.hover-white${selectedClass}`, { key: `account-panel-${identity.address}`, - style: { - flex: '1 0 auto', - }, onClick: (event) => this.props.onShowDetail(identity.address, event), }, [ @@ -73,7 +70,7 @@ NewComponent.prototype.render = function () { ) } -NewComponent.prototype.pendingOrNot = function () { +AccountListItem.prototype.pendingOrNot = function () { const pending = this.props.pending if (pending.length === 0) return null return h('.pending-dot', pending.length) diff --git a/ui/app/accounts/index.js b/ui/app/accounts/index.js index c20900c1e..d3c84d387 100644 --- a/ui/app/accounts/index.js +++ b/ui/app/accounts/index.js @@ -84,7 +84,7 @@ AccountsScreen.prototype.render = function () { }) }), - h('hr.horizontal-line', {key: 'horizontal-line1'}), + h('hr.horizontal-line'), h('div.footer.hover-white.pointer', { key: 'reveal-account-bar', onClick: () => { @@ -92,7 +92,6 @@ AccountsScreen.prototype.render = function () { }, style: { display: 'flex', - flex: '1 0 auto', height: '40px', paddint: '10px', justifyContent: 'center', @@ -101,6 +100,7 @@ AccountsScreen.prototype.render = function () { }, [ h('i.fa.fa-plus.fa-lg', {key: ''}), ]), + h('hr.horizontal-line'), ]), unconfTxList.length ? ( -- cgit From c37c050c8a119e4c2de1edea474c3c3d5ad1cf99 Mon Sep 17 00:00:00 2001 From: Frankie Date: Mon, 12 Sep 2016 10:34:06 -0700 Subject: Revert "Add new eth-lightwallet salting to vault." --- ui/app/accounts/account-list-item.js | 13 ++++++++----- ui/app/accounts/index.js | 4 ++-- ui/app/components/shapeshift-form.js | 4 ++-- ui/app/first-time/restore-vault.js | 6 +++--- ui/app/send.js | 6 +++--- 5 files changed, 18 insertions(+), 15 deletions(-) (limited to 'ui/app') diff --git a/ui/app/accounts/account-list-item.js b/ui/app/accounts/account-list-item.js index 4e0d69ed7..0b4acdfec 100644 --- a/ui/app/accounts/account-list-item.js +++ b/ui/app/accounts/account-list-item.js @@ -7,14 +7,14 @@ const EthBalance = require('../components/eth-balance') const CopyButton = require('../components/copyButton') const Identicon = require('../components/identicon') -module.exports = AccountListItem +module.exports = NewComponent -inherits(AccountListItem, Component) -function AccountListItem () { +inherits(NewComponent, Component) +function NewComponent () { Component.call(this) } -AccountListItem.prototype.render = function () { +NewComponent.prototype.render = function () { const identity = this.props.identity var isSelected = this.props.selectedAddress === identity.address var account = this.props.accounts[identity.address] @@ -23,6 +23,9 @@ AccountListItem.prototype.render = function () { return ( h(`.accounts-list-option.flex-row.flex-space-between.pointer.hover-white${selectedClass}`, { key: `account-panel-${identity.address}`, + style: { + flex: '1 0 auto', + }, onClick: (event) => this.props.onShowDetail(identity.address, event), }, [ @@ -70,7 +73,7 @@ AccountListItem.prototype.render = function () { ) } -AccountListItem.prototype.pendingOrNot = function () { +NewComponent.prototype.pendingOrNot = function () { const pending = this.props.pending if (pending.length === 0) return null return h('.pending-dot', pending.length) diff --git a/ui/app/accounts/index.js b/ui/app/accounts/index.js index d3c84d387..c20900c1e 100644 --- a/ui/app/accounts/index.js +++ b/ui/app/accounts/index.js @@ -84,7 +84,7 @@ AccountsScreen.prototype.render = function () { }) }), - h('hr.horizontal-line'), + h('hr.horizontal-line', {key: 'horizontal-line1'}), h('div.footer.hover-white.pointer', { key: 'reveal-account-bar', onClick: () => { @@ -92,6 +92,7 @@ AccountsScreen.prototype.render = function () { }, style: { display: 'flex', + flex: '1 0 auto', height: '40px', paddint: '10px', justifyContent: 'center', @@ -100,7 +101,6 @@ AccountsScreen.prototype.render = function () { }, [ h('i.fa.fa-plus.fa-lg', {key: ''}), ]), - h('hr.horizontal-line'), ]), unconfTxList.length ? ( diff --git a/ui/app/components/shapeshift-form.js b/ui/app/components/shapeshift-form.js index 77c0d12b1..58b7942c3 100644 --- a/ui/app/components/shapeshift-form.js +++ b/ui/app/components/shapeshift-form.js @@ -69,7 +69,7 @@ ShapeshiftForm.prototype.renderMain = function () { h('input#fromCoin.buy-inputs.ex-coins', { type: 'text', list: 'coinList', - dataSet: { + dataset: { persistentFormId: 'input-coin', }, style: { @@ -165,7 +165,7 @@ ShapeshiftForm.prototype.renderMain = function () { h('input#fromCoinAddress.buy-inputs', { type: 'text', placeholder: `Your ${coin} Refund Address`, - dataSet: { + dataset: { persistentFormId: 'refund-address', }, style: { diff --git a/ui/app/first-time/restore-vault.js b/ui/app/first-time/restore-vault.js index c34cd7e66..4c1f21008 100644 --- a/ui/app/first-time/restore-vault.js +++ b/ui/app/first-time/restore-vault.js @@ -41,7 +41,7 @@ RestoreVaultScreen.prototype.render = function () { // wallet seed entry h('h3', 'Wallet Seed'), h('textarea.twelve-word-phrase.letter-spacey', { - dataSet: { + dataset: { persistentFormId: 'wallet-seed', }, placeholder: 'Enter your secret twelve word phrase here to restore your vault.', @@ -52,7 +52,7 @@ RestoreVaultScreen.prototype.render = function () { type: 'password', id: 'password-box', placeholder: 'New Password (min 8 chars)', - dataSet: { + dataset: { persistentFormId: 'password', }, style: { @@ -67,7 +67,7 @@ RestoreVaultScreen.prototype.render = function () { id: 'password-box-confirm', placeholder: 'Confirm Password', onKeyPress: this.onMaybeCreate.bind(this), - dataSet: { + dataset: { persistentFormId: 'password-confirmation', }, style: { diff --git a/ui/app/send.js b/ui/app/send.js index e660e90a8..009866cf7 100644 --- a/ui/app/send.js +++ b/ui/app/send.js @@ -138,7 +138,7 @@ SendTransactionScreen.prototype.render = function () { h('input.large-input', { name: 'address', placeholder: 'Recipient Address', - dataSet: { + dataset: { persistentFormId: 'recipient-address', }, }), @@ -154,7 +154,7 @@ SendTransactionScreen.prototype.render = function () { style: { marginRight: 6, }, - dataSet: { + dataset: { persistentFormId: 'tx-amount', }, }), @@ -192,7 +192,7 @@ SendTransactionScreen.prototype.render = function () { width: '100%', resize: 'none', }, - dataSet: { + dataset: { persistentFormId: 'tx-data', }, }), -- cgit