diff options
author | brunobar79 <brunobar79@gmail.com> | 2018-07-10 12:20:00 +0800 |
---|---|---|
committer | brunobar79 <brunobar79@gmail.com> | 2018-07-10 12:20:00 +0800 |
commit | 9b81180ab10cf8ca59666104e862c0331e953591 (patch) | |
tree | 4f5c6082395ec9f0f477dbb4ef2bb958913b1d7e /ui/app/components/account-menu | |
parent | 85a4e39b052b8e0c9d277766c79d1a2b5459d934 (diff) | |
download | tangerine-wallet-browser-9b81180ab10cf8ca59666104e862c0331e953591.tar tangerine-wallet-browser-9b81180ab10cf8ca59666104e862c0331e953591.tar.gz tangerine-wallet-browser-9b81180ab10cf8ca59666104e862c0331e953591.tar.bz2 tangerine-wallet-browser-9b81180ab10cf8ca59666104e862c0331e953591.tar.lz tangerine-wallet-browser-9b81180ab10cf8ca59666104e862c0331e953591.tar.xz tangerine-wallet-browser-9b81180ab10cf8ca59666104e862c0331e953591.tar.zst tangerine-wallet-browser-9b81180ab10cf8ca59666104e862c0331e953591.zip |
added ui to remove accounts
Diffstat (limited to 'ui/app/components/account-menu')
-rw-r--r-- | ui/app/components/account-menu/index.js | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/ui/app/components/account-menu/index.js b/ui/app/components/account-menu/index.js index be6963ac4..9530d6aeb 100644 --- a/ui/app/components/account-menu/index.js +++ b/ui/app/components/account-menu/index.js @@ -187,16 +187,42 @@ AccountMenu.prototype.renderAccounts = function () { 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: const type = keyring.type - const isLoose = type !== 'HD Key Tree' - return isLoose ? h('.keyring-label.allcaps', this.context.t('imported')) : null + let label + 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 } } |