1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-24 11:01:41 +01:00
metamask-extension/ui/app/components/tx-list.js

167 lines
3.1 KiB
JavaScript
Raw Normal View History

2017-08-09 12:10:51 +02:00
const Component = require('react').Component
const connect = require('react-redux').connect
const h = require('react-hyperscript')
const inherits = require('util').inherits
2017-08-11 04:35:10 +02:00
const selectors = require('../selectors')
const Identicon = require('./identicon')
2017-08-09 12:10:51 +02:00
const valuesFor = require('../util').valuesFor
module.exports = connect(mapStateToProps)(TxList)
function mapStateToProps (state) {
2017-08-09 12:10:51 +02:00
return {
2017-08-11 04:35:10 +02:00
txsToRender: selectors.transactionsSelector(state),
conversionRate: selectors.conversionRateSelector(state),
2017-08-09 12:10:51 +02:00
}
}
inherits(TxList, Component)
function TxList () {
Component.call(this)
}
const contentDivider = h('div.tx-list-content-divider', {
style: {},
2017-08-09 12:10:51 +02:00
})
TxList.prototype.render = function () {
const { txsToRender, conversionRate } = this.props
2017-08-09 12:10:51 +02:00
console.log('transactions to render', txsToRender)
2017-08-09 12:10:51 +02:00
return h('div.flex-column.tx-list-container', {}, [
h('div.flex-row.tx-list-header-wrapper', {
style: {},
2017-08-09 12:10:51 +02:00
}, [
h('div.flex-row.tx-list-header', {
2017-08-09 12:10:51 +02:00
}, [
h('div', {
2017-08-11 04:35:10 +02:00
style: {}
2017-08-09 12:10:51 +02:00
}, 'TRANSACTIONS'),
]),
2017-08-09 12:10:51 +02:00
]),
contentDivider,
this.renderTransactionListItem(),
contentDivider,
this.renderTransactionListItem(),
2017-08-09 12:10:51 +02:00
contentDivider,
2017-08-11 04:35:10 +02:00
this.renderTransactionListItem(),
2017-08-11 04:35:10 +02:00
contentDivider,
2017-08-11 04:35:10 +02:00
this.renderTransactionListItem(),
2017-08-11 04:35:10 +02:00
contentDivider,
2017-08-11 04:35:10 +02:00
this.renderTransactionListItem(),
2017-08-11 04:35:10 +02:00
contentDivider,
2017-08-11 04:35:10 +02:00
this.renderTransactionListItem(),
2017-08-11 04:35:10 +02:00
contentDivider,
2017-08-11 04:35:10 +02:00
this.renderTransactionListItem(),
2017-08-11 04:35:10 +02:00
contentDivider,
2017-08-11 04:35:10 +02:00
this.renderTransactionListItem(),
2017-08-11 04:35:10 +02:00
contentDivider,
2017-08-11 04:35:10 +02:00
this.renderTransactionListItem(),
2017-08-11 04:35:10 +02:00
contentDivider,
2017-08-11 04:35:10 +02:00
this.renderTransactionListItem(),
2017-08-11 04:35:10 +02:00
contentDivider,
2017-08-09 12:10:51 +02:00
])
}
TxList.prototype.renderTransactionListItem = function () {
2017-08-11 04:35:10 +02:00
// fake data
const props = {
dateString: 'Jul 01, 2017',
address: '0x82df11beb942beeed58d466fcb0f0791365c7684',
transactionStatus: 'Confirmed',
transactionAmount: '+ 3 ETH'
2017-08-11 04:35:10 +02:00
}
const { address, transactionStatus, transactionAmount, dateString } = props
2017-08-11 04:55:01 +02:00
return h('div.flex-column.tx-list-item-wrapper', {
style: {}
2017-08-09 12:10:51 +02:00
}, [
2017-08-11 04:55:01 +02:00
h('div.tx-list-date-wrapper', {
style: {}
2017-08-11 04:35:10 +02:00
}, [
2017-08-11 04:55:01 +02:00
h('span.tx-list-date', {}, [
2017-08-11 04:35:10 +02:00
dateString,
])
]),
2017-08-09 12:10:51 +02:00
2017-08-11 04:55:01 +02:00
h('div.flex-row.tx-list-content-wrapper', {
style: {}
2017-08-09 12:10:51 +02:00
}, [
2017-08-11 04:55:01 +02:00
h('div.tx-list-identicon-wrapper', {
style: {}
2017-08-11 04:35:10 +02:00
}, [
h(Identicon, {
address,
diameter: 24,
2017-08-11 04:35:10 +02:00
})
]),
2017-08-09 12:10:51 +02:00
h('div.tx-list-account-and-status-wrapper', {}, [
h('div.tx-list-account-wrapper', {
style: {}
}, [
h('span.tx-list-account', {}, [
'0x82df11be...7684', //address
]),
2017-08-11 04:35:10 +02:00
]),
2017-08-09 12:10:51 +02:00
h('div.tx-list-status-wrapper', {
style: {}
}, [
h('span.tx-list-status', {}, [
transactionStatus,
]),
2017-08-11 04:35:10 +02:00
]),
]),
2017-08-09 12:10:51 +02:00
2017-08-11 04:55:01 +02:00
h('div.flex-column.tx-list-details-wrapper', {
style: {}
2017-08-11 04:35:10 +02:00
}, [
2017-08-09 12:10:51 +02:00
h('span.tx-list-value', {}, [
2017-08-11 04:35:10 +02:00
transactionAmount,
]),
h('span.tx-list-fiat-value', {}, [
'+ $300 USD',
2017-08-11 04:35:10 +02:00
]),
2017-08-09 12:10:51 +02:00
2017-08-11 04:35:10 +02:00
]),
])
2017-08-09 12:10:51 +02:00
])
}