From 0264ecaad77330b151f4bf4248b66f4659a67cce Mon Sep 17 00:00:00 2001 From: Jacky Chan Date: Fri, 18 Aug 2017 04:11:26 -0700 Subject: Adding CreatePasswordScreen --- ui/app/app.js | 24 ++++++++++++++++++++++++ ui/app/reducers/metamask.js | 2 ++ 2 files changed, 26 insertions(+) (limited to 'ui/app') diff --git a/ui/app/app.js b/ui/app/app.js index 613577913..57e3d3366 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -3,6 +3,8 @@ const Component = require('react').Component const connect = require('react-redux').connect const h = require('react-hyperscript') const actions = require('./actions') +// mascara +const MascaraFirstTime = require('../../mascara/src/app/first-time').default // init const InitializeMenuScreen = require('./first-time/init-menu') const NewKeyChainScreen = require('./new-keychain') @@ -43,6 +45,10 @@ function mapStateToProps (state) { accounts, address, keyrings, + isMascara, + isInitialized, + noActiveNotices, + seedWords } = state.metamask const selected = address || Object.keys(accounts)[0] @@ -56,6 +62,8 @@ function mapStateToProps (state) { currentView: state.appState.currentView, activeAddress: state.appState.activeAddress, transForward: state.appState.transForward, + isMascara: state.metamask.isMascara, + isOnboarding: Boolean(!noActiveNotices || seedWords || !isInitialized), seedWords: state.metamask.seedWords, unapprovedTxs: state.metamask.unapprovedTxs, unapprovedMsgs: state.metamask.unapprovedMsgs, @@ -123,6 +131,11 @@ App.prototype.renderAppBar = function () { const props = this.props const state = this.state || {} const isNetworkMenuOpen = state.isNetworkMenuOpen || false + const {isMascara, isOnboarding} = props + + if (isMascara && isOnboarding) { + return null + } return ( @@ -407,9 +420,20 @@ App.prototype.renderBackButton = function (style, justArrow = false) { ) } +App.prototype.renderMascaraFirstTime = function () { + return 'hi' +} + App.prototype.renderPrimary = function () { log.debug('rendering primary') var props = this.props + const {isMascara, isOnboarding} = props + + if (isMascara && isOnboarding) { + return h(MascaraFirstTime, { + screenType: MascaraFirstTime.getScreenType(props) + }) + } // notices if (!props.noActiveNotices) { diff --git a/ui/app/reducers/metamask.js b/ui/app/reducers/metamask.js index e0c416c2d..323539eef 100644 --- a/ui/app/reducers/metamask.js +++ b/ui/app/reducers/metamask.js @@ -1,5 +1,6 @@ const extend = require('xtend') const actions = require('../actions') +const MetamascaraPlatform = require('../../../app/scripts/platforms/window') module.exports = reduceMetamask @@ -10,6 +11,7 @@ function reduceMetamask (state, action) { var metamaskState = extend({ isInitialized: false, isUnlocked: false, + isMascara: window.platform instanceof MetamascaraPlatform, rpcTarget: 'https://rawtestrpc.metamask.io/', identities: {}, unapprovedTxs: {}, -- cgit v1.2.3 From e1497fafa64b5f8e25407611709920dc5e0eaf77 Mon Sep 17 00:00:00 2001 From: Jacky Chan Date: Mon, 21 Aug 2017 04:56:09 -0700 Subject: Add UniqueImageScreen --- ui/app/actions.js | 27 +++++++++++++++++---------- ui/app/app.js | 24 +++++++++++++----------- 2 files changed, 30 insertions(+), 21 deletions(-) (limited to 'ui/app') diff --git a/ui/app/actions.js b/ui/app/actions.js index 84990922e..11cd14c16 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -243,19 +243,26 @@ function createNewVaultAndKeychain (password) { return (dispatch) => { dispatch(actions.showLoadingIndication()) log.debug(`background.createNewVaultAndKeychain`) - background.createNewVaultAndKeychain(password, (err) => { - if (err) { - return dispatch(actions.displayWarning(err.message)) - } - log.debug(`background.placeSeedWords`) - background.placeSeedWords((err) => { + + return new Promise((resolve, reject) => { + background.createNewVaultAndKeychain(password, (err) => { if (err) { - return dispatch(actions.displayWarning(err.message)) + dispatch(actions.displayWarning(err.message)) + return reject(err) } - dispatch(actions.hideLoadingIndication()) - forceUpdateMetamaskState(dispatch) + log.debug(`background.placeSeedWords`) + background.placeSeedWords((err) => { + if (err) { + dispatch(actions.displayWarning(err.message)) + return reject(err) + } + dispatch(actions.hideLoadingIndication()) + forceUpdateMetamaskState(dispatch) + resolve() + }) }) - }) + }); + } } diff --git a/ui/app/app.js b/ui/app/app.js index 57e3d3366..ec36eb22e 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -106,10 +106,7 @@ App.prototype.render = function () { this.renderNetworkDropdown(), this.renderDropdown(), - h(Loading, { - isLoading: isLoading || isLoadingNetwork, - loadingMessage: loadMessage, - }), + this.renderLoadingIndicator({ isLoading, isLoadingNetwork, loadMessage }), // panel content h('.app-primary' + (transForward ? '.from-right' : '.from-left'), { @@ -401,6 +398,17 @@ App.prototype.renderDropdown = function () { ]) } +App.prototype.renderLoadingIndicator = function({ isLoading, isLoadingNetwork, loadMessage }) { + const { isMascara } = this.props; + + return isMascara + ? null + : h(Loading, { + isLoading: isLoading || isLoadingNetwork, + loadingMessage: loadMessage, + }) +} + App.prototype.renderBackButton = function (style, justArrow = false) { var props = this.props return ( @@ -420,19 +428,13 @@ App.prototype.renderBackButton = function (style, justArrow = false) { ) } -App.prototype.renderMascaraFirstTime = function () { - return 'hi' -} - App.prototype.renderPrimary = function () { log.debug('rendering primary') var props = this.props const {isMascara, isOnboarding} = props if (isMascara && isOnboarding) { - return h(MascaraFirstTime, { - screenType: MascaraFirstTime.getScreenType(props) - }) + return h(MascaraFirstTime) } // notices -- cgit v1.2.3 From fd4fbdc0cd70e31764a497946f565757b204b616 Mon Sep 17 00:00:00 2001 From: Jacky Chan Date: Tue, 22 Aug 2017 05:59:44 -0700 Subject: Add NoticeScreen --- ui/app/actions.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'ui/app') diff --git a/ui/app/actions.js b/ui/app/actions.js index 11cd14c16..f026fd0ab 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -696,21 +696,23 @@ function goBackToInitView () { function markNoticeRead (notice) { return (dispatch) => { - dispatch(this.showLoadingIndication()) + dispatch(actions.showLoadingIndication()) log.debug(`background.markNoticeRead`) - background.markNoticeRead(notice, (err, notice) => { - dispatch(this.hideLoadingIndication()) - if (err) { - return dispatch(actions.displayWarning(err)) - } - if (notice) { - return dispatch(actions.showNotice(notice)) - } else { - dispatch(this.clearNotices()) - return { - type: actions.SHOW_ACCOUNTS_PAGE, + return new Promise((resolve, reject) => { + background.markNoticeRead(notice, (err, notice) => { + dispatch(actions.hideLoadingIndication()) + if (err) { + dispatch(actions.displayWarning(err)) + return reject(err) } - } + if (notice) { + dispatch(actions.showNotice(notice)) + resolve() + } else { + dispatch(actions.clearNotices()) + resolve() + } + }) }) } } -- cgit v1.2.3 From 1a9b217558fd7a3a528a068c6820f2d905d62e9d Mon Sep 17 00:00:00 2001 From: Jacky Chan Date: Wed, 23 Aug 2017 04:04:11 -0700 Subject: Add BackupPhraseScreen --- ui/app/actions.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'ui/app') diff --git a/ui/app/actions.js b/ui/app/actions.js index f026fd0ab..ec18f099e 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -215,14 +215,18 @@ function confirmSeedWords () { return (dispatch) => { dispatch(actions.showLoadingIndication()) log.debug(`background.clearSeedWordCache`) - background.clearSeedWordCache((err, account) => { - dispatch(actions.hideLoadingIndication()) - if (err) { - return dispatch(actions.displayWarning(err.message)) - } + return new Promise((resolve, reject) => { + background.clearSeedWordCache((err, account) => { + dispatch(actions.hideLoadingIndication()) + if (err) { + dispatch(actions.displayWarning(err.message)) + reject(err) + } - log.info('Seed word cache cleared. ' + account) - dispatch(actions.showAccountDetail(account)) + log.info('Seed word cache cleared. ' + account) + dispatch(actions.showAccountDetail(account)) + resolve(account) + }) }) } } -- cgit v1.2.3 From 449bce5eea5a5ee049828121876340ae226351b7 Mon Sep 17 00:00:00 2001 From: Jacky Chan Date: Tue, 29 Aug 2017 00:52:59 -0700 Subject: Implement Import Account Screen --- ui/app/actions.js | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'ui/app') diff --git a/ui/app/actions.js b/ui/app/actions.js index ec18f099e..04bba6bf2 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -310,18 +310,25 @@ function importNewAccount (strategy, args) { return (dispatch) => { dispatch(actions.showLoadingIndication('This may take a while, be patient.')) log.debug(`background.importAccountWithStrategy`) - background.importAccountWithStrategy(strategy, args, (err) => { - if (err) return dispatch(actions.displayWarning(err.message)) - log.debug(`background.getState`) - background.getState((err, newState) => { - dispatch(actions.hideLoadingIndication()) + return new Promise((resolve, reject) => { + background.importAccountWithStrategy(strategy, args, (err) => { if (err) { - return dispatch(actions.displayWarning(err.message)) + dispatch(actions.displayWarning(err.message)) + return reject(err) } - dispatch(actions.updateMetamaskState(newState)) - dispatch({ - type: actions.SHOW_ACCOUNT_DETAIL, - value: newState.selectedAddress, + log.debug(`background.getState`) + background.getState((err, newState) => { + dispatch(actions.hideLoadingIndication()) + if (err) { + dispatch(actions.displayWarning(err.message)) + return reject(err) + } + dispatch(actions.updateMetamaskState(newState)) + dispatch({ + type: actions.SHOW_ACCOUNT_DETAIL, + value: newState.selectedAddress, + }) + resolve(newState) }) }) }) -- cgit v1.2.3 From 85e485128ff3ca4e458bd5d99d15dc295de70f43 Mon Sep 17 00:00:00 2001 From: Jacky Chan Date: Wed, 30 Aug 2017 01:30:55 -0700 Subject: Add Go to Coinbase; Show Buy Ether after signup --- ui/app/actions.js | 2 +- ui/app/app.js | 17 +++++++++++++---- ui/app/keychains/hd/create-vault-complete.js | 9 +++++++-- 3 files changed, 21 insertions(+), 7 deletions(-) (limited to 'ui/app') diff --git a/ui/app/actions.js b/ui/app/actions.js index 04bba6bf2..a9f3185dd 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -224,7 +224,7 @@ function confirmSeedWords () { } log.info('Seed word cache cleared. ' + account) - dispatch(actions.showAccountDetail(account)) + dispatch(actions.showAccountsPage()) resolve(account) }) }) diff --git a/ui/app/app.js b/ui/app/app.js index ec36eb22e..362d9cf27 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -5,6 +5,7 @@ const h = require('react-hyperscript') const actions = require('./actions') // mascara const MascaraFirstTime = require('../../mascara/src/app/first-time').default +const MascaraBuyEtherScreen = require('../../mascara/src/app/first-time/buy-ether-screen').default // init const InitializeMenuScreen = require('./first-time/init-menu') const NewKeyChainScreen = require('./new-keychain') @@ -130,10 +131,16 @@ App.prototype.renderAppBar = function () { const isNetworkMenuOpen = state.isNetworkMenuOpen || false const {isMascara, isOnboarding} = props + // Do not render header if user is in mascara onboarding if (isMascara && isOnboarding) { return null } + // Do not render header if user is in mascara buy ether + if (isMascara && props.currentView.name === 'buyEth') { + return null + } + return ( h('.full-width', { @@ -433,9 +440,9 @@ App.prototype.renderPrimary = function () { var props = this.props const {isMascara, isOnboarding} = props - if (isMascara && isOnboarding) { - return h(MascaraFirstTime) - } + // if (isMascara && isOnboarding) { + // return h(MascaraFirstTime) + // } // notices if (!props.noActiveNotices) { @@ -534,7 +541,9 @@ App.prototype.renderPrimary = function () { case 'buyEth': log.debug('rendering buy ether screen') - return h(BuyView, {key: 'buyEthView'}) + return isMascara + ? h(MascaraBuyEtherScreen, {key: 'buyEthView'}) + : h(BuyView, {key: 'buyEthView'}) case 'qr': log.debug('rendering show qr screen') diff --git a/ui/app/keychains/hd/create-vault-complete.js b/ui/app/keychains/hd/create-vault-complete.js index 745990351..5ab5d4c33 100644 --- a/ui/app/keychains/hd/create-vault-complete.js +++ b/ui/app/keychains/hd/create-vault-complete.js @@ -62,7 +62,8 @@ CreateVaultCompleteScreen.prototype.render = function () { }), h('button.primary', { - onClick: () => this.confirmSeedWords(), + onClick: () => this.confirmSeedWords() + .then(account => this.showAccountDetail(account)), style: { margin: '24px', fontSize: '0.9em', @@ -82,5 +83,9 @@ CreateVaultCompleteScreen.prototype.render = function () { } CreateVaultCompleteScreen.prototype.confirmSeedWords = function () { - this.props.dispatch(actions.confirmSeedWords()) + return this.props.dispatch(actions.confirmSeedWords()) +} + +CreateVaultCompleteScreen.prototype.showAccountDetail = function (account) { + return this.props.dispatch(actions.showAccountDetail(account)) } -- cgit v1.2.3 From 638bbe04283ec885997db8be6482343b7283bf7b Mon Sep 17 00:00:00 2001 From: Jacky Chan Date: Wed, 30 Aug 2017 02:05:45 -0700 Subject: Shuffle tokens --- ui/app/app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ui/app') diff --git a/ui/app/app.js b/ui/app/app.js index 362d9cf27..36241b942 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -440,9 +440,9 @@ App.prototype.renderPrimary = function () { var props = this.props const {isMascara, isOnboarding} = props - // if (isMascara && isOnboarding) { - // return h(MascaraFirstTime) - // } + if (isMascara && isOnboarding) { + return h(MascaraFirstTime) + } // notices if (!props.noActiveNotices) { -- cgit v1.2.3 From c6a3d00d80e1fa6ca1426246d9a3e03b7ad4ecbb Mon Sep 17 00:00:00 2001 From: Chi Kei Chan Date: Mon, 18 Sep 2017 15:41:25 -0700 Subject: Fix merge conflict; separate onboarding buy screen --- ui/app/actions.js | 9 +++++++++ ui/app/app.js | 15 ++++++++------- ui/app/reducers/app.js | 11 +++++++++++ 3 files changed, 28 insertions(+), 7 deletions(-) (limited to 'ui/app') diff --git a/ui/app/actions.js b/ui/app/actions.js index a9f3185dd..eb066a0e7 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -133,6 +133,8 @@ var actions = { showLoadingIndication: showLoadingIndication, hideLoadingIndication: hideLoadingIndication, // buy Eth with coinbase + onboardingBuyEthView, + ONBOARDING_BUY_ETH_VIEW: 'ONBOARDING_BUY_ETH_VIEW', BUY_ETH: 'BUY_ETH', buyEth: buyEth, buyEthView: buyEthView, @@ -903,6 +905,13 @@ function buyEth (opts) { } } +function onboardingBuyEthView (address) { + return { + type: actions.ONBOARDING_BUY_ETH_VIEW, + value: address, + } +} + function buyEthView (address) { return { type: actions.BUY_ETH_VIEW, diff --git a/ui/app/app.js b/ui/app/app.js index 36241b942..bd0ccb0a2 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -46,10 +46,9 @@ function mapStateToProps (state) { accounts, address, keyrings, - isMascara, isInitialized, noActiveNotices, - seedWords + seedWords, } = state.metamask const selected = address || Object.keys(accounts)[0] @@ -405,8 +404,8 @@ App.prototype.renderDropdown = function () { ]) } -App.prototype.renderLoadingIndicator = function({ isLoading, isLoadingNetwork, loadMessage }) { - const { isMascara } = this.props; +App.prototype.renderLoadingIndicator = function ({ isLoading, isLoadingNetwork, loadMessage }) { + const { isMascara } = this.props return isMascara ? null @@ -541,9 +540,11 @@ App.prototype.renderPrimary = function () { case 'buyEth': log.debug('rendering buy ether screen') - return isMascara - ? h(MascaraBuyEtherScreen, {key: 'buyEthView'}) - : h(BuyView, {key: 'buyEthView'}) + return h(BuyView, {key: 'buyEthView'}) + + case 'onboardingBuyEth': + log.debug('rendering onboarding buy ether screen') + return h(MascaraBuyEtherScreen, {key: 'buyEthView'}) case 'qr': log.debug('rendering show qr screen') diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index 349c25b96..4b05b608d 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -494,6 +494,17 @@ function reduceApp (state, action) { }, }) + + case actions.ONBOARDING_BUY_ETH_VIEW: + return extend(appState, { + transForward: true, + currentView: { + name: 'onboardingBuyEth', + context: appState.currentView.name, + }, + identity: state.metamask.identities[action.value], + }) + case actions.COINBASE_SUBVIEW: return extend(appState, { buyView: { -- cgit v1.2.3 From 5cbbb476b3eb7a5fd70b014b2a1a83fea7092b58 Mon Sep 17 00:00:00 2001 From: Chi Kei Chan Date: Mon, 25 Sep 2017 14:51:49 -0700 Subject: ShapeShift Integration --- ui/app/actions.js | 24 +++++++++++++++++++++--- ui/app/reducers/app.js | 1 - ui/app/reducers/metamask.js | 21 +++++++++++++++++++++ 3 files changed, 42 insertions(+), 4 deletions(-) (limited to 'ui/app') diff --git a/ui/app/actions.js b/ui/app/actions.js index eb066a0e7..6a5a31bfb 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -138,6 +138,7 @@ var actions = { BUY_ETH: 'BUY_ETH', buyEth: buyEth, buyEthView: buyEthView, + buyWithShapeShift, BUY_ETH_VIEW: 'BUY_ETH_VIEW', COINBASE_SUBVIEW: 'COINBASE_SUBVIEW', coinBaseSubview: coinBaseSubview, @@ -977,6 +978,18 @@ function coinShiftRquest (data, marketData) { } } +function buyWithShapeShift (data) { + return dispatch => new Promise((resolve, reject) => { + shapeShiftRequest('shift', { method: 'POST', data}, (response) => { + if (response.error) { + return reject(response.error) + } + background.createShapeShiftTx(response.deposit, response.depositType) + return resolve(response) + }) + }) +} + function showQrView (data, message) { return { type: actions.SHOW_QR_VIEW, @@ -1010,9 +1023,14 @@ function shapeShiftRequest (query, options, cb) { options.method ? method = options.method : method = 'GET' var requestListner = function (request) { - queryResponse = JSON.parse(this.responseText) - cb ? cb(queryResponse) : null - return queryResponse + try { + queryResponse = JSON.parse(this.responseText) + cb ? cb(queryResponse) : null + return queryResponse + } catch (e) { + cb ? cb({error: e}) : null + return e + } } var shapShiftReq = new XMLHttpRequest() diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index 4b05b608d..6f08c6dc4 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -494,7 +494,6 @@ function reduceApp (state, action) { }, }) - case actions.ONBOARDING_BUY_ETH_VIEW: return extend(appState, { transForward: true, diff --git a/ui/app/reducers/metamask.js b/ui/app/reducers/metamask.js index 323539eef..85ac3e201 100644 --- a/ui/app/reducers/metamask.js +++ b/ui/app/reducers/metamask.js @@ -19,6 +19,8 @@ function reduceMetamask (state, action) { lastUnreadNotice: undefined, frequentRpcList: [], addressBook: [], + tokenExchangeRates: {}, + coinOptions: {}, }, state.metamask) switch (action.type) { @@ -132,6 +134,25 @@ function reduceMetamask (state, action) { conversionDate: action.value.conversionDate, }) + case actions.PAIR_UPDATE: + const { value: { marketinfo: pairMarketInfo } } = action + return extend(metamaskState, { + tokenExchangeRates: { + ...metamaskState.tokenExchangeRates, + [pairMarketInfo.pair]: pairMarketInfo, + }, + }) + + case actions.SHAPESHIFT_SUBVIEW: + const { value: { marketinfo, coinOptions } } = action + return extend(metamaskState, { + tokenExchangeRates: { + ...metamaskState.tokenExchangeRates, + [marketinfo.pair]: marketinfo, + }, + coinOptions, + }) + default: return metamaskState -- cgit v1.2.3 From ac50db52a9e86bfef9a47fbea3feb7fe78947566 Mon Sep 17 00:00:00 2001 From: Chi Kei Chan Date: Mon, 2 Oct 2017 11:08:34 -0700 Subject: Fix linter --- ui/app/actions.js | 2 +- ui/app/components/account-dropdowns.js | 5 +++++ ui/app/components/dropdown.js | 4 ++++ ui/app/components/editable-label.js | 1 + ui/app/components/identicon.js | 2 ++ ui/app/components/menu-droppo.js | 2 ++ ui/app/components/notice.js | 2 ++ 7 files changed, 17 insertions(+), 1 deletion(-) (limited to 'ui/app') diff --git a/ui/app/actions.js b/ui/app/actions.js index 6a5a31bfb..41b4494ad 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -268,7 +268,7 @@ function createNewVaultAndKeychain (password) { resolve() }) }) - }); + }) } } diff --git a/ui/app/components/account-dropdowns.js b/ui/app/components/account-dropdowns.js index 1b46e532a..6abdd4757 100644 --- a/ui/app/components/account-dropdowns.js +++ b/ui/app/components/account-dropdowns.js @@ -297,6 +297,11 @@ AccountDropdowns.propTypes = { identities: PropTypes.objectOf(PropTypes.object), selected: PropTypes.string, keyrings: PropTypes.array, + actions: PropTypes.objectOf(PropTypes.func), + network: PropTypes.string, + style: PropTypes.object, + enableAccountOptions: PropTypes.bool, + enableAccountsSelector: PropTypes.bool, } const mapDispatchToProps = (dispatch) => { diff --git a/ui/app/components/dropdown.js b/ui/app/components/dropdown.js index 73710acc2..cdd864cc3 100644 --- a/ui/app/components/dropdown.js +++ b/ui/app/components/dropdown.js @@ -52,6 +52,9 @@ Dropdown.propTypes = { onClick: PropTypes.func.isRequired, children: PropTypes.node, style: PropTypes.object.isRequired, + onClickOutside: PropTypes.func, + innerStyle: PropTypes.object, + useCssTransition: PropTypes.bool, } class DropdownMenuItem extends Component { @@ -86,6 +89,7 @@ DropdownMenuItem.propTypes = { closeMenu: PropTypes.func.isRequired, onClick: PropTypes.func.isRequired, children: PropTypes.node, + style: PropTypes.object, } module.exports = { diff --git a/ui/app/components/editable-label.js b/ui/app/components/editable-label.js index 167be7eaf..8a5c8954f 100644 --- a/ui/app/components/editable-label.js +++ b/ui/app/components/editable-label.js @@ -48,6 +48,7 @@ EditableLabel.prototype.saveIfEnter = function (event) { } EditableLabel.prototype.saveText = function () { + // eslint-disable-next-line react/no-find-dom-node var container = findDOMNode(this) var text = container.querySelector('.editable-label input').value var truncatedText = text.substring(0, 20) diff --git a/ui/app/components/identicon.js b/ui/app/components/identicon.js index c754bc6ba..bb476ca7b 100644 --- a/ui/app/components/identicon.js +++ b/ui/app/components/identicon.js @@ -41,6 +41,7 @@ IdenticonComponent.prototype.componentDidMount = function () { if (!address) return + // eslint-disable-next-line react/no-find-dom-node var container = findDOMNode(this) var diameter = props.diameter || this.defaultDiameter @@ -56,6 +57,7 @@ IdenticonComponent.prototype.componentDidUpdate = function () { if (!address) return + // eslint-disable-next-line react/no-find-dom-node var container = findDOMNode(this) var children = container.children diff --git a/ui/app/components/menu-droppo.js b/ui/app/components/menu-droppo.js index 66ab18954..a4e498c6b 100644 --- a/ui/app/components/menu-droppo.js +++ b/ui/app/components/menu-droppo.js @@ -95,6 +95,7 @@ MenuDroppoComponent.prototype.componentDidMount = function () { if (this && document.body) { this.globalClickHandler = this.globalClickOccurred.bind(this) document.body.addEventListener('click', this.globalClickHandler) + // eslint-disable-next-line react/no-find-dom-node var container = findDOMNode(this) this.container = container } @@ -108,6 +109,7 @@ MenuDroppoComponent.prototype.componentWillUnmount = function () { MenuDroppoComponent.prototype.globalClickOccurred = function (event) { const target = event.target + // eslint-disable-next-line react/no-find-dom-node const container = findDOMNode(this) if (target !== container && diff --git a/ui/app/components/notice.js b/ui/app/components/notice.js index c26505193..09d461c7b 100644 --- a/ui/app/components/notice.js +++ b/ui/app/components/notice.js @@ -117,6 +117,7 @@ Notice.prototype.render = function () { } Notice.prototype.componentDidMount = function () { + // eslint-disable-next-line react/no-find-dom-node var node = findDOMNode(this) linker.setupListener(node) if (document.getElementsByClassName('notice-box')[0].clientHeight < 310) { @@ -125,6 +126,7 @@ Notice.prototype.componentDidMount = function () { } Notice.prototype.componentWillUnmount = function () { + // eslint-disable-next-line react/no-find-dom-node var node = findDOMNode(this) linker.teardownListener(node) } -- cgit v1.2.3 From f503120b82c108efae0a4fc1282a43721d961ca2 Mon Sep 17 00:00:00 2001 From: Chi Kei Chan Date: Fri, 20 Oct 2017 22:31:59 -0700 Subject: Add Import With Seed Phrase --- ui/app/actions.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'ui/app') diff --git a/ui/app/actions.js b/ui/app/actions.js index 41b4494ad..04fd35b20 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -238,10 +238,20 @@ function createNewVaultAndRestore (password, seed) { return (dispatch) => { dispatch(actions.showLoadingIndication()) log.debug(`background.createNewVaultAndRestore`) - background.createNewVaultAndRestore(password, seed, (err) => { - dispatch(actions.hideLoadingIndication()) - if (err) return dispatch(actions.displayWarning(err.message)) - dispatch(actions.showAccountsPage()) + + return new Promise((resolve, reject) => { + background.createNewVaultAndRestore(password, seed, (err) => { + + dispatch(actions.hideLoadingIndication()) + + if (err) { + dispatch(actions.displayWarning(err.message)) + return reject(err) + } + + dispatch(actions.showAccountsPage()) + resolve() + }) }) } } -- cgit v1.2.3