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-01-10 20:52:25 +01:00
|
|
|
const { transactions = [], network, unconfMsgs } = this.props
|
|
|
|
|
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-10 20:52:25 +01:00
|
|
|
const txsToRender = !shapeShiftTxList ? transactions.concat(unconfMsgs) : txsToRender.concat(unconfMsgs, 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
|
|
|
|
2016-05-14 01:28:46 +02:00
|
|
|
h('section.transaction-list', [
|
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('h3.flex-center.text-transform-uppercase', {
|
|
|
|
style: {
|
|
|
|
background: '#EBEBEB',
|
2016-05-14 02:02:33 +02:00
|
|
|
color: '#AEAEAE',
|
2016-06-30 21:43:28 +02:00
|
|
|
paddingTop: '4px',
|
|
|
|
paddingBottom: '4px',
|
2016-05-14 01:28:46 +02:00
|
|
|
},
|
|
|
|
}, [
|
2016-08-22 23:36:21 +02:00
|
|
|
'History',
|
2016-05-14 01:28:46 +02:00
|
|
|
]),
|
|
|
|
|
|
|
|
h('.tx-list', {
|
2016-05-06 23:42:08 +02:00
|
|
|
style: {
|
|
|
|
overflowY: 'auto',
|
2016-08-19 01:23:12 +02:00
|
|
|
height: '300px',
|
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,
|
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
|
|
|
})
|
2016-08-19 01:23:12 +02:00
|
|
|
: h('.flex-center', {
|
2016-06-21 22:56:04 +02:00
|
|
|
style: {
|
2016-08-19 01:23:12 +02:00
|
|
|
flexDirection: 'column',
|
2016-06-21 22:56:04 +02:00
|
|
|
height: '100%',
|
|
|
|
},
|
2016-08-19 01:23:12 +02:00
|
|
|
}, [
|
2016-12-16 19:04:57 +01:00
|
|
|
'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
|
|
|
|