1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00

network status getting set upon start-up and showing in title bar but not auto-updating yet

This commit is contained in:
Zac Mitton 2016-06-01 16:30:14 -07:00
parent 1d65160ab4
commit 924a65c956
9 changed files with 53 additions and 6 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ package
.DS_Store .DS_Store
builds/ builds/
notes.txt

View File

@ -2,6 +2,7 @@
## Current Master ## Current Master
- show network conection in title bar
- Redesigned init, vault create, vault restore and seed confirmation screens. - Redesigned init, vault create, vault restore and seed confirmation screens.
- Added pending transactions to transaction list on account screen. - Added pending transactions to transaction list on account screen.
- Clicking a pending transaction takes you back to the transaction approval screen. - Clicking a pending transaction takes you back to the transaction approval screen.

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -6,6 +6,8 @@ var actions = {
toggleMenu: toggleMenu, toggleMenu: toggleMenu,
SET_MENU_STATE: 'SET_MENU_STATE', SET_MENU_STATE: 'SET_MENU_STATE',
closeMenu: closeMenu, closeMenu: closeMenu,
getNetworkStatus: 'getNetworkStatus',
// remote state // remote state
UPDATE_METAMASK_STATE: 'UPDATE_METAMASK_STATE', UPDATE_METAMASK_STATE: 'UPDATE_METAMASK_STATE',
updateMetamaskState: updateMetamaskState, updateMetamaskState: updateMetamaskState,
@ -131,6 +133,12 @@ function closeMenu() {
} }
} }
function getNetworkStatus(){
return {
type: actions.getNetworkStatus,
}
}
// async actions // async actions
function tryUnlockMetamask(password) { function tryUnlockMetamask(password) {

View File

@ -27,6 +27,7 @@ const txHelper = require('../lib/tx-helper')
const SandwichExpando = require('sandwich-expando') const SandwichExpando = require('sandwich-expando')
const MenuDroppo = require('menu-droppo') const MenuDroppo = require('menu-droppo')
const DropMenuItem = require('./components/drop-menu-item') const DropMenuItem = require('./components/drop-menu-item')
const NetworkIndicator = require('./components/network')
module.exports = connect(mapStateToProps)(App) module.exports = connect(mapStateToProps)(App)
@ -46,6 +47,7 @@ function mapStateToProps(state) {
unconfTxs: state.metamask.unconfTxs, unconfTxs: state.metamask.unconfTxs,
unconfMsgs: state.metamask.unconfMsgs, unconfMsgs: state.metamask.unconfMsgs,
menuOpen: state.appState.menuOpen, menuOpen: state.appState.menuOpen,
network: state.metamask.network,
} }
} }
@ -109,20 +111,21 @@ App.prototype.renderAppBar = function(){
}, state.isUnlocked && [ }, state.isUnlocked && [
// mini logo // mini logo
h('img', { // h('img', {
height: 24, // height: 24,
width: 24, // width: 24,
src: '/images/icon-128.png', // src: '/images/icon-128.png',
}), // }),
h(NetworkIndicator, {network: this.props.network}),
// metamask name // metamask name
h('h1', 'MetaMask'), h('h1', 'MetaMask'),
// hamburger // hamburger
h(SandwichExpando, { h(SandwichExpando, {
width: 16, width: 16,
barHeight: 2, barHeight: 2,
padding: 0, padding: 0,
paddingLeft: '200px',
isOpen: state.menuOpen, isOpen: state.menuOpen,
color: 'rgb(247,146,30)', color: 'rgb(247,146,30)',
onClick: (event) => { onClick: (event) => {

View File

@ -0,0 +1,34 @@
const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
module.exports = Network
inherits(Network, Component)
function Network() {
Component.call(this)
}
Network.prototype.render = function() {
var state = this.props
var networkNumber = state.network
var networkName;
var imagePath = "/images/"
if(networkNumber == undefined || networkNumber == "error"){
networkName = "no-connection"
}else if(networkNumber == 1){
networkName = "ethereum-network"
}else if(networkNumber == 2){
networkName = "morden-test-network"
}else{
networkName = "unknown-private-network"
}
return (
h('#network_component.flex-center', {
style: {},
title: networkName
},[ h('img',{src: imagePath + networkName + ".jpg", width: '25px'}) ])
)
}