diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-08-19 07:23:12 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-08-19 07:23:12 +0800 |
commit | bd9d89826c2bbd6e91a088040b7708de89658d1a (patch) | |
tree | 45a339a83cd561c30f997eddf2364ac54bbd6c48 | |
parent | 7389f9d0a0e1f798607ea8eea25583f8af854358 (diff) | |
download | tangerine-wallet-browser-bd9d89826c2bbd6e91a088040b7708de89658d1a.tar tangerine-wallet-browser-bd9d89826c2bbd6e91a088040b7708de89658d1a.tar.gz tangerine-wallet-browser-bd9d89826c2bbd6e91a088040b7708de89658d1a.tar.bz2 tangerine-wallet-browser-bd9d89826c2bbd6e91a088040b7708de89658d1a.tar.lz tangerine-wallet-browser-bd9d89826c2bbd6e91a088040b7708de89658d1a.tar.xz tangerine-wallet-browser-bd9d89826c2bbd6e91a088040b7708de89658d1a.tar.zst tangerine-wallet-browser-bd9d89826c2bbd6e91a088040b7708de89658d1a.zip |
Added `view more` button to transaction list
Visible at the end of the transaction list, or if no transactions are listed, displayed right after the `No Transactions` message.
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | test/unit/account-link-test.js | 12 | ||||
-rw-r--r-- | ui/app/account-detail.js | 1 | ||||
-rw-r--r-- | ui/app/components/transaction-list.js | 33 | ||||
-rw-r--r-- | ui/lib/account-link.js | 18 |
5 files changed, 59 insertions, 7 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index b7833e9d1..1c5c457b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ ## Current Master - Added feature to reflect current conversion rates of current vault balance. +- Transaction history now has a hard limit. +- Added a link to view more account info after transaction history. ## 2.8.0 2016-08-15 diff --git a/test/unit/account-link-test.js b/test/unit/account-link-test.js new file mode 100644 index 000000000..39889b6be --- /dev/null +++ b/test/unit/account-link-test.js @@ -0,0 +1,12 @@ +var assert = require('assert') +var linkGen = require('../../ui/lib/account-link') + +describe('account-link', function() { + + it('adds testnet prefix to morden test network', function() { + var result = linkGen('account', '2') + assert.notEqual(result.indexOf('testnet'), -1, 'testnet injected') + assert.notEqual(result.indexOf('account'), -1, 'account included') + }) + +}) diff --git a/ui/app/account-detail.js b/ui/app/account-detail.js index 2c98af0dd..cafc03503 100644 --- a/ui/app/account-detail.js +++ b/ui/app/account-detail.js @@ -248,6 +248,7 @@ AccountDetailScreen.prototype.transactionList = function () { network, unconfTxs, unconfMsgs, + address, viewPendingTx: (txId) => { this.props.dispatch(actions.viewPendingTx(txId)) }, diff --git a/ui/app/components/transaction-list.js b/ui/app/components/transaction-list.js index 886aa7c00..eae1965ff 100644 --- a/ui/app/components/transaction-list.js +++ b/ui/app/components/transaction-list.js @@ -1,6 +1,8 @@ const Component = require('react').Component const h = require('react-hyperscript') const inherits = require('util').inherits +const genAccountLink = require('../../lib/account-link') +const extension = require('../../../app/scripts/lib/extension') const TransactionListItem = require('./transaction-list-item') @@ -13,9 +15,10 @@ function TransactionList () { } TransactionList.prototype.render = function () { - const { txsToRender, network, unconfMsgs } = this.props + const { txsToRender, network, unconfMsgs, address } = this.props const transactions = txsToRender.concat(unconfMsgs) .sort((a, b) => b.time - a.time) + const accountLink = genAccountLink(address, network) return ( @@ -45,11 +48,11 @@ TransactionList.prototype.render = function () { h('.tx-list', { style: { overflowY: 'auto', - height: '305px', + height: '300px', padding: '0 20px', textAlign: 'center', }, - }, ( + }, [ transactions.length ? transactions.map((transaction, i) => { @@ -59,13 +62,29 @@ TransactionList.prototype.render = function () { this.props.viewPendingTx(txId) }, }) - }) - : [h('.flex-center', { + }).concat(viewMoreButton(accountLink)) + : h('.flex-center', { style: { + flexDirection: 'column', height: '100%', }, - }, 'No transaction history...')] - )), + }, [ + 'No transaction history.', + viewMoreButton(accountLink), + ]), + ]), ]) ) } + +function viewMoreButton(url) { + return url ? h('button', { + style: { + margin: '10px', + }, + onClick: (ev) => { + ev.preventDefault() + extension.tabs.create({ url }) + } + }, 'View More') : null +} diff --git a/ui/lib/account-link.js b/ui/lib/account-link.js new file mode 100644 index 000000000..eb958e22d --- /dev/null +++ b/ui/lib/account-link.js @@ -0,0 +1,18 @@ +module.exports = function(address, network) { + const net = parseInt(network) + let link + + switch (net) { + case 1: // main net + link = `http://etherscan.io/address/${address}` + break + case 2: // morden test net + link = `http://testnet.etherscan.io/address/${address}` + break + default: + link = '' + break + } + + return link +} |