diff options
author | HackyMiner <hackyminer@gmail.com> | 2018-09-29 03:53:58 +0800 |
---|---|---|
committer | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2018-09-29 03:53:58 +0800 |
commit | 13a1d4672045371f6366bf1fc48b77cb880eb4f8 (patch) | |
tree | 66b87722afe3b3adc528e71ead28dd007eb16c69 /ui | |
parent | 49a3d52dd6cbfbbdfd700f7a8898516f11e19045 (diff) | |
download | tangerine-wallet-browser-13a1d4672045371f6366bf1fc48b77cb880eb4f8.tar tangerine-wallet-browser-13a1d4672045371f6366bf1fc48b77cb880eb4f8.tar.gz tangerine-wallet-browser-13a1d4672045371f6366bf1fc48b77cb880eb4f8.tar.bz2 tangerine-wallet-browser-13a1d4672045371f6366bf1fc48b77cb880eb4f8.tar.lz tangerine-wallet-browser-13a1d4672045371f6366bf1fc48b77cb880eb4f8.tar.xz tangerine-wallet-browser-13a1d4672045371f6366bf1fc48b77cb880eb4f8.tar.zst tangerine-wallet-browser-13a1d4672045371f6366bf1fc48b77cb880eb4f8.zip |
support editable customRPC (#5267)
* support editable customRPC #5246
* remove rpcList size restriction
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app/actions.js | 14 | ||||
-rw-r--r-- | ui/app/components/dropdowns/network-dropdown.js | 10 | ||||
-rw-r--r-- | ui/app/components/pages/settings/settings-tab/settings-tab.component.js | 1 | ||||
-rw-r--r-- | ui/app/css/itcss/components/network.scss | 9 |
4 files changed, 34 insertions, 0 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js index 462d75d13..3afdfaadc 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -237,6 +237,7 @@ var actions = { removeSuggestedTokens, UPDATE_TOKENS: 'UPDATE_TOKENS', setRpcTarget: setRpcTarget, + delRpcTarget: delRpcTarget, setProviderType: setProviderType, SET_HARDWARE_WALLET_DEFAULT_HD_PATH: 'SET_HARDWARE_WALLET_DEFAULT_HD_PATH', setHardwareWalletDefaultHdPath, @@ -1836,6 +1837,19 @@ function setRpcTarget (newRpc) { } } +function delRpcTarget (oldRpc) { + return (dispatch) => { + log.debug(`background.delRpcTarget: ${oldRpc}`) + background.delCustomRpc(oldRpc, (err, result) => { + if (err) { + log.error(err) + return dispatch(self.displayWarning('Had a problem removing network!')) + } + dispatch(actions.setSelectedToken()) + }) + } +} + // Calls the addressBookController to add a new address. function addToAddressBook (recipient, nickname = '') { log.debug(`background.addToAddressBook`) diff --git a/ui/app/components/dropdowns/network-dropdown.js b/ui/app/components/dropdowns/network-dropdown.js index 63a30dd82..b252b25d9 100644 --- a/ui/app/components/dropdowns/network-dropdown.js +++ b/ui/app/components/dropdowns/network-dropdown.js @@ -43,6 +43,9 @@ function mapDispatchToProps (dispatch) { setRpcTarget: (target) => { dispatch(actions.setRpcTarget(target)) }, + delRpcTarget: (target) => { + dispatch(actions.delRpcTarget(target)) + }, showNetworkDropdown: () => dispatch(actions.showNetworkDropdown()), hideNetworkDropdown: () => dispatch(actions.hideNetworkDropdown()), } @@ -300,6 +303,13 @@ NetworkDropdown.prototype.renderCommonRpc = function (rpcList, provider) { color: currentRpcTarget ? '#ffffff' : '#9b9b9b', }, }, rpc), + h('i.fa.fa-times.delete', + { + onClick: (e) => { + e.stopPropagation() + props.delRpcTarget(rpc) + }, + }), ] ) } diff --git a/ui/app/components/pages/settings/settings-tab/settings-tab.component.js b/ui/app/components/pages/settings/settings-tab/settings-tab.component.js index 53c4f16e0..9da624f56 100644 --- a/ui/app/components/pages/settings/settings-tab/settings-tab.component.js +++ b/ui/app/components/pages/settings/settings-tab/settings-tab.component.js @@ -41,6 +41,7 @@ export default class SettingsTab extends PureComponent { setHexDataFeatureFlag: PropTypes.func, setCurrentCurrency: PropTypes.func, setRpcTarget: PropTypes.func, + delRpcTarget: PropTypes.func, displayWarning: PropTypes.func, revealSeedConfirmation: PropTypes.func, setFeatureFlagToBeta: PropTypes.func, diff --git a/ui/app/css/itcss/components/network.scss b/ui/app/css/itcss/components/network.scss index b23876d01..833a91f12 100644 --- a/ui/app/css/itcss/components/network.scss +++ b/ui/app/css/itcss/components/network.scss @@ -59,6 +59,15 @@ font-weight: 500; } +.dropdown-menu-item .fa.delete { + margin-right: 10px; + display: none; +} + +.dropdown-menu-item:hover .fa.delete { + display: inherit; +} + .network-droppo { right: 2px; |