mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Add ✓ charchter to indicate active network
This commit is contained in:
parent
8d9a0e7177
commit
2c36c17238
@ -214,6 +214,7 @@ App.prototype.renderNetworkDropdown = function () {
|
|||||||
closeMenu: () => this.setState({ isNetworkMenuOpen: false }),
|
closeMenu: () => this.setState({ isNetworkMenuOpen: false }),
|
||||||
action: () => props.dispatch(actions.setProviderType('mainnet')),
|
action: () => props.dispatch(actions.setProviderType('mainnet')),
|
||||||
icon: h('.menu-icon.diamond'),
|
icon: h('.menu-icon.diamond'),
|
||||||
|
activeNetworkRender: props.network,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
h(DropMenuItem, {
|
h(DropMenuItem, {
|
||||||
@ -221,6 +222,7 @@ App.prototype.renderNetworkDropdown = function () {
|
|||||||
closeMenu: () => this.setState({ isNetworkMenuOpen: false }),
|
closeMenu: () => this.setState({ isNetworkMenuOpen: false }),
|
||||||
action: () => props.dispatch(actions.setProviderType('testnet')),
|
action: () => props.dispatch(actions.setProviderType('testnet')),
|
||||||
icon: h('.menu-icon.red-dot'),
|
icon: h('.menu-icon.red-dot'),
|
||||||
|
activeNetworkRender: props.network,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
h(DropMenuItem, {
|
h(DropMenuItem, {
|
||||||
@ -228,6 +230,7 @@ App.prototype.renderNetworkDropdown = function () {
|
|||||||
closeMenu: () => this.setState({ isNetworkMenuOpen: false }),
|
closeMenu: () => this.setState({ isNetworkMenuOpen: false }),
|
||||||
action: () => props.dispatch(actions.setRpcTarget('http://localhost:8545')),
|
action: () => props.dispatch(actions.setRpcTarget('http://localhost:8545')),
|
||||||
icon: h('i.fa.fa-question-circle.fa-lg', { ariaHidden: true }),
|
icon: h('i.fa.fa-question-circle.fa-lg', { ariaHidden: true }),
|
||||||
|
activeNetworkRender: props.provider.rpcTarget,
|
||||||
}),
|
}),
|
||||||
this.renderCustomOption(props.provider.rpcTarget),
|
this.renderCustomOption(props.provider.rpcTarget),
|
||||||
])
|
])
|
||||||
@ -367,12 +370,20 @@ App.prototype.renderCustomOption = function (rpcTarget) {
|
|||||||
action: () => this.props.dispatch(actions.showConfigPage()),
|
action: () => this.props.dispatch(actions.showConfigPage()),
|
||||||
icon: h('i.fa.fa-question-circle.fa-lg', { ariaHidden: true }),
|
icon: h('i.fa.fa-question-circle.fa-lg', { ariaHidden: true }),
|
||||||
})
|
})
|
||||||
|
case 'http://localhost:8545':
|
||||||
|
return h(DropMenuItem, {
|
||||||
|
label: 'Custom RPC',
|
||||||
|
closeMenu: () => this.setState({ isNetworkMenuOpen: false }),
|
||||||
|
action: () => this.props.dispatch(actions.showConfigPage()),
|
||||||
|
icon: h('i.fa.fa-question-circle.fa-lg', { ariaHidden: true }),
|
||||||
|
})
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return h(DropMenuItem, {
|
return h(DropMenuItem, {
|
||||||
label: `${rpcTarget}`,
|
label: `${rpcTarget}`,
|
||||||
closeMenu: () => this.setState({ isNetworkMenuOpen: false }),
|
closeMenu: () => this.setState({ isNetworkMenuOpen: false }),
|
||||||
icon: h('i.fa.fa-question-circle.fa-lg', { ariaHidden: true }),
|
icon: h('i.fa.fa-question-circle.fa-lg', { ariaHidden: true }),
|
||||||
|
activeNetworkRender: 'custom'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,5 +25,25 @@ DropMenuItem.prototype.render = function () {
|
|||||||
}, [
|
}, [
|
||||||
this.props.icon,
|
this.props.icon,
|
||||||
this.props.label,
|
this.props.label,
|
||||||
|
this.activeNetworkRender(),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DropMenuItem.prototype.activeNetworkRender = function () {
|
||||||
|
var activeNetwork = this.props.activeNetworkRender
|
||||||
|
if( activeNetwork === undefined) return
|
||||||
|
|
||||||
|
switch (this.props.label) {
|
||||||
|
case 'Main Ethereum Network':
|
||||||
|
if (activeNetwork === '1') return h('.check', ' ✓')
|
||||||
|
break
|
||||||
|
case 'Morden Test Network':
|
||||||
|
if (activeNetwork === '2') return h('.check', ' ✓')
|
||||||
|
break
|
||||||
|
case 'Localhost 8545':
|
||||||
|
if (activeNetwork > '2') return h('.check', ' ✓')
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
if (activeNetwork === 'custom') return h('.check', ' ✓')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user