2017-11-14 08:04:23 -08:00
|
|
|
const Component = require('react').Component
|
|
|
|
const h = require('react-hyperscript')
|
|
|
|
const inherits = require('util').inherits
|
|
|
|
const Tooltip = require('./tooltip')
|
|
|
|
|
|
|
|
const Identicon = require('./identicon')
|
|
|
|
|
|
|
|
module.exports = TransactionIcon
|
|
|
|
|
|
|
|
inherits(TransactionIcon, Component)
|
|
|
|
function TransactionIcon () {
|
|
|
|
Component.call(this)
|
|
|
|
}
|
|
|
|
|
|
|
|
TransactionIcon.prototype.render = function () {
|
|
|
|
const { transaction, txParams, isMsg } = this.props
|
|
|
|
switch (transaction.status) {
|
|
|
|
case 'unapproved':
|
|
|
|
return h(!isMsg ? '.unapproved-tx-icon' : 'i.fa.fa-certificate.fa-lg')
|
|
|
|
|
|
|
|
case 'rejected':
|
|
|
|
case 'failed':
|
2018-07-31 07:42:04 -07:00
|
|
|
return h('i.tx-warning')
|
2017-11-14 08:04:23 -08:00
|
|
|
|
|
|
|
case 'submitted':
|
|
|
|
return h(Tooltip, {
|
|
|
|
title: 'Pending',
|
|
|
|
position: 'right',
|
|
|
|
}, [
|
2018-08-08 09:43:53 -07:00
|
|
|
h('i.new-tx', {
|
2017-11-14 08:04:23 -08:00
|
|
|
style: {
|
2018-08-08 09:43:53 -07:00
|
|
|
marginLeft: '10px',
|
2017-11-14 08:04:23 -08:00
|
|
|
},
|
|
|
|
}),
|
|
|
|
])
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isMsg) {
|
|
|
|
return h('i.fa.fa-certificate.fa-lg', {
|
|
|
|
style: {
|
2018-07-31 07:42:04 -07:00
|
|
|
width: '40px',
|
2017-11-14 08:04:23 -08:00
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
if (txParams.to) {
|
|
|
|
return h(Identicon, {
|
2018-07-31 07:42:04 -07:00
|
|
|
diameter: 40,
|
2017-11-14 08:04:23 -08:00
|
|
|
address: txParams.to || transaction.hash,
|
|
|
|
})
|
|
|
|
} else {
|
2018-08-08 09:43:53 -07:00
|
|
|
return h('i.contract-small', {
|
2017-11-14 08:04:23 -08:00
|
|
|
style: {
|
2018-08-08 09:43:53 -07:00
|
|
|
marginLeft: '11px',
|
2017-11-14 08:04:23 -08:00
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|