mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Add provider menu on clicking network status indicator.
Also simplifies network status icons.
This commit is contained in:
parent
5560ebba26
commit
b9007ee843
@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
## Current Master
|
## Current Master
|
||||||
|
|
||||||
- show network status in title bar
|
- Show network status in title bar
|
||||||
- Added seed word recovery to config screen.
|
- Added seed word recovery to config screen.
|
||||||
|
- Clicking network status indicator now reveals a provider menu.
|
||||||
|
|
||||||
## 2.2.0 2016-06-02
|
## 2.2.0 2016-06-02
|
||||||
|
|
||||||
|
@ -53,10 +53,9 @@ function mapStateToProps(state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
App.prototype.render = function() {
|
App.prototype.render = function() {
|
||||||
// const { selectedReddit, posts, isFetching, lastUpdated } = this.props
|
var props = this.props
|
||||||
var state = this.props
|
var view = props.currentView.name
|
||||||
var view = state.currentView.name
|
var transForward = props.transForward
|
||||||
var transForward = state.transForward
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
@ -95,7 +94,9 @@ App.prototype.render = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
App.prototype.renderAppBar = function(){
|
App.prototype.renderAppBar = function(){
|
||||||
var state = this.props
|
const props = this.props
|
||||||
|
const state = this.state || {}
|
||||||
|
const isNetworkMenuOpen = state.isNetworkMenuOpen || false
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
@ -104,20 +105,20 @@ App.prototype.renderAppBar = function(){
|
|||||||
h('.app-header.flex-row.flex-space-between', {
|
h('.app-header.flex-row.flex-space-between', {
|
||||||
style: {
|
style: {
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
visibility: state.isUnlocked ? 'visible' : 'none',
|
visibility: props.isUnlocked ? 'visible' : 'none',
|
||||||
background: state.isUnlocked ? 'white' : 'none',
|
background: props.isUnlocked ? 'white' : 'none',
|
||||||
height: '36px',
|
height: '36px',
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
zIndex: 1,
|
zIndex: 1,
|
||||||
},
|
},
|
||||||
}, state.isUnlocked && [
|
}, props.isUnlocked && [
|
||||||
|
|
||||||
h(NetworkIndicator, {
|
h(NetworkIndicator, {
|
||||||
network: this.props.network,
|
network: this.props.network,
|
||||||
onClick:(event) => {
|
onClick:(event) => {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
this.setState({ isNetworkMenuOpen: true })
|
this.setState({ isNetworkMenuOpen: !isNetworkMenuOpen })
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@ -128,7 +129,7 @@ App.prototype.renderAppBar = function(){
|
|||||||
width: 16,
|
width: 16,
|
||||||
barHeight: 2,
|
barHeight: 2,
|
||||||
padding: 0,
|
padding: 0,
|
||||||
isOpen: state.menuOpen,
|
isOpen: props.menuOpen,
|
||||||
color: 'rgb(247,146,30)',
|
color: 'rgb(247,146,30)',
|
||||||
onClick: (event) => {
|
onClick: (event) => {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
@ -150,9 +151,7 @@ App.prototype.renderNetworkDropdown = function() {
|
|||||||
|
|
||||||
return h(MenuDroppo, {
|
return h(MenuDroppo, {
|
||||||
isOpen,
|
isOpen,
|
||||||
onClickOutside: (event) => {
|
onClickOutside:(event) => {
|
||||||
event.preventDefault()
|
|
||||||
event.stopPropagation()
|
|
||||||
this.setState({ isNetworkMenuOpen: !isOpen })
|
this.setState({ isNetworkMenuOpen: !isOpen })
|
||||||
},
|
},
|
||||||
style: {
|
style: {
|
||||||
@ -173,22 +172,22 @@ App.prototype.renderNetworkDropdown = function() {
|
|||||||
h(DropMenuItem, {
|
h(DropMenuItem, {
|
||||||
label: 'Main Ethereum Network',
|
label: 'Main Ethereum Network',
|
||||||
closeMenu:() => this.setState({ isNetworkMenuOpen: false }),
|
closeMenu:() => this.setState({ isNetworkMenuOpen: false }),
|
||||||
action:() => state.dispatch(actions.setProviderType('mainnet')),
|
action:() => props.dispatch(actions.setProviderType('mainnet')),
|
||||||
icon: h('img.menu-icon', { src: '/images/ethereum-network.jpg' }),
|
icon: h('.menu-icon.ether-icon'),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
h(DropMenuItem, {
|
h(DropMenuItem, {
|
||||||
label: 'Morden Test Network',
|
label: 'Morden Test Network',
|
||||||
closeMenu:() => this.setState({ isNetworkMenuOpen: false }),
|
closeMenu:() => this.setState({ isNetworkMenuOpen: false }),
|
||||||
action:() => state.dispatch(actions.setProviderType('testnet')),
|
action:() => props.dispatch(actions.setProviderType('testnet')),
|
||||||
icon: h('img.menu-icon', { src: '/images/morden-test-network.jpg' }),
|
icon: h('.menu-icon.morden-icon'),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
h(DropMenuItem, {
|
h(DropMenuItem, {
|
||||||
label: 'Localhost 8545',
|
label: 'Localhost 8545',
|
||||||
closeMenu:() => this.setState({ isNetworkMenuOpen: false }),
|
closeMenu:() => this.setState({ isNetworkMenuOpen: false }),
|
||||||
action:() => state.dispatch(actions.setRpcTarget('http://localhost:8545')),
|
action:() => props.dispatch(actions.setRpcTarget('http://localhost:8545')),
|
||||||
icon: h('img.menu-icon', { src: '/images/unknown-private-network.jpg' }),
|
icon: h('i.fa.fa-question-circle.fa-lg', { ariaHidden: true }),
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
@ -21,14 +21,14 @@ Network.prototype.render = function() {
|
|||||||
title: 'Attempting to connect to blockchain.',
|
title: 'Attempting to connect to blockchain.',
|
||||||
style: {
|
style: {
|
||||||
width: '27px',
|
width: '27px',
|
||||||
marginRight: '-16px'
|
marginRight: '-27px'
|
||||||
},
|
},
|
||||||
src: 'images/loading.svg',
|
src: 'images/loading.svg',
|
||||||
})
|
})
|
||||||
} else if (networkNumber == 1) {
|
} else if (parseInt(networkNumber) == 1) {
|
||||||
hoverText = 'Main Ethereum Network'
|
hoverText = 'Main Ethereum Network'
|
||||||
iconName = 'ethereum-network'
|
iconName = 'ethereum-network'
|
||||||
}else if (networkNumber == 2) {
|
}else if (parseInt(networkNumber) == 2) {
|
||||||
hoverText = "Morden Test Network"
|
hoverText = "Morden Test Network"
|
||||||
iconName = 'morden-test-network'
|
iconName = 'morden-test-network'
|
||||||
}else {
|
}else {
|
||||||
@ -36,10 +36,30 @@ Network.prototype.render = function() {
|
|||||||
iconName = 'unknown-private-network'
|
iconName = 'unknown-private-network'
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
h('#network_component.flex-center', {
|
h('#network_component.flex-center.pointer', {
|
||||||
style: { marginRight: '-16px' },
|
style: {
|
||||||
|
marginRight: '-27px',
|
||||||
|
marginLeft: '-3px',
|
||||||
|
},
|
||||||
title: hoverText,
|
title: hoverText,
|
||||||
onClick:(event) => this.props.onClick(event),
|
onClick:(event) => this.props.onClick(event),
|
||||||
},[ h('img.menu-icon',{src: imagePath + iconName + ".jpg"}) ])
|
},[
|
||||||
|
function() {
|
||||||
|
switch (iconName) {
|
||||||
|
case 'ethereum-network':
|
||||||
|
return h('.menu-icon.ether-icon')
|
||||||
|
case 'morden-test-network':
|
||||||
|
return h('.menu-icon.morden-icon')
|
||||||
|
default:
|
||||||
|
return h('i.fa.fa-question-circle.fa-lg', {
|
||||||
|
ariaHidden: true,
|
||||||
|
style: {
|
||||||
|
margin: '10px',
|
||||||
|
color: 'rgb(125, 128, 130)',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
])
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -200,6 +200,21 @@ hr.horizontal-line {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
img.menu-icon {
|
.menu-icon {
|
||||||
width: 25px;
|
display: inline-block;
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
margin: 13px;
|
||||||
|
}
|
||||||
|
.ether-icon {
|
||||||
|
background: rgb(0, 163, 68);
|
||||||
|
border-radius: 20px;
|
||||||
|
}
|
||||||
|
.morden-icon {
|
||||||
|
background: #E20202;
|
||||||
|
}
|
||||||
|
|
||||||
|
.drop-menu-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user