diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app/account-detail.js | 2 | ||||
-rw-r--r-- | ui/app/actions.js | 23 | ||||
-rw-r--r-- | ui/app/app.js | 3 | ||||
-rw-r--r-- | ui/app/components/account-dropdowns.js | 21 | ||||
-rw-r--r-- | ui/app/components/dropdown.js | 2 | ||||
-rw-r--r-- | ui/app/components/pending-msg-details.js | 2 | ||||
-rw-r--r-- | ui/app/components/pending-msg.js | 18 | ||||
-rw-r--r-- | ui/app/components/token-list.js | 47 | ||||
-rw-r--r-- | ui/app/components/transaction-list-item.js | 11 | ||||
-rw-r--r-- | ui/app/css/lib.css | 5 | ||||
-rw-r--r-- | ui/app/info.js | 2 | ||||
-rw-r--r-- | ui/app/reducers.js | 5 | ||||
-rw-r--r-- | ui/lib/account-link.js | 10 |
13 files changed, 81 insertions, 70 deletions
diff --git a/ui/app/account-detail.js b/ui/app/account-detail.js index f6041e856..02089ecd0 100644 --- a/ui/app/account-detail.js +++ b/ui/app/account-detail.js @@ -117,7 +117,7 @@ AccountDetailScreen.prototype.render = function () { h('h2', { style: { maxWidth: '180px', - overflowX: 'hidden', + overflow: 'hidden', textOverflow: 'ellipsis', padding: '5px 0px', }, diff --git a/ui/app/actions.js b/ui/app/actions.js index a692267cb..e793e6a21 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -97,7 +97,6 @@ var actions = { cancelMsg: cancelMsg, signPersonalMsg, cancelPersonalMsg, - sendTx: sendTx, signTx: signTx, updateAndApproveTx, cancelTx: cancelTx, @@ -398,26 +397,13 @@ function signPersonalMsg (msgData) { function signTx (txData) { return (dispatch) => { + dispatch(actions.showLoadingIndication()) global.ethQuery.sendTransaction(txData, (err, data) => { dispatch(actions.hideLoadingIndication()) - if (err) return dispatch(actions.displayWarning(err.message)) - dispatch(actions.hideWarning()) - }) - dispatch(this.showConfTxPage()) - } -} - -function sendTx (txData) { - log.info(`actions - sendTx: ${JSON.stringify(txData.txParams)}`) - return (dispatch) => { - log.debug(`actions calling background.approveTransaction`) - background.approveTransaction(txData.id, (err) => { - if (err) { - dispatch(actions.txError(err)) - return log.error(err.message) - } - dispatch(actions.completedTx(txData.id)) + if (err) dispatch(actions.displayWarning(err.message)) + dispatch(this.goHome()) }) + dispatch(actions.showConfTxPage()) } } @@ -429,6 +415,7 @@ function updateAndApproveTx (txData) { dispatch(actions.hideLoadingIndication()) if (err) { dispatch(actions.txError(err)) + dispatch(actions.goHome()) return log.error(err.message) } dispatch(actions.completedTx(txData.id)) diff --git a/ui/app/app.js b/ui/app/app.js index 1f3d5b0f8..ee800ea90 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -42,6 +42,7 @@ function mapStateToProps (state) { identities, accounts, address, + keyrings, } = state.metamask const selected = address || Object.keys(accounts)[0] @@ -69,6 +70,7 @@ function mapStateToProps (state) { // state needed to get account dropdown temporarily rendering from app bar identities, selected, + keyrings, } } @@ -187,6 +189,7 @@ App.prototype.renderAppBar = function () { identities: this.props.identities, selected: this.props.currentView.context, network: this.props.network, + keyrings: this.props.keyrings, }, []), // hamburger diff --git a/ui/app/components/account-dropdowns.js b/ui/app/components/account-dropdowns.js index 7c24e70bd..b087a40d4 100644 --- a/ui/app/components/account-dropdowns.js +++ b/ui/app/components/account-dropdowns.js @@ -22,12 +22,19 @@ class AccountDropdowns extends Component { } renderAccounts () { - const { identities, selected } = this.props + const { identities, selected, keyrings } = this.props return Object.keys(identities).map((key, index) => { const identity = identities[key] const isSelected = identity.address === selected + const simpleAddress = identity.address.substring(2).toLowerCase() + + const keyring = keyrings.find((kr) => { + return kr.accounts.includes(simpleAddress) || + kr.accounts.includes(identity.address) + }) + return h( DropdownMenuItem, { @@ -51,6 +58,7 @@ class AccountDropdowns extends Component { }, }, ), + this.indicateIfLoose(keyring), h('span', { style: { marginLeft: '20px', @@ -67,6 +75,14 @@ class AccountDropdowns extends Component { }) } + indicateIfLoose (keyring) { + try { // Sometimes keyrings aren't loaded yet: + const type = keyring.type + const isLoose = type !== 'HD Key Tree' + return isLoose ? h('.keyring-label', 'LOOSE') : null + } catch (e) { return } + } + renderAccountSelector () { const { actions } = this.props const { accountSelectorActive } = this.state @@ -145,6 +161,8 @@ class AccountDropdowns extends Component { ) } + + renderAccountOptions () { const { actions } = this.props const { optionsMenuActive } = this.state @@ -278,6 +296,7 @@ AccountDropdowns.defaultProps = { AccountDropdowns.propTypes = { identities: PropTypes.objectOf(PropTypes.object), selected: PropTypes.string, + keyrings: PropTypes.array, } const mapDispatchToProps = (dispatch) => { diff --git a/ui/app/components/dropdown.js b/ui/app/components/dropdown.js index 34c7149ee..73710acc2 100644 --- a/ui/app/components/dropdown.js +++ b/ui/app/components/dropdown.js @@ -32,7 +32,7 @@ class Dropdown extends Component { 'style', ` li.dropdown-menu-item:hover { color:rgb(225, 225, 225); } - li.dropdown-menu-item { color: rgb(185, 185, 185); } + li.dropdown-menu-item { color: rgb(185, 185, 185); position: relative } ` ), ...children, diff --git a/ui/app/components/pending-msg-details.js b/ui/app/components/pending-msg-details.js index 16308d121..718a22de0 100644 --- a/ui/app/components/pending-msg-details.js +++ b/ui/app/components/pending-msg-details.js @@ -38,7 +38,7 @@ PendingMsgDetails.prototype.render = function () { // message data h('.tx-data.flex-column.flex-justify-center.flex-grow.select-none', [ - h('.flex-row.flex-space-between', [ + h('.flex-column.flex-space-between', [ h('label.font-small', 'MESSAGE'), h('span.font-small', msgParams.data), ]), diff --git a/ui/app/components/pending-msg.js b/ui/app/components/pending-msg.js index b2cac164a..834719c53 100644 --- a/ui/app/components/pending-msg.js +++ b/ui/app/components/pending-msg.js @@ -18,6 +18,9 @@ PendingMsg.prototype.render = function () { h('div', { key: msgData.id, + style: { + maxWidth: '350px', + }, }, [ // header @@ -32,10 +35,21 @@ PendingMsg.prototype.render = function () { style: { margin: '10px', }, - }, `Signing this message can have + }, [ + `Signing this message can have dangerous side effects. Only sign messages from sites you fully trust with your entire account. - This will be fixed in a future version.`), + This dangerous method will be removed in a future version. `, + h('a', { + href: 'https://medium.com/metamask/the-new-secure-way-to-sign-data-in-your-browser-6af9dd2a1527', + style: { color: 'rgb(247, 134, 28)' }, + onClick: (event) => { + event.preventDefault() + const url = 'https://medium.com/metamask/the-new-secure-way-to-sign-data-in-your-browser-6af9dd2a1527' + global.platform.openWindow({ url }) + }, + }, 'Read more here.'), + ]), // message details h(PendingTxDetails, state), diff --git a/ui/app/components/token-list.js b/ui/app/components/token-list.js index 5ea31ae8d..998ec901d 100644 --- a/ui/app/components/token-list.js +++ b/ui/app/components/token-list.js @@ -3,17 +3,6 @@ const h = require('react-hyperscript') const inherits = require('util').inherits const TokenTracker = require('eth-token-tracker') const TokenCell = require('./token-cell.js') -const normalizeAddress = require('eth-sig-util').normalize - -const defaultTokens = [] -const contracts = require('eth-contract-metadata') -for (const address in contracts) { - const contract = contracts[address] - if (contract.erc20) { - contract.address = address - defaultTokens.push(contract) - } -} module.exports = TokenList @@ -38,7 +27,24 @@ TokenList.prototype.render = function () { if (error) { log.error(error) - return this.message('There was a problem loading your token balances.') + return h('.hotFix', { + style: { + padding: '80px', + }, + }, [ + 'We had trouble loading your token balances. You can view them ', + h('span.hotFix', { + style: { + color: 'rgba(247, 134, 28, 1)', + cursor: 'pointer', + }, + onClick: () => { + global.platform.openWindow({ + url: `https://ethplorer.io/address/${userAddress}`, + }) + }, + }, 'here'), + ]) } const tokenViews = tokens.map((tokenData) => { @@ -89,7 +95,7 @@ TokenList.prototype.renderTokenStatusBar = function () { let msg if (tokens.length === 1) { msg = `You own 1 token` - } else if (tokens.length === 1) { + } else if (tokens.length > 1) { msg = `You own ${tokens.length} tokens` } else { msg = `No tokens found` @@ -153,7 +159,7 @@ TokenList.prototype.createFreshTokenTracker = function () { this.tracker = new TokenTracker({ userAddress, provider: global.ethereumProvider, - tokens: uniqueMergeTokens(defaultTokens, this.props.tokens), + tokens: this.props.tokens, pollingInterval: 8000, }) @@ -199,16 +205,3 @@ TokenList.prototype.componentWillUnmount = function () { this.tracker.stop() } -function uniqueMergeTokens (tokensA, tokensB) { - const uniqueAddresses = [] - const result = [] - tokensA.concat(tokensB).forEach((token) => { - const normal = normalizeAddress(token.address) - if (!uniqueAddresses.includes(normal)) { - uniqueAddresses.push(normal) - result.push(token) - } - }) - return result -} - diff --git a/ui/app/components/transaction-list-item.js b/ui/app/components/transaction-list-item.js index 9018bab06..5d5d0bcc5 100644 --- a/ui/app/components/transaction-list-item.js +++ b/ui/app/components/transaction-list-item.js @@ -60,16 +60,7 @@ TransactionListItem.prototype.render = function () { }, [ h('.identicon-wrapper.flex-column.flex-center.select-none', [ - h('.pop-hover', { - onClick: (event) => { - event.stopPropagation() - if (!isTx || isPending) return - var url = `https://metamask.github.io/eth-tx-viz/?tx=${transaction.hash}` - global.platform.openWindow({ url }) - }, - }, [ - h(TransactionIcon, { txParams, transaction, isTx, isMsg }), - ]), + h(TransactionIcon, { txParams, transaction, isTx, isMsg }), ]), h(Tooltip, { diff --git a/ui/app/css/lib.css b/ui/app/css/lib.css index 81647d1c1..f3acbee76 100644 --- a/ui/app/css/lib.css +++ b/ui/app/css/lib.css @@ -215,12 +215,13 @@ hr.horizontal-line { z-index: 1; font-size: 11px; background: rgba(255,0,0,0.8); - bottom: -47px; color: white; + bottom: 0px; + left: -8px; border-radius: 10px; height: 20px; min-width: 20px; - position: relative; + position: absolute; display: flex; align-items: center; justify-content: center; diff --git a/ui/app/info.js b/ui/app/info.js index 899841c83..c69d83715 100644 --- a/ui/app/info.js +++ b/ui/app/info.js @@ -103,7 +103,7 @@ InfoScreen.prototype.render = function () { [ h('div.fa.fa-support', [ h('a.info', { - href: 'http://metamask.consensyssupport.happyfox.com', + href: 'https://support.metamask.com', target: '_blank', }, 'Visit our Support Center'), ]), diff --git a/ui/app/reducers.js b/ui/app/reducers.js index 36045772f..6a2f44534 100644 --- a/ui/app/reducers.js +++ b/ui/app/reducers.js @@ -42,7 +42,10 @@ function rootReducer (state, action) { } window.logState = function () { - var stateString = JSON.stringify(window.METAMASK_CACHED_LOG_STATE, removeSeedWords, 2) + let state = window.METAMASK_CACHED_LOG_STATE + const version = global.platform.getVersion() + state.version = version + let stateString = JSON.stringify(state, removeSeedWords, 2) return stateString } diff --git a/ui/lib/account-link.js b/ui/lib/account-link.js index d061d0ad1..037d990fa 100644 --- a/ui/lib/account-link.js +++ b/ui/lib/account-link.js @@ -3,19 +3,19 @@ module.exports = function (address, network) { let link switch (net) { case 1: // main net - link = `http://etherscan.io/address/${address}` + link = `https://etherscan.io/address/${address}` break case 2: // morden test net - link = `http://morden.etherscan.io/address/${address}` + link = `https://morden.etherscan.io/address/${address}` break case 3: // ropsten test net - link = `http://ropsten.etherscan.io/address/${address}` + link = `https://ropsten.etherscan.io/address/${address}` break case 4: // rinkeby test net - link = `http://rinkeby.etherscan.io/address/${address}` + link = `https://rinkeby.etherscan.io/address/${address}` break case 42: // kovan test net - link = `http://kovan.etherscan.io/address/${address}` + link = `https://kovan.etherscan.io/address/${address}` break default: link = '' |