diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-05-24 05:56:34 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-05-24 05:56:34 +0800 |
commit | 45916175d7281ff0eba25fcb5918a01e02baad7c (patch) | |
tree | 1b9f6b03e3a11e77f7b50a01360c954f1bc2b8db /ui/app/accounts | |
parent | a8540d379bfec93f64ab334fb33f18d76b92f581 (diff) | |
download | tangerine-wallet-browser-45916175d7281ff0eba25fcb5918a01e02baad7c.tar tangerine-wallet-browser-45916175d7281ff0eba25fcb5918a01e02baad7c.tar.gz tangerine-wallet-browser-45916175d7281ff0eba25fcb5918a01e02baad7c.tar.bz2 tangerine-wallet-browser-45916175d7281ff0eba25fcb5918a01e02baad7c.tar.lz tangerine-wallet-browser-45916175d7281ff0eba25fcb5918a01e02baad7c.tar.xz tangerine-wallet-browser-45916175d7281ff0eba25fcb5918a01e02baad7c.tar.zst tangerine-wallet-browser-45916175d7281ff0eba25fcb5918a01e02baad7c.zip |
Move account list panel to component
Diffstat (limited to 'ui/app/accounts')
-rw-r--r-- | ui/app/accounts/account-panel.js | 19 | ||||
-rw-r--r-- | ui/app/accounts/index.js | 54 |
2 files changed, 28 insertions, 45 deletions
diff --git a/ui/app/accounts/account-panel.js b/ui/app/accounts/account-panel.js new file mode 100644 index 000000000..9e4eca20f --- /dev/null +++ b/ui/app/accounts/account-panel.js @@ -0,0 +1,19 @@ +const Component = require('react').Component +const h = require('react-hyperscript') +const inherits = require('util').inherits + +module.exports = NewComponent + + +inherits(NewComponent, Component) +function NewComponent() { + Component.call(this) +} + +NewComponent.prototype.render = function() { + var state = this.props + + return ( + h('span', 'Placeholder component') + ) +} diff --git a/ui/app/accounts/index.js b/ui/app/accounts/index.js index 0f1e050c3..9ddcfdcab 100644 --- a/ui/app/accounts/index.js +++ b/ui/app/accounts/index.js @@ -10,6 +10,7 @@ const valuesFor = require('../util').valuesFor const addressSummary = require('../util').addressSummary const formatBalance = require('../util').formatBalance const findDOMNode = require('react-dom').findDOMNode +const AccountPanel = require('./account-panel') module.exports = connect(mapStateToProps)(AccountsScreen) @@ -64,7 +65,14 @@ AccountsScreen.prototype.render = function() { } }, [ - identityList.map(renderAccountPanel), + identityList.map((identity) => { + return h(AccountPanel, { + identity, + selectedAddress: this.props.selectedAddress, + accounts: this.props.accounts, + onShowDetail: this.onShowDetail.bind(this), + }) + }), h('hr.horizontal-line', {key: 'horizontal-line1'}), h('div.footer.hover-white.pointer', { @@ -99,50 +107,6 @@ AccountsScreen.prototype.render = function() { ), ]) ) - - function renderAccountPanel(identity){ - var mayBeFauceting = identity.mayBeFauceting - var isSelected = state.selectedAddress === identity.address - var account = state.accounts[identity.address] - var isFauceting = mayBeFauceting && account.balance === '0x0' - var componentState = extend(actions, { - identity: identity, - account: account, - isSelected: false, - isFauceting: isFauceting, - }) - const selectedClass = isSelected ? '.selected' : '' - - return ( - h(`.accounts-list-option.flex-row.flex-space-between.pointer.hover-white${selectedClass}`, { - key: `account-panel-${identity.address}`, - style: { - flex: '1 0 auto', - }, - onClick: (event) => actions.onShowDetail(identity.address, event), - }, [ - - h('.identicon-wrapper.flex-column.flex-center.select-none', [ - h(Identicon, { - address: identity.address - }), - ]), - - // account address, balance - h('.identity-data.flex-column.flex-justify-center.flex-grow.select-none', [ - - h('span', identity.name), - h('span.font-small', addressSummary(identity.address)), - // h('span.font-small', formatBalance(account.balance)), - h(EtherBalance, { - value: account.balance, - }), - - ]), - - ]) - ) - } } // If a new account was revealed, scroll to the bottom |