aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/app.js
diff options
context:
space:
mode:
authorKevin Serrano <kevgagser@gmail.com>2017-02-23 07:12:56 +0800
committerKevin Serrano <kevgagser@gmail.com>2017-02-23 07:12:56 +0800
commit7a0ce31bd31a3d6f1a92bbaded71b040ca765065 (patch)
treeb14e9b068ab1153660ad6c310c51478612ed52f9 /ui/app/app.js
parent17a7436602191d11bb02771a87bd74f7baeb49ea (diff)
downloadtangerine-wallet-browser-7a0ce31bd31a3d6f1a92bbaded71b040ca765065.tar
tangerine-wallet-browser-7a0ce31bd31a3d6f1a92bbaded71b040ca765065.tar.gz
tangerine-wallet-browser-7a0ce31bd31a3d6f1a92bbaded71b040ca765065.tar.bz2
tangerine-wallet-browser-7a0ce31bd31a3d6f1a92bbaded71b040ca765065.tar.lz
tangerine-wallet-browser-7a0ce31bd31a3d6f1a92bbaded71b040ca765065.tar.xz
tangerine-wallet-browser-7a0ce31bd31a3d6f1a92bbaded71b040ca765065.tar.zst
tangerine-wallet-browser-7a0ce31bd31a3d6f1a92bbaded71b040ca765065.zip
Implemented functionality for displaying recent custom RPCs
Diffstat (limited to 'ui/app/app.js')
-rw-r--r--ui/app/app.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/ui/app/app.js b/ui/app/app.js
index 6e249b09e..08a4326fe 100644
--- a/ui/app/app.js
+++ b/ui/app/app.js
@@ -58,6 +58,7 @@ function mapStateToProps (state) {
forgottenPassword: state.appState.forgottenPassword,
lastUnreadNotice: state.metamask.lastUnreadNotice,
lostAccounts: state.metamask.lostAccounts,
+ frequentRpcList: state.metamask.frequentRpcList
}
}
@@ -210,6 +211,7 @@ App.prototype.renderAppBar = function () {
App.prototype.renderNetworkDropdown = function () {
const props = this.props
+ const rpcList = props.frequentRpcList
const state = this.state || {}
const isOpen = state.isNetworkMenuOpen
@@ -261,6 +263,7 @@ App.prototype.renderNetworkDropdown = function () {
}),
this.renderCustomOption(props.provider),
+ this.renderCommonRpc(rpcList, props.provider),
props.isUnlocked && h(DropMenuItem, {
label: 'Custom RPC',
@@ -508,3 +511,23 @@ App.prototype.renderCustomOption = function (provider) {
})
}
}
+
+App.prototype.renderCommonRpc = function (rpcList, provider) {
+ const { rpcTarget } = provider
+ const props = this.props
+
+ return rpcList.map((rpc) => {
+ if ((rpc === 'http://localhost:8545') || (rpc === rpcTarget)) {
+ return null
+ } else {
+ return h(DropMenuItem, {
+ label: rpc,
+ closeMenu: () => this.setState({ isNetworkMenuOpen: false }),
+ action: () => props.dispatch(actions.setRpcTarget(rpc)),
+ icon: h('i.fa.fa-question-circle.fa-lg'),
+ activeNetworkRender: rpc,
+ })
+ }
+ })
+
+}