diff options
author | Dan <danjm.com@gmail.com> | 2017-09-08 00:18:13 +0800 |
---|---|---|
committer | Chi Kei Chan <chikeichan@gmail.com> | 2017-09-08 01:25:56 +0800 |
commit | eabbfb83197ce948f59e0762a30d1d30266ad11c (patch) | |
tree | 37660c7930c2d8e4151d89fa39956a168d1088df /ui/app | |
parent | 3e6b619bd8862d27b18f22ff3645fa96a96b185b (diff) | |
download | tangerine-wallet-browser-eabbfb83197ce948f59e0762a30d1d30266ad11c.tar tangerine-wallet-browser-eabbfb83197ce948f59e0762a30d1d30266ad11c.tar.gz tangerine-wallet-browser-eabbfb83197ce948f59e0762a30d1d30266ad11c.tar.bz2 tangerine-wallet-browser-eabbfb83197ce948f59e0762a30d1d30266ad11c.tar.lz tangerine-wallet-browser-eabbfb83197ce948f59e0762a30d1d30266ad11c.tar.xz tangerine-wallet-browser-eabbfb83197ce948f59e0762a30d1d30266ad11c.tar.zst tangerine-wallet-browser-eabbfb83197ce948f59e0762a30d1d30266ad11c.zip |
Link user from transaction list to etherscan if they have a transaction hash.
Diffstat (limited to 'ui/app')
-rw-r--r-- | ui/app/components/tx-list-item.js | 4 | ||||
-rw-r--r-- | ui/app/components/tx-list.js | 27 | ||||
-rw-r--r-- | ui/app/css/itcss/components/transaction-list.scss | 7 |
3 files changed, 34 insertions, 4 deletions
diff --git a/ui/app/components/tx-list-item.js b/ui/app/components/tx-list-item.js index 85699ceeb..62127b153 100644 --- a/ui/app/components/tx-list-item.js +++ b/ui/app/components/tx-list-item.js @@ -1,6 +1,7 @@ const Component = require('react').Component const h = require('react-hyperscript') const inherits = require('util').inherits +const prefixForNetwork = require('../../lib/etherscan-prefix-for-network') const Identicon = require('./identicon') module.exports = TxListItem @@ -24,7 +25,7 @@ TxListItem.prototype.render = function () { dateString, address, transactionAmount, - className + className, } = this.props return h(`div${className || ''}`, { @@ -89,4 +90,3 @@ TxListItem.prototype.render = function () { ]) // holding on icon from design ]) } - diff --git a/ui/app/components/tx-list.js b/ui/app/components/tx-list.js index 654b95416..6a0849daf 100644 --- a/ui/app/components/tx-list.js +++ b/ui/app/components/tx-list.js @@ -2,6 +2,7 @@ const Component = require('react').Component const connect = require('react-redux').connect const h = require('react-hyperscript') const inherits = require('util').inherits +const prefixForNetwork = require('../../lib/etherscan-prefix-for-network') const selectors = require('../selectors') const TxListItem = require('./tx-list-item') const { formatBalance, formatDate } = require('../util') @@ -71,6 +72,8 @@ TxList.prototype.renderTransactionListItem = function (transaction) { transactionStatus: transaction.status, transactionAmount: formatBalance(transaction.txParams.value, 6), transActionId: transaction.id, + transactionHash: transaction.hash, + transactionNetworkId: transaction.metamaskNetworkId, } const { @@ -79,6 +82,8 @@ TxList.prototype.renderTransactionListItem = function (transaction) { transactionAmount, dateString, transActionId, + transactionHash, + transactionNetworkId, } = props const { showConfTxPage } = this.props @@ -90,13 +95,33 @@ TxList.prototype.renderTransactionListItem = function (transaction) { dateString, address, transactionAmount, + transactionHash, + className: '.tx-list-clickable', } if (transactionStatus === 'unapproved') { opts.onClick = () => showConfTxPage({id: transActionId}) - opts.className = '.tx-list-pending-item-container' + opts.className += '.tx-list-pending-item-container' + } + else if (transactionHash) { + opts.onClick = () => this.view(transactionHash, transactionNetworkId) } return h(TxListItem, opts) } +TxList.prototype.view = function (txHash, network) { + const url = etherscanLinkFor(txHash, network) + if (url) { + navigateTo(url) + } +} + +function navigateTo (url) { + global.platform.openWindow({ url }) +} + +function etherscanLinkFor (txHash, network) { + const prefix = prefixForNetwork(network) + return `https://${prefix}etherscan.io/tx/${txHash}` +} diff --git a/ui/app/css/itcss/components/transaction-list.scss b/ui/app/css/itcss/components/transaction-list.scss index ba2f631ae..f3bba574e 100644 --- a/ui/app/css/itcss/components/transaction-list.scss +++ b/ui/app/css/itcss/components/transaction-list.scss @@ -71,7 +71,7 @@ } } -.tx-list-pending-item-container { +.tx-list-clickable { cursor: pointer; &:hover { @@ -79,6 +79,11 @@ } } +.tx-list-pending-item-container { + cursor: pointer; + opacity: 0.5; +} + .tx-list-date-wrapper { flex: 1 1 auto; |