diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-11-18 05:51:32 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-11-18 05:51:32 +0800 |
commit | 4352c7031afb6f9a175b29d0addeb7ea48345676 (patch) | |
tree | ecb311d43d0f77d5f5f0e82a0014a09c6381f0ef /ui/app | |
parent | f229d32442f34859be169e38a42ffecdfb8fc48a (diff) | |
parent | 592b64a19fd7001d965aa1a1c329b24f55d2ea90 (diff) | |
download | tangerine-wallet-browser-4352c7031afb6f9a175b29d0addeb7ea48345676.tar tangerine-wallet-browser-4352c7031afb6f9a175b29d0addeb7ea48345676.tar.gz tangerine-wallet-browser-4352c7031afb6f9a175b29d0addeb7ea48345676.tar.bz2 tangerine-wallet-browser-4352c7031afb6f9a175b29d0addeb7ea48345676.tar.lz tangerine-wallet-browser-4352c7031afb6f9a175b29d0addeb7ea48345676.tar.xz tangerine-wallet-browser-4352c7031afb6f9a175b29d0addeb7ea48345676.tar.zst tangerine-wallet-browser-4352c7031afb6f9a175b29d0addeb7ea48345676.zip |
Merge branch 'i328-MultiVault' of github.com:MetaMask/metamask-plugin into i328-MultiVault
Diffstat (limited to 'ui/app')
-rw-r--r-- | ui/app/actions.js | 46 | ||||
-rw-r--r-- | ui/app/app.js | 8 | ||||
-rw-r--r-- | ui/app/components/coinbase-form.js | 12 | ||||
-rw-r--r-- | ui/app/components/copyButton.js | 4 | ||||
-rw-r--r-- | ui/app/components/drop-menu-item.js | 6 | ||||
-rw-r--r-- | ui/app/components/network.js | 2 | ||||
-rw-r--r-- | ui/app/components/pending-tx.js | 9 | ||||
-rw-r--r-- | ui/app/components/shapeshift-form.js | 6 | ||||
-rw-r--r-- | ui/app/components/shift-list-item.js | 1 | ||||
-rw-r--r-- | ui/app/components/tooltip.js | 2 | ||||
-rw-r--r-- | ui/app/components/transaction-list-item.js | 2 | ||||
-rw-r--r-- | ui/app/conf-tx.js | 6 | ||||
-rw-r--r-- | ui/app/keychains/hd/recover-seed/confirmation.js | 18 | ||||
-rw-r--r-- | ui/app/reducers.js | 2 | ||||
-rw-r--r-- | ui/app/reducers/app.js | 1 | ||||
-rw-r--r-- | ui/app/reducers/metamask.js | 2 |
16 files changed, 54 insertions, 73 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js index 070ba2da0..e69b743e9 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -44,7 +44,6 @@ var actions = { unlockInProgress: unlockInProgress, // error handling displayWarning: displayWarning, - showWarning: showWarning, // alias DISPLAY_WARNING: 'DISPLAY_WARNING', HIDE_WARNING: 'HIDE_WARNING', hideWarning: hideWarning, @@ -146,7 +145,7 @@ var actions = { module.exports = actions var background = null -function _setBackgroundConnection(backgroundConnection) { +function _setBackgroundConnection (backgroundConnection) { background = backgroundConnection } @@ -167,7 +166,6 @@ function tryUnlockMetamask (password) { if (err) { dispatch(actions.unlockFailed(err.message)) } else { - dispatch(this.updateMetamaskState(newState)) let selectedAccount try { selectedAccount = newState.metamask.selectedAccount @@ -184,7 +182,7 @@ function confirmSeedWords () { background.clearSeedWordCache((err, account) => { dispatch(actions.hideLoadingIndication()) if (err) { - return dispatch(actions.showWarning(err.message)) + return dispatch(actions.displayWarning(err.message)) } console.log('Seed word cache cleared. ' + account) @@ -196,23 +194,19 @@ function confirmSeedWords () { function createNewVaultAndRestore (password, seed) { return (dispatch) => { dispatch(actions.showLoadingIndication()) - background.createNewVaultAndRestore(password, seed, (err, newState) => { + background.createNewVaultAndRestore(password, seed, (err) => { dispatch(actions.hideLoadingIndication()) if (err) return dispatch(actions.displayWarning(err.message)) - dispatch(this.updateMetamaskState(newState)) }) } } function createNewVaultAndKeychain (password, entropy) { return (dispatch) => { - background.createNewVaultAndKeychain(password, entropy, (err, newState) => { + background.createNewVaultAndKeychain(password, entropy, (err) => { if (err) { return dispatch(actions.showWarning(err.message)) } - - dispatch(this.updateMetamaskState(newState)) - dispatch(this.showNewVaultSeed()) }) } } @@ -226,11 +220,10 @@ function revealSeedConfirmation () { function requestRevealSeed (password) { return (dispatch) => { dispatch(actions.showLoadingIndication()) - background.submitPassword(password, (err, newState) => { + background.submitPassword(password, (err) => { dispatch(actions.hideLoadingIndication()) if (err) return dispatch(actions.displayWarning(err.message)) background.placeSeedWords() - dispatch(actions.showNewVaultSeed()) }) } } @@ -239,13 +232,11 @@ function requestRevealSeed (password) { function addNewKeyring (type, opts) { return (dispatch) => { dispatch(actions.showLoadingIndication()) - background.addNewKeyring(type, opts, (err, newState) => { + background.addNewKeyring(type, opts, (err) => { dispatch(this.hideLoadingIndication()) if (err) { return dispatch(actions.showWarning(err)) } - dispatch(this.updateMetamaskState(newState)) - dispatch(this.showAccountsPage()) }) } } @@ -253,12 +244,11 @@ function addNewKeyring (type, opts) { function addNewAccount (ringNumber = 0) { return (dispatch) => { dispatch(actions.showLoadingIndication()) - background.addNewAccount(ringNumber, (err, newState) => { + background.addNewAccount(ringNumber, (err) => { dispatch(this.hideLoadingIndication()) if (err) { return dispatch(actions.showWarning(err)) } - dispatch(this.updateMetamaskState(newState)) }) } } @@ -384,7 +374,7 @@ function agreeToDisclaimer () { dispatch(this.showLoadingIndication()) background.agreeToDisclaimer((err) => { if (err) { - return dispatch(actions.showWarning(err.message)) + return dispatch(actions.displayWarning(err.message)) } dispatch(this.hideLoadingIndication()) @@ -456,12 +446,8 @@ function lockMetamask () { background.setLocked((err) => { dispatch(actions.hideLoadingIndication()) if (err) { - return dispatch(actions.showWarning(err.message)) + return dispatch(actions.displayWarning(err.message)) } - - dispatch({ - type: actions.LOCK_METAMASK, - }) }) } } @@ -472,7 +458,7 @@ function showAccountDetail (address) { background.setSelectedAddress(address, (err, address) => { dispatch(actions.hideLoadingIndication()) if (err) { - return dispatch(actions.showWarning(err.message)) + return dispatch(actions.displayWarning(err.message)) } dispatch({ @@ -586,10 +572,6 @@ function hideSubLoadingIndication () { } } -function showWarning (text) { - return this.displayWarning(text) -} - function displayWarning (text) { return { type: actions.DISPLAY_WARNING, @@ -641,7 +623,7 @@ function saveAccountLabel (account, label) { background.saveAccountLabel(account, label, (err) => { dispatch(actions.hideLoadingIndication()) if (err) { - return dispatch(actions.showWarning(err.message)) + return dispatch(actions.displayWarning(err.message)) } dispatch({ type: actions.SAVE_ACCOUNT_LABEL, @@ -717,7 +699,7 @@ function shapeShiftSubview (network) { shapeShiftRequest('marketinfo', {pair}, (mktResponse) => { shapeShiftRequest('getcoins', {}, (response) => { dispatch(actions.hideSubLoadingIndication()) - if (mktResponse.error) return dispatch(actions.showWarning(mktResponse.error)) + if (mktResponse.error) return dispatch(actions.displayWarning(mktResponse.error)) dispatch({ type: actions.SHAPESHIFT_SUBVIEW, value: { @@ -734,7 +716,7 @@ function coinShiftRquest (data, marketData) { return (dispatch) => { dispatch(actions.showLoadingIndication()) shapeShiftRequest('shift', { method: 'POST', data}, (response) => { - if (response.error) return dispatch(actions.showWarning(response.error)) + if (response.error) return dispatch(actions.displayWarning(response.error)) var message = ` Deposit your ${response.depositType} to the address bellow:` background.createShapeShiftTx(response.deposit, response.depositType) @@ -756,7 +738,7 @@ function reshowQrCode (data, coin) { return (dispatch) => { dispatch(actions.showLoadingIndication()) shapeShiftRequest('marketinfo', {pair: `${coin.toLowerCase()}_eth`}, (mktResponse) => { - if (mktResponse.error) return dispatch(actions.showWarning(mktResponse.error)) + if (mktResponse.error) return dispatch(actions.displayWarning(mktResponse.error)) var message = [ `Deposit your ${coin} to the address bellow:`, diff --git a/ui/app/app.js b/ui/app/app.js index a2532c153..977392c57 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -39,7 +39,7 @@ function mapStateToProps (state) { return { // state from plugin isLoading: state.appState.isLoading, - isConfirmed: state.metamask.isConfirmed, + isDisclaimerConfirmed: state.metamask.isDisclaimerConfirmed, isInitialized: state.metamask.isInitialized, isUnlocked: state.metamask.isUnlocked, currentView: state.appState.currentView, @@ -98,7 +98,6 @@ App.prototype.render = function () { } App.prototype.renderAppBar = function () { - if (window.METAMASK_UI_TYPE === 'notification') { return null } @@ -324,7 +323,7 @@ App.prototype.renderBackButton = function (style, justArrow = false) { App.prototype.renderBackToInitButton = function () { var props = this.props var button = null - if (!props.isConfirmed) return button + if (!props.isDisclaimerConfirmed) return button if (!props.isUnlocked) { if (props.currentView.name === 'InitMenu') { @@ -357,7 +356,7 @@ App.prototype.renderBackToInitButton = function () { App.prototype.renderPrimary = function () { var props = this.props - if (!props.isConfirmed) { + if (!props.isDisclaimerConfirmed) { return h(DisclaimerScreen, {key: 'disclaimerScreen'}) } @@ -367,7 +366,6 @@ App.prototype.renderPrimary = function () { // show initialize screen if (!props.isInitialized || props.forgottenPassword) { - // show current view switch (props.currentView.name) { diff --git a/ui/app/components/coinbase-form.js b/ui/app/components/coinbase-form.js index efd05ec96..693eb2ea8 100644 --- a/ui/app/components/coinbase-form.js +++ b/ui/app/components/coinbase-form.js @@ -7,7 +7,7 @@ const actions = require('../actions') const isValidAddress = require('../util').isValidAddress module.exports = connect(mapStateToProps)(CoinbaseForm) -function mapStateToProps(state) { +function mapStateToProps (state) { return { selectedAccount: state.selectedAccount, warning: state.appState.warning, @@ -16,7 +16,7 @@ function mapStateToProps(state) { inherits(CoinbaseForm, Component) -function CoinbaseForm() { +function CoinbaseForm () { Component.call(this) } @@ -116,15 +116,14 @@ CoinbaseForm.prototype.toCoinbase = function () { props.dispatch(actions.buyEth(address, props.buyView.amount)) } else if (!isValidAmountforCoinBase(amount).valid) { message = isValidAmountforCoinBase(amount).message - return props.dispatch(actions.showWarning(message)) + return props.dispatch(actions.displayWarning(message)) } else { message = 'Receiving address is invalid.' - return props.dispatch(actions.showWarning(message)) + return props.dispatch(actions.displayWarning(message)) } } CoinbaseForm.prototype.renderLoading = function () { - return h('img', { style: { width: '27px', @@ -134,9 +133,8 @@ CoinbaseForm.prototype.renderLoading = function () { }) } -function isValidAmountforCoinBase(amount) { +function isValidAmountforCoinBase (amount) { amount = parseFloat(amount) - if (amount) { if (amount <= 5 && amount > 0) { return { diff --git a/ui/app/components/copyButton.js b/ui/app/components/copyButton.js index a01603585..a25d0719c 100644 --- a/ui/app/components/copyButton.js +++ b/ui/app/components/copyButton.js @@ -50,12 +50,10 @@ CopyButton.prototype.render = function () { ]) } -CopyButton.prototype.debounceRestore = function() { - +CopyButton.prototype.debounceRestore = function () { this.setState({ copied: true }) clearTimeout(this.timeout) this.timeout = setTimeout(() => { this.setState({ copied: false }) }, 850) - } diff --git a/ui/app/components/drop-menu-item.js b/ui/app/components/drop-menu-item.js index 8088680c0..5c06101df 100644 --- a/ui/app/components/drop-menu-item.js +++ b/ui/app/components/drop-menu-item.js @@ -32,9 +32,9 @@ DropMenuItem.prototype.render = function () { } DropMenuItem.prototype.activeNetworkRender = function () { - let activeNetwork = this.props.activeNetworkRender - let { provider } = this.props - let providerType = provider ? provider.type : null + const activeNetwork = this.props.activeNetworkRender + const { provider } = this.props + const providerType = provider ? provider.type : null if (activeNetwork === undefined) return switch (this.props.label) { diff --git a/ui/app/components/network.js b/ui/app/components/network.js index ff5aefd41..8e67dd741 100644 --- a/ui/app/components/network.js +++ b/ui/app/components/network.js @@ -22,7 +22,6 @@ Network.prototype.render = function () { let iconName, hoverText if (networkNumber === 'loading') { - return h('img.network-indicator', { title: 'Attempting to connect to blockchain.', onClick: (event) => this.props.onClick(event), @@ -32,7 +31,6 @@ Network.prototype.render = function () { }, src: 'images/loading.svg', }) - } else if (providerName === 'mainnet') { hoverText = 'Main Ethereum Network' iconName = 'ethereum-network' diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js index 4c27a8092..96f968929 100644 --- a/ui/app/components/pending-tx.js +++ b/ui/app/components/pending-tx.js @@ -30,6 +30,15 @@ PendingTx.prototype.render = function () { } `), + txData.simulationFails ? + h('.error', { + style: { + marginLeft: 50, + fontSize: '0.9em', + }, + }, 'Transaction Error. Exception thrown in contract code.') + : null, + state.insufficientBalance ? h('span.error', { style: { diff --git a/ui/app/components/shapeshift-form.js b/ui/app/components/shapeshift-form.js index 2bb384b94..383d5b623 100644 --- a/ui/app/components/shapeshift-form.js +++ b/ui/app/components/shapeshift-form.js @@ -8,7 +8,7 @@ const Qr = require('./qr-code') const isValidAddress = require('../util').isValidAddress module.exports = connect(mapStateToProps)(ShapeshiftForm) -function mapStateToProps(state) { +function mapStateToProps (state) { return { selectedAccount: state.selectedAccount, warning: state.appState.warning, @@ -25,7 +25,6 @@ function ShapeshiftForm () { } ShapeshiftForm.prototype.render = function () { - return h(ReactCSSTransitionGroup, { className: 'css-transition-group', transitionName: 'main', @@ -34,7 +33,6 @@ ShapeshiftForm.prototype.render = function () { }, [ this.props.qrRequested ? h(Qr, {key: 'qr'}) : this.renderMain(), ]) - } ShapeshiftForm.prototype.renderMain = function () { @@ -244,7 +242,7 @@ ShapeshiftForm.prototype.updateCoin = function (event) { if (!coinOptions[coin.toUpperCase()] || coin.toUpperCase() === 'ETH') { var message = 'Not a valid coin' - return props.dispatch(actions.showWarning(message)) + return props.dispatch(actions.displayWarning(message)) } else { return props.dispatch(actions.pairUpdate(coin)) } diff --git a/ui/app/components/shift-list-item.js b/ui/app/components/shift-list-item.js index 38c19eb28..e0243e247 100644 --- a/ui/app/components/shift-list-item.js +++ b/ui/app/components/shift-list-item.js @@ -26,7 +26,6 @@ function ShiftListItem () { } ShiftListItem.prototype.render = function () { - return ( h('.transaction-list-item.flex-row', { style: { diff --git a/ui/app/components/tooltip.js b/ui/app/components/tooltip.js index 757ad0cd6..edbc074bb 100644 --- a/ui/app/components/tooltip.js +++ b/ui/app/components/tooltip.js @@ -11,7 +11,6 @@ function Tooltip () { } Tooltip.prototype.render = function () { - const props = this.props const { position, title, children } = props @@ -20,5 +19,4 @@ Tooltip.prototype.render = function () { title, fixed: false, }, children) - } diff --git a/ui/app/components/transaction-list-item.js b/ui/app/components/transaction-list-item.js index 491e90c7c..d1306549e 100644 --- a/ui/app/components/transaction-list-item.js +++ b/ui/app/components/transaction-list-item.js @@ -63,7 +63,7 @@ TransactionListItem.prototype.render = function () { style: { fontSize: '27px', }, - }) : h( '.pop-hover', { + }) : h('.pop-hover', { onClick: (event) => { event.stopPropagation() if (!isTx || isPending) return diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js index f4ca52860..8d23adfe5 100644 --- a/ui/app/conf-tx.js +++ b/ui/app/conf-tx.js @@ -170,6 +170,10 @@ function warningIfExists (warning) { if (warning && // Do not display user rejections on this screen: warning.indexOf('User denied transaction signature') === -1) { - return h('span.error', { style: { margin: 'auto' } }, warning) + return h('.error', { + style: { + margin: 'auto', + }, + }, warning) } } diff --git a/ui/app/keychains/hd/recover-seed/confirmation.js b/ui/app/keychains/hd/recover-seed/confirmation.js index 83dbc270f..56ac461ea 100644 --- a/ui/app/keychains/hd/recover-seed/confirmation.js +++ b/ui/app/keychains/hd/recover-seed/confirmation.js @@ -5,10 +5,10 @@ const connect = require('react-redux').connect const h = require('react-hyperscript') const actions = require('../../../actions') -module.exports = connect(mapStateToProps)(RevealSeedConfirmatoin) +module.exports = connect(mapStateToProps)(RevealSeedConfirmation) -inherits(RevealSeedConfirmatoin, Component) -function RevealSeedConfirmatoin () { +inherits(RevealSeedConfirmation, Component) +function RevealSeedConfirmation () { Component.call(this) } @@ -18,9 +18,9 @@ function mapStateToProps (state) { } } -RevealSeedConfirmatoin.prototype.confirmationPhrase = 'I understand' +RevealSeedConfirmation.prototype.confirmationPhrase = 'I understand' -RevealSeedConfirmatoin.prototype.render = function () { +RevealSeedConfirmation.prototype.render = function () { const props = this.props const state = this.state @@ -116,24 +116,24 @@ RevealSeedConfirmatoin.prototype.render = function () { ) } -RevealSeedConfirmatoin.prototype.componentDidMount = function () { +RevealSeedConfirmation.prototype.componentDidMount = function () { document.getElementById('password-box').focus() } -RevealSeedConfirmatoin.prototype.goHome = function () { +RevealSeedConfirmation.prototype.goHome = function () { this.props.dispatch(actions.showConfigPage(false)) } // create vault -RevealSeedConfirmatoin.prototype.checkConfirmation = function (event) { +RevealSeedConfirmation.prototype.checkConfirmation = function (event) { if (event.key === 'Enter') { event.preventDefault() this.revealSeedWords() } } -RevealSeedConfirmatoin.prototype.revealSeedWords = function () { +RevealSeedConfirmation.prototype.revealSeedWords = function () { this.setState({ confirmationWrong: false }) const confirmBox = document.getElementById('confirm-box') diff --git a/ui/app/reducers.js b/ui/app/reducers.js index a691cf614..4d10e2b39 100644 --- a/ui/app/reducers.js +++ b/ui/app/reducers.js @@ -41,7 +41,7 @@ function rootReducer (state, action) { return state } -window.logState = function() { +window.logState = function () { var stateString = JSON.stringify(window.METAMASK_CACHED_LOG_STATE, null, 2) console.log(stateString) } diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index 49507eb30..ca450fd89 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -278,7 +278,6 @@ function reduceApp (state, action) { warning: null, }) } else { - notification.closePopup() return extend(appState, { diff --git a/ui/app/reducers/metamask.js b/ui/app/reducers/metamask.js index aa809b333..82904dcc6 100644 --- a/ui/app/reducers/metamask.js +++ b/ui/app/reducers/metamask.js @@ -30,7 +30,7 @@ function reduceMetamask (state, action) { case actions.AGREE_TO_DISCLAIMER: return extend(metamaskState, { - isConfirmed: true, + isDisclaimerConfirmed: true, }) case actions.UNLOCK_METAMASK: |