1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

added ui to remove accounts

This commit is contained in:
brunobar79 2018-07-10 00:20:00 -04:00
parent 85a4e39b05
commit 9b81180ab1
3 changed files with 50 additions and 4 deletions

View File

@ -393,6 +393,9 @@
"message": "must be greater than or equal to $1.", "message": "must be greater than or equal to $1.",
"description": "helper for inputting hex as decimal input" "description": "helper for inputting hex as decimal input"
}, },
"hardware": {
"message": "hardware"
},
"here": { "here": {
"message": "here", "message": "here",
"description": "as in -click here- for more information (goes with troubleTokenBalances)" "description": "as in -click here- for more information (goes with troubleTokenBalances)"

View File

@ -187,16 +187,42 @@ AccountMenu.prototype.renderAccounts = function () {
h('div.account-menu__balance', formattedBalance), h('div.account-menu__balance', formattedBalance),
]), ]),
this.indicateIfLoose(keyring), this.renderKeyringType(keyring),
this.renderForgetAccount(keyring, identity.address),
], ],
) )
}) })
} }
AccountMenu.prototype.indicateIfLoose = function (keyring) { AccountMenu.prototype.renderForgetAccount = function (keyring, address) {
// Any account that's not form the HD wallet can be forgotten
const type = keyring.type
const isForgetable = type !== 'HD Key Tree'
return isForgetable ? h('a.forget-account-icon', { onClick: (e) => this.forgetAccount(e, address) }, '') : null
}
AccountMenu.prototype.forgetAccount = function (e, address) {
e.preventDefault()
e.stopPropagation()
console.log('should forget address: ', address)
}
AccountMenu.prototype.renderKeyringType = function (keyring) {
try { // Sometimes keyrings aren't loaded yet: try { // Sometimes keyrings aren't loaded yet:
const type = keyring.type const type = keyring.type
const isLoose = type !== 'HD Key Tree' let label
return isLoose ? h('.keyring-label.allcaps', this.context.t('imported')) : null switch (type) {
case 'Trezor Hardware':
label = this.context.t('hardware')
break
case 'Simple Key Pair':
label = this.context.t('imported')
break
default:
label = ''
}
return label !== '' ? h('.keyring-label.allcaps', label) : null
} catch (e) { return } } catch (e) { return }
} }

View File

@ -72,6 +72,7 @@
background-color: $dusty-gray; background-color: $dusty-gray;
color: $black; color: $black;
font-weight: normal; font-weight: normal;
letter-spacing: .5px;
} }
} }
@ -84,6 +85,22 @@
@media screen and (max-width: 575px) { @media screen and (max-width: 575px) {
padding: 12px 14px; padding: 12px 14px;
} }
.forget-account-icon {
width: 25px;
margin-left: 10px;
}
&:hover {
.forget-account-icon::after {
content: '\00D7';
font-size: 25px;
color: $white;
cursor: pointer;
position: absolute;
margin-top: -5px;
}
}
} }
&__account-info { &__account-info {