diff options
author | kumavis <kumavis@users.noreply.github.com> | 2016-05-20 10:15:00 +0800 |
---|---|---|
committer | kumavis <kumavis@users.noreply.github.com> | 2016-05-20 10:15:00 +0800 |
commit | b0f92e05b12fa5cde453c7b53a19f6b0bca74f75 (patch) | |
tree | 648f386eeaf13729de893c50281d7809f6dd25a9 /ui/app/components/transaction-list.js | |
parent | 5b30f07d596c9ec24481d6aba5e9f7985c0a4384 (diff) | |
parent | 2a6d6fcd158d0e108b50c51a6deb5405505eeda6 (diff) | |
download | tangerine-wallet-browser-b0f92e05b12fa5cde453c7b53a19f6b0bca74f75.tar.gz tangerine-wallet-browser-b0f92e05b12fa5cde453c7b53a19f6b0bca74f75.tar.zst tangerine-wallet-browser-b0f92e05b12fa5cde453c7b53a19f6b0bca74f75.zip |
Merge pull request #198 from MetaMask/FailedTxIndication
Tx list items should indicate when they failed.
Diffstat (limited to 'ui/app/components/transaction-list.js')
-rw-r--r-- | ui/app/components/transaction-list.js | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/ui/app/components/transaction-list.js b/ui/app/components/transaction-list.js index 5e9ec8b87..f85aab70f 100644 --- a/ui/app/components/transaction-list.js +++ b/ui/app/components/transaction-list.js @@ -57,39 +57,17 @@ module.exports = function(transactions, network) { ) - function renderTransaction(transaction){ - - var panelOpts = { - key: `tx-${transaction.hash}`, - identiconKey: transaction.txParams.to, - onClick: (event) => { - var url = explorerLink(transaction.hash, parseInt(network)) - chrome.tabs.create({ url }) - }, - attributes: [ - { - key: 'TIME', - value: formatDate(transaction.time), - }, - { - key: 'TO', - value: addressSummary(transaction.txParams.to), - }, - { - key: 'VALUE', - value: formatBalance(transaction.txParams.value), - }, - ] - } + function renderTransaction(transaction, i){ var txParams = transaction.txParams var date = formatDate(transaction.time) return ( - h('.transaction-list-item.flex-row.flex-space-between.cursor-pointer', { - key: `tx-${transaction.hash}`, + h(`.transaction-list-item.flex-row.flex-space-between${transaction.hash ? '.pointer' : ''}`, { + key: `tx-${transaction.id + i}`, onClick: (event) => { + if (!transaction.hash) return var url = explorerLink(transaction.hash, parseInt(network)) chrome.tabs.create({ url }) }, @@ -107,7 +85,7 @@ module.exports = function(transactions, network) { h('div', date), - recipientField(txParams), + recipientField(txParams, transaction), ]), @@ -120,14 +98,17 @@ module.exports = function(transactions, network) { } } -function recipientField(txParams) { +function recipientField(txParams, transaction) { if (txParams.to) { return h('div', { style: { fontSize: 'small', color: '#ABA9AA', }, - }, addressSummary(txParams.to)) + }, [ + addressSummary(txParams.to), + failIfFailed(transaction), + ]) } else { @@ -136,7 +117,11 @@ function recipientField(txParams) { fontSize: 'small', color: '#ABA9AA', }, - }, 'Contract Published') + },[ + 'Contract Published', + failIfFailed(transaction), + ]) + } } @@ -145,6 +130,14 @@ function formatDate(date){ } function identicon(txParams, transaction) { + if (transaction.status === 'rejected') { + return h('i.fa.fa-exclamation-triangle.fa-lg.error', { + style: { + width: '24px', + } + }) + } + if (txParams.to) { return h(Identicon, { diameter: 24, @@ -158,3 +151,9 @@ function identicon(txParams, transaction) { }) } } + +function failIfFailed(transaction) { + if (transaction.status === 'rejected') { + return h('span.error', ' (Failed)') + } +} |