aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/account-dropdowns.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-09-08 13:37:44 +0800
committerkumavis <aaron@kumavis.me>2017-09-08 13:37:44 +0800
commit671dafea9e8d379578c73672ba051205456219e3 (patch)
treec733017a12b83d70db21c61d16a07033ddefecbb /ui/app/components/account-dropdowns.js
parent70401626e2544f254ddb06a21b5d3de7fdd7fb82 (diff)
parenta704e1d14370056a9a1a8af43c702bb00142532d (diff)
downloaddexon-wallet-671dafea9e8d379578c73672ba051205456219e3.tar.gz
dexon-wallet-671dafea9e8d379578c73672ba051205456219e3.tar.zst
dexon-wallet-671dafea9e8d379578c73672ba051205456219e3.zip
Merge branch 'master' of github.com:MetaMask/metamask-extension into filter-leak-fix
Diffstat (limited to 'ui/app/components/account-dropdowns.js')
-rw-r--r--ui/app/components/account-dropdowns.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/ui/app/components/account-dropdowns.js b/ui/app/components/account-dropdowns.js
index 7c24e70b..b087a40d 100644
--- a/ui/app/components/account-dropdowns.js
+++ b/ui/app/components/account-dropdowns.js
@@ -22,12 +22,19 @@ class AccountDropdowns extends Component {
}
renderAccounts () {
- const { identities, selected } = this.props
+ const { identities, selected, keyrings } = this.props
return Object.keys(identities).map((key, index) => {
const identity = identities[key]
const isSelected = identity.address === selected
+ const simpleAddress = identity.address.substring(2).toLowerCase()
+
+ const keyring = keyrings.find((kr) => {
+ return kr.accounts.includes(simpleAddress) ||
+ kr.accounts.includes(identity.address)
+ })
+
return h(
DropdownMenuItem,
{
@@ -51,6 +58,7 @@ class AccountDropdowns extends Component {
},
},
),
+ this.indicateIfLoose(keyring),
h('span', {
style: {
marginLeft: '20px',
@@ -67,6 +75,14 @@ class AccountDropdowns extends Component {
})
}
+ indicateIfLoose (keyring) {
+ try { // Sometimes keyrings aren't loaded yet:
+ const type = keyring.type
+ const isLoose = type !== 'HD Key Tree'
+ return isLoose ? h('.keyring-label', 'LOOSE') : null
+ } catch (e) { return }
+ }
+
renderAccountSelector () {
const { actions } = this.props
const { accountSelectorActive } = this.state
@@ -145,6 +161,8 @@ class AccountDropdowns extends Component {
)
}
+
+
renderAccountOptions () {
const { actions } = this.props
const { optionsMenuActive } = this.state
@@ -278,6 +296,7 @@ AccountDropdowns.defaultProps = {
AccountDropdowns.propTypes = {
identities: PropTypes.objectOf(PropTypes.object),
selected: PropTypes.string,
+ keyrings: PropTypes.array,
}
const mapDispatchToProps = (dispatch) => {