aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/tx-list.js
diff options
context:
space:
mode:
authorChi Kei Chan <chikeichan@gmail.com>2017-09-07 18:14:53 +0800
committerChi Kei Chan <chikeichan@gmail.com>2017-09-07 18:14:53 +0800
commit983fa2a11721aa7d1307ef76d516e25a50d0eedf (patch)
treebfe3cc63c9b3169e7116535f551749694073d714 /ui/app/components/tx-list.js
parent14b2f3e391752cca02c05ae0137e490bfdcdd7a7 (diff)
downloadtangerine-wallet-browser-983fa2a11721aa7d1307ef76d516e25a50d0eedf.tar.gz
tangerine-wallet-browser-983fa2a11721aa7d1307ef76d516e25a50d0eedf.tar.zst
tangerine-wallet-browser-983fa2a11721aa7d1307ef76d516e25a50d0eedf.zip
Add Contract Tx List Item; Update Token Tx on select
Diffstat (limited to 'ui/app/components/tx-list.js')
-rw-r--r--ui/app/components/tx-list.js42
1 files changed, 25 insertions, 17 deletions
diff --git a/ui/app/components/tx-list.js b/ui/app/components/tx-list.js
index 524808e2e..04d2eaa79 100644
--- a/ui/app/components/tx-list.js
+++ b/ui/app/components/tx-list.js
@@ -20,14 +20,9 @@ function TxList () {
Component.call(this)
}
-const contentDivider = h('div.tx-list-content-divider', {
- style: {},
-})
-
TxList.prototype.render = function () {
- const { txsToRender } = this.props
- console.log('transactions to render', txsToRender)
+ // console.log('transactions to render', txsToRender)
return h('div.flex-column.tx-list-container', {}, [
@@ -46,15 +41,31 @@ TxList.prototype.render = function () {
]),
- contentDivider,
-
- txsToRender.map((transaction) => {
- return this.renderTransactionListItem(transaction)
- }),
+ this.renderTranstions(),
])
}
+TxList.prototype.getAddressText = function (transaction) {
+ const {
+ txParams: { to },
+ } = transaction
+
+ return to
+ ? `${to.slice(0, 10)}...${to.slice(-4)}`
+ : 'Contract Published'
+}
+
+TxList.prototype.renderTranstions = function () {
+ const { txsToRender } = this.props
+
+ return txsToRender.length
+ ? txsToRender.map((transaction) => {
+ return this.renderTransactionListItem(transaction)
+ })
+ : h('div.tx-list-item.tx-list-item--empty', [ 'No Transactions' ])
+}
+
// TODO: Consider moving TxListItem into a separate component
TxList.prototype.renderTransactionListItem = function (transaction) {
const props = {
@@ -70,12 +81,10 @@ TxList.prototype.renderTransactionListItem = function (transaction) {
dateString,
} = props
- if (!address) return null
-
- return h('div', {
+ return h('div.tx-list-item', {
key: transaction.id,
}, [
- h('div.flex-column.tx-list-item-wrapper', {
+ h('div.flex-column.tx-list-item__wrapper', {
style: {},
}, [
@@ -105,7 +114,7 @@ TxList.prototype.renderTransactionListItem = function (transaction) {
style: {},
}, [
h('span.tx-list-account', {}, [
- `${address.slice(0, 10)}...${address.slice(-4)}`,
+ this.getAddressText(transaction),
]),
]),
@@ -134,7 +143,6 @@ TxList.prototype.renderTransactionListItem = function (transaction) {
]),
]),
- contentDivider,
])
}