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

Make network somewhat more modular, add new network indicator.

This commit is contained in:
Kevin Serrano 2017-01-04 14:30:14 -08:00
parent c22da8450c
commit a8a37e4d40
No known key found for this signature in database
GPG Key ID: 7CC862A58D2889B4
4 changed files with 24 additions and 17 deletions

View File

@ -141,15 +141,21 @@ App.prototype.renderAppBar = function () {
src: '/images/icon-128.png',
}),
h(NetworkIndicator, {
network: this.props.network,
provider: this.props.provider,
onClick: (event) => {
event.preventDefault()
event.stopPropagation()
this.setState({ isNetworkMenuOpen: !isNetworkMenuOpen })
},
}),
h('#network-spacer.flex-center', {
style: {
marginRight: '-72px',
}
}, [
h(NetworkIndicator, {
network: this.props.network,
provider: this.props.provider,
onClick: (event) => {
event.preventDefault()
event.stopPropagation()
this.setState({ isNetworkMenuOpen: !isNetworkMenuOpen })
},
}),
]),
]),
// metamask name

View File

@ -13,6 +13,7 @@ function Network () {
Network.prototype.render = function () {
const props = this.props
const networkNumber = props.network
const style = props.style
let providerName
try {
providerName = props.provider.type
@ -46,11 +47,7 @@ Network.prototype.render = function () {
}
return (
h('#network_component.flex-center.pointer', {
style: {
marginRight: '-27px',
marginLeft: '-3px',
},
h('#network_component.pointer', {
title: hoverText,
onClick: (event) => this.props.onClick(event),
}, [

View File

@ -4,6 +4,7 @@ const ReactCSSTransitionGroup = require('react-addons-css-transition-group')
const h = require('react-hyperscript')
const connect = require('react-redux').connect
const actions = require('./actions')
const NetworkIndicator = require('./components/network')
const txHelper = require('../lib/tx-helper')
const isPopupOrNotification = require('../../app/scripts/lib/is-popup-or-notification')
const ethUtil = require('ethereumjs-util')
@ -24,6 +25,7 @@ function mapStateToProps (state) {
index: state.appState.currentView.context,
warning: state.appState.warning,
network: state.metamask.network,
provider: state.metamask.provider,
}
}
@ -36,6 +38,7 @@ ConfirmTxScreen.prototype.render = function () {
var state = this.props
var network = state.network
var provider = state.provider
var unconfTxs = state.unconfTxs
var unconfMsgs = state.unconfMsgs
var unconfTxList = txHelper(unconfTxs, unconfMsgs, network)
@ -53,6 +56,10 @@ ConfirmTxScreen.prototype.render = function () {
!isNotification ? h('i.fa.fa-arrow-left.fa-lg.cursor-pointer', {
onClick: this.goHome.bind(this),
}) : null,
isNotification ? h(NetworkIndicator, {
network: network,
provider: provider,
}) : null,
h('h2.page-subtitle', 'Confirm Transaction'),
]),

View File

@ -165,9 +165,6 @@ textarea.twelve-word-phrase {
}
.network-name {
position: absolute;
top: 8px;
left: 60px;
width: 5.2em;
line-height: 9px;
text-rendering: geometricPrecision;