1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-23 18:41:38 +01:00

Move accountselector menu-droppo up to app-header

This commit is contained in:
sdtsui 2017-08-03 17:17:00 -07:00
parent ecb09fcc0a
commit 850e9b63d2

View File

@ -30,6 +30,8 @@ const QrView = require('./components/qr-code')
const HDCreateVaultComplete = require('./keychains/hd/create-vault-complete') const HDCreateVaultComplete = require('./keychains/hd/create-vault-complete')
const HDRestoreVaultScreen = require('./keychains/hd/restore-vault') const HDRestoreVaultScreen = require('./keychains/hd/restore-vault')
const RevealSeedConfirmation = require('./keychains/hd/recover-seed/confirmation') const RevealSeedConfirmation = require('./keychains/hd/recover-seed/confirmation')
const AccountDropdowns = require('./components/account-dropdowns').AccountDropdowns
const ethUtil = require('ethereumjs-util')
module.exports = connect(mapStateToProps)(App) module.exports = connect(mapStateToProps)(App)
@ -37,6 +39,14 @@ inherits(App, Component)
function App () { Component.call(this) } function App () { Component.call(this) }
function mapStateToProps (state) { function mapStateToProps (state) {
const {
identities,
accounts,
address,
} = state.metamask
let selected = address || Object.keys(accounts)[0]
// let checksumAddress = selected && ethUtil.toChecksumAddress(selected)
return { return {
// state from plugin // state from plugin
isLoading: state.appState.isLoading, isLoading: state.appState.isLoading,
@ -57,6 +67,10 @@ function mapStateToProps (state) {
lastUnreadNotice: state.metamask.lastUnreadNotice, lastUnreadNotice: state.metamask.lastUnreadNotice,
lostAccounts: state.metamask.lostAccounts, lostAccounts: state.metamask.lostAccounts,
frequentRpcList: state.metamask.frequentRpcList || [], frequentRpcList: state.metamask.frequentRpcList || [],
// state needed to get account dropdown temporarily rendering from app bar
identities,
selected,
} }
} }
@ -169,6 +183,14 @@ App.prototype.renderAppBar = function () {
}, },
}, [ }, [
props.isUnlocked && h(AccountDropdowns, {
style: {},
enableAccountsSelector: true,
identities: this.props.identities,
selected: this.props.selected,
network: this.props.network,
}, []),
// hamburger // hamburger
props.isUnlocked && h(SandwichExpando, { props.isUnlocked && h(SandwichExpando, {
width: 16, width: 16,