nifty-wallet/old-ui/app/components/transaction-list-item-icon.js

59 lines
1.2 KiB
JavaScript
Raw Normal View History

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',
}, [
h('i.new-tx', {
2017-11-14 08:04:23 -08:00
style: {
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 {
return h('i.contract-small', {
2017-11-14 08:04:23 -08:00
style: {
marginLeft: '11px',
2017-11-14 08:04:23 -08:00
},
})
}
}