From 8c4d58aa4508e3d54c3f69847347e78d09c63b97 Mon Sep 17 00:00:00 2001 From: Bruno Date: Sun, 10 Jun 2018 03:52:32 -0400 Subject: initial trezor support --- ui/app/components/account-menu/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ui/app/components/account-menu') diff --git a/ui/app/components/account-menu/index.js b/ui/app/components/account-menu/index.js index f34631ca8..629669dac 100644 --- a/ui/app/components/account-menu/index.js +++ b/ui/app/components/account-menu/index.js @@ -14,6 +14,7 @@ const { INFO_ROUTE, NEW_ACCOUNT_ROUTE, IMPORT_ACCOUNT_ROUTE, + CONNECT_HARDWARE_ROUTE, DEFAULT_ROUTE, } = require('../../routes') @@ -106,6 +107,14 @@ AccountMenu.prototype.render = function () { icon: h('img.account-menu__item-icon', { src: 'images/import-account.svg' }), text: this.context.t('importAccount'), }), + h(Item, { + onClick: () => { + toggleAccountMenu() + history.push(CONNECT_HARDWARE_ROUTE) + }, + icon: h('img.account-menu__item-icon', { src: 'images/connect-icon.svg' }), + text: this.context.t('connectHardware'), + }), h(Divider), h(Item, { onClick: () => { -- cgit From 86a8c98148447916915da99962d82ec5c5dd6cb7 Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Mon, 2 Jul 2018 15:14:57 -0400 Subject: always open connect hardware in full screen mode --- ui/app/components/account-menu/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'ui/app/components/account-menu') diff --git a/ui/app/components/account-menu/index.js b/ui/app/components/account-menu/index.js index 629669dac..be6963ac4 100644 --- a/ui/app/components/account-menu/index.js +++ b/ui/app/components/account-menu/index.js @@ -9,6 +9,10 @@ const actions = require('../../actions') const { Menu, Item, Divider, CloseArea } = require('../dropdowns/components/menu') const Identicon = require('../identicon') const { formatBalance } = require('../../util') +const { ENVIRONMENT_TYPE_POPUP } = require('../../../../app/scripts/lib/enums') +const { getEnvironmentType } = require('../../../../app/scripts/lib/util') + + const { SETTINGS_ROUTE, INFO_ROUTE, @@ -110,7 +114,11 @@ AccountMenu.prototype.render = function () { h(Item, { onClick: () => { toggleAccountMenu() - history.push(CONNECT_HARDWARE_ROUTE) + if (getEnvironmentType(window.location.href) === ENVIRONMENT_TYPE_POPUP) { + global.platform.openExtensionInBrowser(CONNECT_HARDWARE_ROUTE) + } else { + history.push(CONNECT_HARDWARE_ROUTE) + } }, icon: h('img.account-menu__item-icon', { src: 'images/connect-icon.svg' }), text: this.context.t('connectHardware'), -- cgit From 9b81180ab10cf8ca59666104e862c0331e953591 Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Tue, 10 Jul 2018 00:20:00 -0400 Subject: added ui to remove accounts --- ui/app/components/account-menu/index.js | 34 +++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'ui/app/components/account-menu') 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 } } -- cgit From b9c2994d24e688305d63aaefd7fac88d88773ad9 Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Tue, 10 Jul 2018 19:19:29 -0400 Subject: finish warning modal UI --- ui/app/components/account-menu/index.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ui/app/components/account-menu') diff --git a/ui/app/components/account-menu/index.js b/ui/app/components/account-menu/index.js index 9530d6aeb..b561ea186 100644 --- a/ui/app/components/account-menu/index.js +++ b/ui/app/components/account-menu/index.js @@ -68,6 +68,9 @@ function mapDispatchToProps (dispatch) { dispatch(actions.hideSidebar()) dispatch(actions.toggleAccountMenu()) }, + showForgetAccountConfirmationModal: (address) => { + return dispatch(actions.showModal({ name: 'CONFIRM_FORGET_ACCOUNT', address })) + }, } } @@ -204,7 +207,9 @@ AccountMenu.prototype.renderForgetAccount = function (keyring, address) { AccountMenu.prototype.forgetAccount = function (e, address) { e.preventDefault() e.stopPropagation() + const { showForgetAccountConfirmationModal } = this.props console.log('should forget address: ', address) + showForgetAccountConfirmationModal(address) } AccountMenu.prototype.renderKeyringType = function (keyring) { -- cgit From 523cf9ad33d88719520ae5e7293329d133b64d4d Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Wed, 11 Jul 2018 00:20:40 -0400 Subject: account removal is working --- ui/app/components/account-menu/index.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'ui/app/components/account-menu') diff --git a/ui/app/components/account-menu/index.js b/ui/app/components/account-menu/index.js index b561ea186..73450c1bd 100644 --- a/ui/app/components/account-menu/index.js +++ b/ui/app/components/account-menu/index.js @@ -68,7 +68,7 @@ function mapDispatchToProps (dispatch) { dispatch(actions.hideSidebar()) dispatch(actions.toggleAccountMenu()) }, - showForgetAccountConfirmationModal: (address) => { + showRemoveAccountConfirmationModal: (address) => { return dispatch(actions.showModal({ name: 'CONFIRM_FORGET_ACCOUNT', address })) }, } @@ -156,7 +156,8 @@ AccountMenu.prototype.renderAccounts = function () { } = this.props const accountOrder = keyrings.reduce((list, keyring) => list.concat(keyring.accounts), []) - return accountOrder.map((address) => { + return accountOrder.filter(address => !!identities[address]).map((address) => { + const identity = identities[address] const isSelected = identity.address === selectedAddress @@ -191,25 +192,24 @@ AccountMenu.prototype.renderAccounts = function () { ]), this.renderKeyringType(keyring), - this.renderForgetAccount(keyring, identity.address), + this.renderRemoveAccount(keyring, identity.address), ], ) }) } -AccountMenu.prototype.renderForgetAccount = function (keyring, address) { +AccountMenu.prototype.renderRemoveAccount = 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 + const isRemovable = type !== 'HD Key Tree' + return isRemovable ? h('a.forget-account-icon', { onClick: (e) => this.removeAccount(e, address) }, '') : null } -AccountMenu.prototype.forgetAccount = function (e, address) { +AccountMenu.prototype.removeAccount = function (e, address) { e.preventDefault() e.stopPropagation() - const { showForgetAccountConfirmationModal } = this.props - console.log('should forget address: ', address) - showForgetAccountConfirmationModal(address) + const { showRemoveAccountConfirmationModal } = this.props + showRemoveAccountConfirmationModal(address) } AccountMenu.prototype.renderKeyringType = function (keyring) { -- cgit From 5a2a34591f8ab2aec3a056d5bb9e38ba5236cd07 Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Wed, 11 Jul 2018 01:35:37 -0400 Subject: clean up --- ui/app/components/account-menu/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ui/app/components/account-menu') diff --git a/ui/app/components/account-menu/index.js b/ui/app/components/account-menu/index.js index 73450c1bd..c15ecbc9c 100644 --- a/ui/app/components/account-menu/index.js +++ b/ui/app/components/account-menu/index.js @@ -69,7 +69,7 @@ function mapDispatchToProps (dispatch) { dispatch(actions.toggleAccountMenu()) }, showRemoveAccountConfirmationModal: (address) => { - return dispatch(actions.showModal({ name: 'CONFIRM_FORGET_ACCOUNT', address })) + return dispatch(actions.showModal({ name: 'CONFIRM_REMOVE_ACCOUNT', address })) }, } } @@ -199,10 +199,10 @@ AccountMenu.prototype.renderAccounts = function () { } AccountMenu.prototype.renderRemoveAccount = function (keyring, address) { - // Any account that's not form the HD wallet can be forgotten + // Any account that's not from the HD wallet Keyring can be removed const type = keyring.type const isRemovable = type !== 'HD Key Tree' - return isRemovable ? h('a.forget-account-icon', { onClick: (e) => this.removeAccount(e, address) }, '') : null + return isRemovable ? h('a.remove-account-icon', { onClick: (e) => this.removeAccount(e, address) }, '') : null } AccountMenu.prototype.removeAccount = function (e, address) { -- cgit From 2a0a7853249284cb27831890f3b62847ea27eb83 Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Thu, 12 Jul 2018 00:23:08 -0400 Subject: added tooltip --- ui/app/components/account-menu/index.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'ui/app/components/account-menu') diff --git a/ui/app/components/account-menu/index.js b/ui/app/components/account-menu/index.js index c15ecbc9c..c5b577cfd 100644 --- a/ui/app/components/account-menu/index.js +++ b/ui/app/components/account-menu/index.js @@ -11,6 +11,7 @@ const Identicon = require('../identicon') const { formatBalance } = require('../../util') const { ENVIRONMENT_TYPE_POPUP } = require('../../../../app/scripts/lib/enums') const { getEnvironmentType } = require('../../../../app/scripts/lib/util') +const Tooltip = require('../tooltip') const { @@ -202,7 +203,17 @@ AccountMenu.prototype.renderRemoveAccount = function (keyring, address) { // Any account that's not from the HD wallet Keyring can be removed const type = keyring.type const isRemovable = type !== 'HD Key Tree' - return isRemovable ? h('a.remove-account-icon', { onClick: (e) => this.removeAccount(e, address) }, '') : null + if (isRemovable) { + return h(Tooltip, { + title: this.context.t('removeAccount'), + position: 'bottom', + }, [ + h('a.remove-account-icon', { + onClick: (e) => this.removeAccount(e, address), + }, ''), + ]) + } + return null } AccountMenu.prototype.removeAccount = function (e, address) { -- cgit From 4b528405eac7cea54c743307e6f577abd6ce9507 Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Thu, 12 Jul 2018 13:19:51 -0400 Subject: catching up with develop --- ui/app/components/account-menu/index.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'ui/app/components/account-menu') diff --git a/ui/app/components/account-menu/index.js b/ui/app/components/account-menu/index.js index c5b577cfd..fc48b60f3 100644 --- a/ui/app/components/account-menu/index.js +++ b/ui/app/components/account-menu/index.js @@ -69,8 +69,8 @@ function mapDispatchToProps (dispatch) { dispatch(actions.hideSidebar()) dispatch(actions.toggleAccountMenu()) }, - showRemoveAccountConfirmationModal: (address) => { - return dispatch(actions.showModal({ name: 'CONFIRM_REMOVE_ACCOUNT', address })) + showRemoveAccountConfirmationModal: (identity) => { + return dispatch(actions.showModal({ name: 'CONFIRM_REMOVE_ACCOUNT', identity })) }, } } @@ -193,13 +193,13 @@ AccountMenu.prototype.renderAccounts = function () { ]), this.renderKeyringType(keyring), - this.renderRemoveAccount(keyring, identity.address), + this.renderRemoveAccount(keyring, identity), ], ) }) } -AccountMenu.prototype.renderRemoveAccount = function (keyring, address) { +AccountMenu.prototype.renderRemoveAccount = function (keyring, identity) { // Any account that's not from the HD wallet Keyring can be removed const type = keyring.type const isRemovable = type !== 'HD Key Tree' @@ -209,18 +209,18 @@ AccountMenu.prototype.renderRemoveAccount = function (keyring, address) { position: 'bottom', }, [ h('a.remove-account-icon', { - onClick: (e) => this.removeAccount(e, address), + onClick: (e) => this.removeAccount(e, identity), }, ''), ]) } return null } -AccountMenu.prototype.removeAccount = function (e, address) { +AccountMenu.prototype.removeAccount = function (e, identity) { e.preventDefault() e.stopPropagation() const { showRemoveAccountConfirmationModal } = this.props - showRemoveAccountConfirmationModal(address) + showRemoveAccountConfirmationModal(identity) } AccountMenu.prototype.renderKeyringType = function (keyring) { -- cgit From 49d1bdea8a47139cc814d3c49aa97bf2d542d3d5 Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Wed, 18 Jul 2018 22:57:47 -0400 Subject: design done --- ui/app/components/account-menu/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/app/components/account-menu') diff --git a/ui/app/components/account-menu/index.js b/ui/app/components/account-menu/index.js index fc48b60f3..9c063d31e 100644 --- a/ui/app/components/account-menu/index.js +++ b/ui/app/components/account-menu/index.js @@ -125,7 +125,7 @@ AccountMenu.prototype.render = function () { } }, icon: h('img.account-menu__item-icon', { src: 'images/connect-icon.svg' }), - text: this.context.t('connectHardware'), + text: this.context.t('connectHardwareWallet'), }), h(Divider), h(Item, { -- cgit