2017-07-31 06:25:32 +02:00
|
|
|
const Component = require('react').Component
|
|
|
|
const connect = require('react-redux').connect
|
|
|
|
const h = require('react-hyperscript')
|
|
|
|
const inherits = require('util').inherits
|
|
|
|
const Identicon = require('./identicon')
|
|
|
|
const AccountDropdowns = require('./account-dropdowns').AccountDropdowns
|
2017-07-31 07:30:55 +02:00
|
|
|
const Content = require('./wallet-content-display')
|
2017-08-01 08:21:11 +02:00
|
|
|
const actions = require('../actions')
|
2017-07-31 06:25:32 +02:00
|
|
|
|
2017-08-01 08:21:11 +02:00
|
|
|
module.exports = connect(mapStateToProps, mapDispatchToProps)(WalletView)
|
2017-07-31 06:25:32 +02:00
|
|
|
|
|
|
|
function mapStateToProps (state) {
|
|
|
|
return {
|
|
|
|
network: state.metamask.network,
|
2017-08-02 23:17:58 +02:00
|
|
|
sidebarOpen: state.appState.sidebarOpen,
|
2017-08-07 06:54:42 +02:00
|
|
|
identities: state.metamask.identities,
|
2017-07-31 06:25:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-01 08:21:11 +02:00
|
|
|
function mapDispatchToProps (dispatch) {
|
|
|
|
return {
|
|
|
|
showSendPage: () => {dispatch(actions.showSendPage())},
|
2017-08-02 23:17:58 +02:00
|
|
|
hideSidebar: () => {dispatch(actions.hideSidebar())},
|
2017-08-01 08:21:11 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-31 06:25:32 +02:00
|
|
|
inherits(WalletView, Component)
|
|
|
|
function WalletView () {
|
|
|
|
Component.call(this)
|
|
|
|
}
|
|
|
|
|
|
|
|
const noop = () => {}
|
|
|
|
|
|
|
|
WalletView.prototype.render = function () {
|
2017-08-06 23:55:28 +02:00
|
|
|
const selected = '0x82df11beb942BEeeD58d466fCb0F0791365C7684' // TODO: remove fake address
|
2017-08-07 06:54:42 +02:00
|
|
|
const { network, responsiveDisplayClassname, style, identities } = this.props
|
2017-07-31 06:25:32 +02:00
|
|
|
|
2017-08-02 22:03:36 +02:00
|
|
|
return h('div.wallet-view.flex-column' + (responsiveDisplayClassname || ''), {
|
2017-08-07 05:47:59 +02:00
|
|
|
style: {},
|
2017-07-31 06:25:32 +02:00
|
|
|
}, [
|
|
|
|
|
2017-07-31 07:10:59 +02:00
|
|
|
// TODO: Separate component: wallet account details
|
2017-08-07 04:50:14 +02:00
|
|
|
h('div.flex-column', {
|
|
|
|
style: {}
|
2017-07-31 06:25:32 +02:00
|
|
|
}, [
|
|
|
|
|
2017-08-07 06:54:42 +02:00
|
|
|
h('div.flex-row.account-options-menu', {
|
|
|
|
}, [
|
|
|
|
|
|
|
|
h(AccountDropdowns, {
|
|
|
|
// selected,
|
|
|
|
// network,
|
|
|
|
// identities: props.identities,
|
|
|
|
enableAccountOptions: true,
|
|
|
|
}, []),
|
|
|
|
|
2017-07-31 06:25:32 +02:00
|
|
|
]),
|
|
|
|
|
2017-08-07 06:54:42 +02:00
|
|
|
h('div.flex-column.flex-center', {
|
2017-08-07 07:30:27 +02:00
|
|
|
style: {
|
2017-08-07 08:12:40 +02:00
|
|
|
// constrains size of absolutely positioned wrappers
|
2017-08-07 07:30:27 +02:00
|
|
|
position: 'relative',
|
|
|
|
},
|
2017-07-31 06:25:32 +02:00
|
|
|
}, [
|
2017-08-07 06:54:42 +02:00
|
|
|
|
|
|
|
h('.identicon-wrapper.select-none', {
|
|
|
|
style: {
|
|
|
|
marginBottom: '1%',
|
|
|
|
},
|
|
|
|
}, [
|
|
|
|
h(Identicon, {
|
|
|
|
diameter: 54,
|
|
|
|
address: selected,
|
|
|
|
}),
|
|
|
|
]),
|
|
|
|
|
|
|
|
h('span.account-name', {
|
|
|
|
style: {}
|
|
|
|
}, [
|
|
|
|
'Account 1'
|
|
|
|
]),
|
|
|
|
|
2017-08-07 07:30:27 +02:00
|
|
|
h(AccountDropdowns, {
|
2017-08-07 06:54:42 +02:00
|
|
|
style: {
|
|
|
|
position: 'absolute',
|
2017-08-07 08:12:40 +02:00
|
|
|
left: 'calc(50% + 28px + 5.5px)',
|
|
|
|
// left: '42px',
|
|
|
|
// top: '-10px'
|
|
|
|
// left: '66.5%',
|
2017-08-07 07:30:27 +02:00
|
|
|
top: '19.5%',
|
2017-08-07 06:54:42 +02:00
|
|
|
},
|
2017-08-07 07:30:27 +02:00
|
|
|
selected,
|
|
|
|
network,
|
|
|
|
identities,
|
|
|
|
enableAccountsSelector: true,
|
|
|
|
}, []),
|
2017-07-31 06:25:32 +02:00
|
|
|
]),
|
|
|
|
|
|
|
|
h(
|
|
|
|
AccountDropdowns,
|
|
|
|
{
|
|
|
|
style: {
|
|
|
|
marginLeft: 'auto',
|
|
|
|
cursor: 'pointer',
|
|
|
|
},
|
|
|
|
selected,
|
2017-07-31 06:35:41 +02:00
|
|
|
network, // TODO: this prop could be in the account dropdown container
|
2017-07-31 06:25:32 +02:00
|
|
|
identities: {},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
|
2017-07-31 07:10:59 +02:00
|
|
|
]),
|
2017-07-31 06:25:32 +02:00
|
|
|
|
2017-08-01 05:22:15 +02:00
|
|
|
h(Content, {
|
|
|
|
title: 'Wallet',
|
|
|
|
amount: '1001.124 ETH',
|
|
|
|
fiatValue: '$300,000.00 USD',
|
|
|
|
active: true,
|
|
|
|
}),
|
2017-07-31 07:10:59 +02:00
|
|
|
|
|
|
|
// Wallet contents
|
2017-07-31 07:30:55 +02:00
|
|
|
h(Content, {
|
|
|
|
title: "Total Token Balance",
|
|
|
|
amount: "45.439 ETH",
|
|
|
|
fiatValue: "$13,000.00 USD",
|
|
|
|
active: false,
|
2017-08-01 05:22:15 +02:00
|
|
|
style: {
|
|
|
|
marginTop: '1.3em',
|
|
|
|
}
|
2017-07-31 07:30:55 +02:00
|
|
|
})
|
2017-07-31 06:25:32 +02:00
|
|
|
|
|
|
|
])
|
|
|
|
}
|