1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-23 11:46:13 +02:00
metamask-extension/ui/app/components/tx-view.js

164 lines
3.1 KiB
JavaScript
Raw Normal View History

const Component = require('react').Component
const connect = require('react-redux').connect
const h = require('react-hyperscript')
const inherits = require('util').inherits
2017-08-02 22:32:02 +02:00
const actions = require('../actions')
// slideout menu
const SlideoutMenu = require('react-burger-menu').slide
const WalletView = require('./wallet-view')
// const Identicon = require('./identicon')
// const AccountDropdowns = require('./account-dropdowns').AccountDropdowns
// const Content = require('./wallet-content-display')
2017-08-02 22:32:02 +02:00
module.exports = connect(mapStateToProps, mapDispatchToProps)(TxView)
function mapStateToProps (state) {
return {
sidebarOpen: state.appState.sidebarOpen,
}
}
2017-08-02 22:32:02 +02:00
function mapDispatchToProps (dispatch) {
return {
showSidebar: () => {dispatch(actions.showSidebar())},
hideSidebar: () => {dispatch(actions.hideSidebar())},
}
}
2017-08-01 06:34:37 +02:00
2017-08-01 06:27:37 +02:00
const contentDivider = h('div', {
style: {
marginLeft: '1.3em',
marginRight: '1.3em',
height:'1px',
background:'#E7E7E7', // TODO: make custom color
},
})
inherits(TxView, Component)
function TxView () {
Component.call(this)
}
TxView.prototype.render = function () {
return h('div.tx-view.flex-column', {
style: {
// width: '66.666%',
flexGrow: 2,
flexShrink: 0,
flexBasis: '230px', // .666*345
// flexBasis: '400px',
height: '82vh',
background: '#FFFFFF',
}
}, [
2017-08-02 22:32:02 +02:00
// slideout - move to separate render func
h(SlideoutMenu, {
isOpen: this.props.sidebarOpen,
}, [
h(WalletView, {
responsiveDisplayClassname: '.phone-visible'
}),
]),
h('div.phone-visible.fa.fa-bars', {
2017-08-02 22:32:02 +02:00
onClick: () => {
this.props.sidebarOpen ? this.props.hideSidebar() : this.props.showSidebar()
}
}, []),
h('div.flex-row', {
2017-08-01 06:27:37 +02:00
style: {
2017-08-01 06:34:37 +02:00
margin: '1.8em 1.3em 0.8em 1.3em',
2017-08-01 06:27:37 +02:00
}
}, [
2017-08-01 06:27:37 +02:00
// tx-view-tab.js
h('div.flex-row', {
}, [
2017-08-01 06:27:37 +02:00
h('div', {
style: {
2017-08-01 06:27:37 +02:00
borderBottom: '0.07em solid black',
paddingBottom: '0.015em',
}
2017-08-01 06:27:37 +02:00
}, 'TRANSACTIONS'),
h('div', {
style: {
2017-08-01 06:34:37 +02:00
marginLeft: '1.25em',
2017-08-01 06:27:37 +02:00
}
}, 'TOKENS'),
2017-08-01 06:27:37 +02:00
]),
2017-08-01 06:34:37 +02:00
]),
contentDivider,
2017-08-01 06:27:37 +02:00
2017-08-01 07:00:18 +02:00
this.renderTransactionListItem(),
contentDivider,
this.renderTransactionListItem(),
contentDivider,
])
// column
// tab row
// divider
// item
}
2017-08-01 07:00:18 +02:00
TxView.prototype.renderTransactionListItem = function () {
return h('div.flex-column', {
style: {
alignItems: 'stretch',
margin: '0.6em 1.3em 0.6em 1.3em',
}
}, [
h('div', {
style: {
flexGrow: 1,
marginTop: '0.3em',
}
}, 'Jul 01, 2017'),
h('div.flex-row', {
style: {
alignItems: 'stretch',
}
}, [
h('div', {
style: {
flexGrow: 1,
}
}, 'icon'),
h('div', {
style: {
flexGrow: 3,
}
}, 'Hash'),
h('div', {
style: {
flexGrow: 5,
}
}, 'Status'),
h('div', {
style: {
flexGrow: 2,
}
}, 'Details'),
])
])
}