1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Concatenate custom RPC labels that are too long

This commit is contained in:
Dan Finlay 2017-02-27 10:25:10 -08:00
parent 62854398f1
commit ca5cf06ae9

View File

@ -499,6 +499,12 @@ App.prototype.renderCustomOption = function (provider) {
const { rpcTarget, type } = provider
if (type !== 'rpc') return null
// Concatenate long URLs
let label = rpcTarget
if (rpcTarget.length > 31) {
label = label.substr(0, 34) + '...'
}
switch (rpcTarget) {
case 'http://localhost:8545':
@ -506,7 +512,8 @@ App.prototype.renderCustomOption = function (provider) {
default:
return h(DropMenuItem, {
label: `${rpcTarget}`,
label,
key: rpcTarget,
closeMenu: () => this.setState({ isNetworkMenuOpen: false }),
icon: h('i.fa.fa-question-circle.fa-lg'),
activeNetworkRender: 'custom',
@ -524,6 +531,7 @@ App.prototype.renderCommonRpc = function (rpcList, provider) {
} else {
return h(DropMenuItem, {
label: rpc,
key: rpc,
closeMenu: () => this.setState({ isNetworkMenuOpen: false }),
action: () => props.dispatch(actions.setRpcTarget(rpc)),
icon: h('i.fa.fa-question-circle.fa-lg'),