diff options
author | Paul Bouchon <mail@bitpshr.net> | 2019-04-18 01:34:49 +0800 |
---|---|---|
committer | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2019-04-18 01:34:49 +0800 |
commit | 0db0a187c8f30dcf332cf4d41a2f957171b25630 (patch) | |
tree | a57dc4e161dcefa8a2a96c9b14c24dbe1635588b /ui | |
parent | 00133d31b15d070d55dff13f568cf828dad41424 (diff) | |
download | tangerine-wallet-browser-0db0a187c8f30dcf332cf4d41a2f957171b25630.tar tangerine-wallet-browser-0db0a187c8f30dcf332cf4d41a2f957171b25630.tar.gz tangerine-wallet-browser-0db0a187c8f30dcf332cf4d41a2f957171b25630.tar.bz2 tangerine-wallet-browser-0db0a187c8f30dcf332cf4d41a2f957171b25630.tar.lz tangerine-wallet-browser-0db0a187c8f30dcf332cf4d41a2f957171b25630.tar.xz tangerine-wallet-browser-0db0a187c8f30dcf332cf4d41a2f957171b25630.tar.zst tangerine-wallet-browser-0db0a187c8f30dcf332cf4d41a2f957171b25630.zip |
feature: add Goerli support (#6459)
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app/components/app/dropdowns/network-dropdown.js | 24 | ||||
-rw-r--r-- | ui/app/components/app/dropdowns/tests/network-dropdown.test.js | 14 | ||||
-rw-r--r-- | ui/app/components/app/loading-network-screen/loading-network-screen.component.js | 2 | ||||
-rw-r--r-- | ui/app/components/app/modals/deposit-ether-modal.js | 2 | ||||
-rw-r--r-- | ui/app/components/app/network-display/index.scss | 8 | ||||
-rw-r--r-- | ui/app/components/app/network-display/network-display.component.js | 2 | ||||
-rw-r--r-- | ui/app/components/app/network.js | 14 | ||||
-rw-r--r-- | ui/app/css/itcss/components/network.scss | 4 | ||||
-rw-r--r-- | ui/app/helpers/constants/common.js | 1 | ||||
-rw-r--r-- | ui/app/pages/routes/index.js | 4 | ||||
-rw-r--r-- | ui/app/selectors/selectors.js | 3 | ||||
-rw-r--r-- | ui/lib/account-link.js | 3 | ||||
-rw-r--r-- | ui/lib/etherscan-prefix-for-network.js | 3 |
13 files changed, 77 insertions, 7 deletions
diff --git a/ui/app/components/app/dropdowns/network-dropdown.js b/ui/app/components/app/dropdowns/network-dropdown.js index 7e645725c..dbe3f1bc8 100644 --- a/ui/app/components/app/dropdowns/network-dropdown.js +++ b/ui/app/components/app/dropdowns/network-dropdown.js @@ -207,6 +207,28 @@ NetworkDropdown.prototype.render = function () { h( DropdownMenuItem, { + key: 'goerli', + closeMenu: () => this.props.hideNetworkDropdown(), + onClick: () => this.handleClick('goerli'), + style: dropdownMenuItemStyle, + }, + [ + providerType === 'goerli' ? h('i.fa.fa-check') : h('.network-check__transparent', '✓'), + h(NetworkDropdownIcon, { + backgroundColor: '#3099f2', // $dodger-blue + isSelected: providerType === 'goerli', + }), + h('span.network-name-item', { + style: { + color: providerType === 'goerli' ? '#ffffff' : '#9b9b9b', + }, + }, this.context.t('goerli')), + ] + ), + + h( + DropdownMenuItem, + { key: 'default', closeMenu: () => this.props.hideNetworkDropdown(), onClick: () => this.handleClick('localhost'), @@ -287,6 +309,8 @@ NetworkDropdown.prototype.getNetworkName = function () { name = this.context.t('rinkeby') } else if (providerName === 'localhost') { name = this.context.t('localhost') + } else if (providerName === 'goerli') { + name = this.context.t('goerli') } else { name = provider.nickname || this.context.t('unknownNetwork') } diff --git a/ui/app/components/app/dropdowns/tests/network-dropdown.test.js b/ui/app/components/app/dropdowns/tests/network-dropdown.test.js index 91e7899a7..4a81b973f 100644 --- a/ui/app/components/app/dropdowns/tests/network-dropdown.test.js +++ b/ui/app/components/app/dropdowns/tests/network-dropdown.test.js @@ -62,7 +62,7 @@ describe('Network Dropdown', () => { }) it('renders 7 DropDownMenuItems ', () => { - assert.equal(wrapper.find(DropdownMenuItem).length, 7) + assert.equal(wrapper.find(DropdownMenuItem).length, 8) }) it('checks background color for first NetworkDropdownIcon', () => { @@ -82,15 +82,19 @@ describe('Network Dropdown', () => { }) it('checks background color for fifth NetworkDropdownIcon', () => { - assert.equal(wrapper.find(NetworkDropdownIcon).at(4).prop('innerBorder'), '1px solid #9b9b9b') + assert.equal(wrapper.find(NetworkDropdownIcon).at(4).prop('backgroundColor'), '#3099f2') // Goerli Blue + }) + + it('checks background color for sixth NetworkDropdownIcon', () => { + assert.equal(wrapper.find(NetworkDropdownIcon).at(5).prop('innerBorder'), '1px solid #9b9b9b') }) it('checks dropdown for frequestRPCList from state ', () => { - assert.equal(wrapper.find(DropdownMenuItem).at(5).text(), '✓http://localhost:7545') + assert.equal(wrapper.find(DropdownMenuItem).at(6).text(), '✓http://localhost:7545') }) - it('checks background color for sixth NetworkDropdownIcon', () => { - assert.equal(wrapper.find(NetworkDropdownIcon).at(5).prop('innerBorder'), '1px solid #9b9b9b') + it('checks background color for seventh NetworkDropdownIcon', () => { + assert.equal(wrapper.find(NetworkDropdownIcon).at(6).prop('innerBorder'), '1px solid #9b9b9b') }) }) diff --git a/ui/app/components/app/loading-network-screen/loading-network-screen.component.js b/ui/app/components/app/loading-network-screen/loading-network-screen.component.js index b79051d0b..97b16d08f 100644 --- a/ui/app/components/app/loading-network-screen/loading-network-screen.component.js +++ b/ui/app/components/app/loading-network-screen/loading-network-screen.component.js @@ -47,6 +47,8 @@ export default class LoadingNetworkScreen extends PureComponent { name = this.context.t('connectingToRinkeby') } else if (providerName === 'localhost') { name = this.context.t('connectingToLocalhost') + } else if (providerName === 'goerli') { + name = this.context.t('connectingToGoerli') } else { name = this.context.t('connectingTo', [providerId]) } diff --git a/ui/app/components/app/modals/deposit-ether-modal.js b/ui/app/components/app/modals/deposit-ether-modal.js index e4ab7eba1..8f7ef792c 100644 --- a/ui/app/components/app/modals/deposit-ether-modal.js +++ b/ui/app/components/app/modals/deposit-ether-modal.js @@ -133,7 +133,7 @@ DepositEtherModal.prototype.render = function () { const { network, toWyre, toCoinSwitch, address, toFaucet } = this.props const { buyingWithShapeshift } = this.state - const isTestNetwork = ['3', '4', '42'].find(n => n === network) + const isTestNetwork = ['3', '4', '5', '42'].find(n => n === network) const networkName = getNetworkDisplayName(network) return h('div.page-container.page-container--full-width.page-container--full-height', {}, [ diff --git a/ui/app/components/app/network-display/index.scss b/ui/app/components/app/network-display/index.scss index e9f2f2057..d70786d20 100644 --- a/ui/app/components/app/network-display/index.scss +++ b/ui/app/components/app/network-display/index.scss @@ -26,6 +26,10 @@ &--rinkeby { background-color: lighten($tulip-tree, 35%); } + + &--goerli { + background-color: lighten($dodger-blue, 35%); + } } &__name { @@ -53,5 +57,9 @@ &--rinkeby { background-color: $tulip-tree; } + + &--goerli { + background-color: $dodger-blue; + } } } diff --git a/ui/app/components/app/network-display/network-display.component.js b/ui/app/components/app/network-display/network-display.component.js index 1142e8606..9ef5341b0 100644 --- a/ui/app/components/app/network-display/network-display.component.js +++ b/ui/app/components/app/network-display/network-display.component.js @@ -6,12 +6,14 @@ import { ROPSTEN_CODE, RINKEYBY_CODE, KOVAN_CODE, + GOERLI_CODE, } from '../../../../../app/scripts/controllers/network/enums' const networkToClassHash = { [MAINNET_CODE]: 'mainnet', [ROPSTEN_CODE]: 'ropsten', [RINKEYBY_CODE]: 'rinkeby', + [GOERLI_CODE]: 'goerli', [KOVAN_CODE]: 'kovan', } diff --git a/ui/app/components/app/network.js b/ui/app/components/app/network.js index 54065dd73..b438287e5 100644 --- a/ui/app/components/app/network.js +++ b/ui/app/components/app/network.js @@ -50,6 +50,9 @@ Network.prototype.render = function () { } else if (providerName === 'rinkeby') { hoverText = context.t('rinkeby') iconName = 'rinkeby-test-network' + } else if (providerName === 'goerli') { + hoverText = context.t('goerli') + iconName = 'goerli-test-network' } else { hoverText = providerId iconName = 'private-network' @@ -63,6 +66,7 @@ Network.prototype.render = function () { 'ropsten-test-network': providerName === 'ropsten' || parseInt(networkNumber) === 3, 'kovan-test-network': providerName === 'kovan', 'rinkeby-test-network': providerName === 'rinkeby', + 'goerli-test-network': providerName === 'goerli', }), title: hoverText, onClick: (event) => { @@ -113,6 +117,16 @@ Network.prototype.render = function () { h('.network-name', context.t('rinkeby')), h('i.fa.fa-chevron-down.fa-lg.network-caret'), ]) + case 'goerli-test-network': + return h('.network-indicator', [ + h(NetworkDropdownIcon, { + backgroundColor: '#3099f2', // $dodger-blue + nonSelectBackgroundColor: '#ecb23e', + loading: networkNumber === 'loading', + }), + h('.network-name', context.t('goerli')), + h('i.fa.fa-chevron-down.fa-lg.network-caret'), + ]) default: return h('.network-indicator', [ networkNumber === 'loading' diff --git a/ui/app/css/itcss/components/network.scss b/ui/app/css/itcss/components/network.scss index c828a2b26..5197f93e1 100644 --- a/ui/app/css/itcss/components/network.scss +++ b/ui/app/css/itcss/components/network.scss @@ -29,6 +29,10 @@ &.rinkeby-test-network .menu-icon-circle div { background-color: rgba(235, 179, 63, .7) !important; } + + &.goerli-test-network .menu-icon-circle div { + background-color: rgba(48, 153, 242, .7) !important; + } } .dropdown-menu-item { diff --git a/ui/app/helpers/constants/common.js b/ui/app/helpers/constants/common.js index 58fae5e5f..a0d6e65b3 100644 --- a/ui/app/helpers/constants/common.js +++ b/ui/app/helpers/constants/common.js @@ -10,4 +10,5 @@ export const NETWORK_TYPES = { MAINNET: 'mainnet', RINKEBY: 'rinkeby', ROPSTEN: 'ropsten', + GOERLI: 'goerli', } diff --git a/ui/app/pages/routes/index.js b/ui/app/pages/routes/index.js index 37ff2df61..1c96eaf8e 100644 --- a/ui/app/pages/routes/index.js +++ b/ui/app/pages/routes/index.js @@ -269,6 +269,8 @@ class Routes extends Component { name = this.context.t('connectingToRinkeby') } else if (providerName === 'localhost') { name = this.context.t('connectingToLocalhost') + } else if (providerName === 'goerli') { + name = this.context.t('connectingToGoerli') } else { name = this.context.t('connectingTo', [providerId]) } @@ -292,6 +294,8 @@ class Routes extends Component { name = this.context.t('rinkeby') } else if (providerName === 'localhost') { name = this.context.t('localhost') + } else if (providerName === 'goerli') { + name = this.context.t('goerli') } else { name = this.context.t('unknownNetwork') } diff --git a/ui/app/selectors/selectors.js b/ui/app/selectors/selectors.js index 554232f7b..da9cf57c7 100644 --- a/ui/app/selectors/selectors.js +++ b/ui/app/selectors/selectors.js @@ -300,9 +300,10 @@ function isEthereumNetwork (state) { MAINNET, RINKEBY, ROPSTEN, + GOERLI, } = NETWORK_TYPES - return [ KOVAN, MAINNET, RINKEBY, ROPSTEN].includes(networkType) + return [ KOVAN, MAINNET, RINKEBY, ROPSTEN, GOERLI].includes(networkType) } function preferencesSelector ({ metamask }) { diff --git a/ui/lib/account-link.js b/ui/lib/account-link.js index 037d990fa..3eaa7cf71 100644 --- a/ui/lib/account-link.js +++ b/ui/lib/account-link.js @@ -17,6 +17,9 @@ module.exports = function (address, network) { case 42: // kovan test net link = `https://kovan.etherscan.io/address/${address}` break + case 5: // goerli test net + link = `https://goerli.etherscan.io/address/${address}` + break default: link = '' break diff --git a/ui/lib/etherscan-prefix-for-network.js b/ui/lib/etherscan-prefix-for-network.js index 2c1904f1c..ce194b0a8 100644 --- a/ui/lib/etherscan-prefix-for-network.js +++ b/ui/lib/etherscan-prefix-for-network.js @@ -14,6 +14,9 @@ module.exports = function (network) { case 42: // kovan test net prefix = 'kovan.' break + case 5: // goerli test net + prefix = 'goerli.' + break default: prefix = '' } |