diff options
Diffstat (limited to 'ui/app/accounts/index.js')
-rw-r--r-- | ui/app/accounts/index.js | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/ui/app/accounts/index.js b/ui/app/accounts/index.js index 65cf82b2c..5ab31a1c0 100644 --- a/ui/app/accounts/index.js +++ b/ui/app/accounts/index.js @@ -19,9 +19,10 @@ function mapStateToProps (state) { accounts: state.metamask.accounts, identities: state.metamask.identities, unconfTxs: state.metamask.unconfTxs, - selectedAddress: state.metamask.selectedAddress, + selectedAccount: state.metamask.selectedAccount, scrollToBottom: state.appState.scrollToBottom, pending, + keyrings: state.metamask.keyrings, } } @@ -31,9 +32,10 @@ function AccountsScreen () { } AccountsScreen.prototype.render = function () { - var state = this.props - var identityList = valuesFor(state.identities) - var unconfTxList = valuesFor(state.unconfTxs) + const props = this.props + const { keyrings } = props + const identityList = valuesFor(props.identities) + const unconfTxList = valuesFor(props.unconfTxs) return ( @@ -69,13 +71,19 @@ AccountsScreen.prototype.render = function () { } }) + const simpleAddress = identity.address.substring(2).toLowerCase() + const keyring = keyrings.find((kr) => { + return kr.accounts.includes(simpleAddress) + }) + return h(AccountListItem, { key: `acct-panel-${identity.address}`, identity, - selectedAddress: this.props.selectedAddress, + selectedAccount: this.props.selectedAccount, accounts: this.props.accounts, onShowDetail: this.onShowDetail.bind(this), pending, + keyring, }) }), @@ -133,8 +141,8 @@ AccountsScreen.prototype.navigateToConfTx = function () { AccountsScreen.prototype.onSelect = function (address, event) { event.stopPropagation() // if already selected, deselect - if (this.props.selectedAddress === address) address = null - this.props.dispatch(actions.setSelectedAddress(address)) + if (this.props.selectedAccount === address) address = null + this.props.dispatch(actions.setSelectedAccount(address)) } AccountsScreen.prototype.onShowDetail = function (address, event) { @@ -143,8 +151,15 @@ AccountsScreen.prototype.onShowDetail = function (address, event) { } AccountsScreen.prototype.addNewAccount = function () { + this.props.dispatch(actions.addNewAccount(0)) +} + +/* An optional view proposed in this design: + * https://consensys.quip.com/zZVrAysM5znY +AccountsScreen.prototype.addNewAccount = function () { this.props.dispatch(actions.navigateToNewAccountScreen()) } +*/ AccountsScreen.prototype.goHome = function () { this.props.dispatch(actions.goHome()) |