2016-05-26 02:18:04 +02:00
|
|
|
const Component = require('react').Component
|
2016-04-20 00:07:15 +02:00
|
|
|
const h = require('react-hyperscript')
|
2016-05-26 02:18:04 +02:00
|
|
|
const inherits = require('util').inherits
|
|
|
|
|
2016-05-26 02:57:08 +02:00
|
|
|
const TransactionListItem = require('./transaction-list-item')
|
2016-05-19 02:48:50 +02:00
|
|
|
|
2016-05-26 02:18:04 +02:00
|
|
|
module.exports = TransactionList
|
|
|
|
|
|
|
|
|
|
|
|
inherits(TransactionList, Component)
|
2016-06-21 22:18:32 +02:00
|
|
|
function TransactionList () {
|
2016-05-26 02:18:04 +02:00
|
|
|
Component.call(this)
|
|
|
|
}
|
|
|
|
|
2016-06-21 22:18:32 +02:00
|
|
|
TransactionList.prototype.render = function () {
|
2017-05-12 21:41:31 +02:00
|
|
|
const { transactions, network, unapprovedMsgs, conversionRate } = this.props
|
2017-01-10 20:52:25 +01:00
|
|
|
|
2016-08-18 19:40:35 +02:00
|
|
|
var shapeShiftTxList
|
2016-08-23 02:21:54 +02:00
|
|
|
if (network === '1') {
|
2016-08-18 19:40:35 +02:00
|
|
|
shapeShiftTxList = this.props.shapeShiftTxList
|
|
|
|
}
|
2017-01-28 01:11:59 +01:00
|
|
|
const txsToRender = !shapeShiftTxList ? transactions.concat(unapprovedMsgs) : transactions.concat(unapprovedMsgs, shapeShiftTxList)
|
2016-05-26 23:12:41 +02:00
|
|
|
.sort((a, b) => b.time - a.time)
|
2016-04-20 00:07:15 +02:00
|
|
|
|
2016-05-14 01:28:46 +02:00
|
|
|
return (
|
2016-05-06 23:42:08 +02:00
|
|
|
|
2017-07-26 03:22:31 +02:00
|
|
|
h('section.transaction-list.full-flex-height', {
|
2017-07-25 02:04:13 +02:00
|
|
|
style: {
|
2017-07-26 03:22:31 +02:00
|
|
|
justifyContent: 'center',
|
2017-07-25 02:04:13 +02:00
|
|
|
},
|
|
|
|
}, [
|
2016-05-06 23:42:08 +02:00
|
|
|
|
2016-05-19 02:48:50 +02:00
|
|
|
h('style', `
|
|
|
|
.transaction-list .transaction-list-item:not(:last-of-type) {
|
|
|
|
border-bottom: 1px solid #D4D4D4;
|
|
|
|
}
|
|
|
|
.transaction-list .transaction-list-item .ether-balance-label {
|
|
|
|
display: block !important;
|
|
|
|
font-size: small;
|
|
|
|
}
|
|
|
|
`),
|
|
|
|
|
2016-05-14 01:28:46 +02:00
|
|
|
h('.tx-list', {
|
2016-05-06 23:42:08 +02:00
|
|
|
style: {
|
|
|
|
overflowY: 'auto',
|
2017-07-25 02:04:13 +02:00
|
|
|
height: '100%',
|
2016-05-14 01:36:04 +02:00
|
|
|
padding: '0 20px',
|
2016-05-06 23:42:08 +02:00
|
|
|
textAlign: 'center',
|
|
|
|
},
|
2016-08-19 01:23:12 +02:00
|
|
|
}, [
|
2016-05-06 23:42:08 +02:00
|
|
|
|
2017-01-10 20:52:25 +01:00
|
|
|
txsToRender.length
|
|
|
|
? txsToRender.map((transaction, i) => {
|
2016-08-22 23:36:21 +02:00
|
|
|
let key
|
|
|
|
switch (transaction.key) {
|
|
|
|
case 'shapeshift':
|
|
|
|
const { depositAddress, time } = transaction
|
|
|
|
key = `shift-tx-${depositAddress}-${time}-${i}`
|
|
|
|
break
|
|
|
|
default:
|
|
|
|
key = `tx-${transaction.id}-${i}`
|
|
|
|
}
|
2016-05-26 02:57:08 +02:00
|
|
|
return h(TransactionListItem, {
|
2016-08-22 23:36:21 +02:00
|
|
|
transaction, i, network, key,
|
2017-05-12 21:41:31 +02:00
|
|
|
conversionRate,
|
2016-06-21 22:18:32 +02:00
|
|
|
showTx: (txId) => {
|
2016-05-26 23:32:45 +02:00
|
|
|
this.props.viewPendingTx(txId)
|
|
|
|
},
|
2016-05-26 02:57:08 +02:00
|
|
|
})
|
2016-08-22 23:36:21 +02:00
|
|
|
})
|
2017-07-26 03:22:31 +02:00
|
|
|
: h('.flex-center.full-flex-height', {
|
2016-06-21 22:56:04 +02:00
|
|
|
style: {
|
2016-08-19 01:23:12 +02:00
|
|
|
flexDirection: 'column',
|
2017-07-26 03:22:31 +02:00
|
|
|
justifyContent: 'center',
|
2016-06-21 22:56:04 +02:00
|
|
|
},
|
2016-08-19 01:23:12 +02:00
|
|
|
}, [
|
2017-07-26 03:22:31 +02:00
|
|
|
h('p', {
|
|
|
|
marginTop: '50px',
|
|
|
|
}, 'No transaction history.'),
|
2016-08-19 01:23:12 +02:00
|
|
|
]),
|
|
|
|
]),
|
2016-05-14 01:28:46 +02:00
|
|
|
])
|
|
|
|
)
|
2016-05-26 02:18:04 +02:00
|
|
|
}
|
2016-12-16 19:04:57 +01:00
|
|
|
|