1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Cleanup txList and txView components

This commit is contained in:
sdtsui 2017-08-10 19:35:10 -07:00
parent 77b72ee33f
commit 96b186dfb2
2 changed files with 87 additions and 48 deletions

View File

@ -2,24 +2,17 @@ const Component = require('react').Component
const connect = require('react-redux').connect const connect = require('react-redux').connect
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const selectors = require('../selectors')
const Identicon = require('./identicon')
const valuesFor = require('../util').valuesFor const valuesFor = require('../util').valuesFor
module.exports = connect(mapStateToProps)(TxList) module.exports = connect(mapStateToProps)(TxList)
function mapStateToProps (state) { function mapStateToProps (state) {
const network = state.metamask.network
const unapprovedMsgs = valuesFor(state.metamask.unapprovedMsgs)
const shapeShiftTxList = (network === '1') ? state.metamask.shapeShiftTxList : undefined
const transactions = state.metamask.selectedAddressTxList || []
const txsToRender = !shapeShiftTxList ? transactions.concat(unapprovedMsgs) : transactions.concat(unapprovedMsgs, shapeShiftTxList)
.sort((a, b) => b.time - a.time)
return { return {
txsToRender, txsToRender: selectors.transactionsSelector(state),
conversionRate: state.metamask.conversionRate, conversionRate: selectors.conversionRateSelector(state),
} }
} }
@ -56,18 +49,9 @@ TxList.prototype.render = function () {
}, [ }, [
h('div', { h('div', {
style: { style: {}
borderBottom: '0.07em solid black',
paddingBottom: '0.015em',
}
}, 'TRANSACTIONS'), }, 'TRANSACTIONS'),
h('div', {
style: {
marginLeft: '1.25em',
}
}, 'TOKENS'),
]), ]),
]), ]),
@ -77,31 +61,77 @@ TxList.prototype.render = function () {
contentDivider, contentDivider,
this.renderTransactionListItem(), // this.renderTransactionListItem(),
contentDivider, // contentDivider,
// this.renderTransactionListItem(),
// contentDivider,
// this.renderTransactionListItem(),
// contentDivider,
// this.renderTransactionListItem(),
// contentDivider,
// this.renderTransactionListItem(),
// contentDivider,
// this.renderTransactionListItem(),
// contentDivider,
// this.renderTransactionListItem(),
// contentDivider,
// this.renderTransactionListItem(),
// contentDivider,
// this.renderTransactionListItem(),
// contentDivider,
// column
// tab row
// divider
// item
]) ])
} }
TxList.prototype.renderTransactionListItem = function () { TxList.prototype.renderTransactionListItem = function () {
// fake data
const props = {
dateString: 'Jul 01, 2017',
address: '0x82df11beb942beeed58d466fcb0f0791365c7684',
transactionStatus: 'Confirmed',
transactionAmount: '3'
}
const { address, transactionStatus, transactionAmount, dateString } = props
return h('div.flex-column', { return h('div.flex-column', {
style: { style: {
alignItems: 'stretch', alignItems: 'stretch',
justifyContent: 'flex-start',
margin: '0.6em 1.3em 0.6em 1.3em', margin: '0.6em 1.3em 0.6em 1.3em',
overflow: 'none'
} }
}, [ }, [
h('div', { h('div', {
style: { style: {
flexGrow: 1, flexGrow: 1,
flexShrink: 1,
flexBasis: 'auto',
marginTop: '0.3em', marginTop: '0.3em',
} }
}, 'Jul 01, 2017'), }, [
h('span', {}, [
dateString,
])
]),
h('div.flex-row', { h('div.flex-row', {
style: { style: {
@ -113,28 +143,49 @@ TxList.prototype.renderTransactionListItem = function () {
style: { style: {
flexGrow: 1, flexGrow: 1,
} }
}, 'icon'), }, [
h(Identicon, {
address,
diameter: 24,
})
]),
h('div', { h('div', {
style: { style: {
flexGrow: 3, flexGrow: 3,
} }
}, 'Hash'), }, [
h('span', {}, [
'0x82df11be...7684', //address
]),
]),
h('div', { h('div', {
style: { style: {
flexGrow: 5, flexGrow: 5,
} }
}, 'Status'), }, [
h('span', {}, [
transactionStatus,
]),
]),
h('div', { h('div.flex-column', {
style: { style: {
flexGrow: 2, flexGrow: 2,
} }
}, 'Details'), }, [
h('span', {}, [
transactionAmount,
]),
h('span', {}, [
'300 USD',
]),
]),
]) ])
]) ])
} }

View File

@ -4,18 +4,11 @@ const h = require('react-hyperscript')
const ethUtil = require('ethereumjs-util') const ethUtil = require('ethereumjs-util')
const inherits = require('util').inherits const inherits = require('util').inherits
const actions = require('../actions') const actions = require('../actions')
// slideout menu
const WalletView = require('./wallet-view') const WalletView = require('./wallet-view')
// balance component
const BalanceComponent = require('./balance-component') const BalanceComponent = require('./balance-component')
// tx list
const TxList = require('./tx-list') const TxList = require('./tx-list')
const Identicon = require('./identicon') const Identicon = require('./identicon')
// const AccountDropdowns = require('./account-dropdowns').AccountDropdowns
// const Content = require('./wallet-content-display')
module.exports = connect(mapStateToProps, mapDispatchToProps)(TxView) module.exports = connect(mapStateToProps, mapDispatchToProps)(TxView)
@ -68,14 +61,13 @@ TxView.prototype.render = function () {
this.props.sidebarOpen ? this.props.hideSidebar() : this.props.showSidebar() this.props.sidebarOpen ? this.props.hideSidebar() : this.props.showSidebar()
}, },
}, [ }, [
// burger
h('div.fa.fa-bars', { h('div.fa.fa-bars', {
style: { style: {
fontSize: '1.3em', fontSize: '1.3em',
}, },
}, []), }, []),
// account display
h('.identicon-wrapper.select-none', { h('.identicon-wrapper.select-none', {
style: { style: {
marginLeft: '0.9em', marginLeft: '0.9em',
@ -95,8 +87,6 @@ TxView.prototype.render = function () {
]), ]),
// laptop: flex-row, flex-center
// mobile: flex-column
h('div.hero-balance', { h('div.hero-balance', {
style: {}, style: {},
}, [ }, [
@ -106,8 +96,6 @@ TxView.prototype.render = function () {
style: {}, style: {},
}), }),
// laptop: 10vw?
// phone: 75vw?
h('div.flex-row.flex-center.hero-balance-buttons', { h('div.flex-row.flex-center.hero-balance-buttons', {
style: {}, style: {},
}, [ }, [