|
|
@ -30,6 +30,7 @@ const QrView = require('./components/qr-code') |
|
|
|
const HDCreateVaultComplete = require('./keychains/hd/create-vault-complete') |
|
|
|
const HDCreateVaultComplete = require('./keychains/hd/create-vault-complete') |
|
|
|
const HDRestoreVaultScreen = require('./keychains/hd/restore-vault') |
|
|
|
const HDRestoreVaultScreen = require('./keychains/hd/restore-vault') |
|
|
|
const RevealSeedConfirmation = require('./keychains/hd/recover-seed/confirmation') |
|
|
|
const RevealSeedConfirmation = require('./keychains/hd/recover-seed/confirmation') |
|
|
|
|
|
|
|
const AccountDropdowns = require('./components/account-dropdowns').AccountDropdowns |
|
|
|
|
|
|
|
|
|
|
|
module.exports = connect(mapStateToProps)(App) |
|
|
|
module.exports = connect(mapStateToProps)(App) |
|
|
|
|
|
|
|
|
|
|
@ -37,6 +38,13 @@ inherits(App, Component) |
|
|
|
function App () { Component.call(this) } |
|
|
|
function App () { Component.call(this) } |
|
|
|
|
|
|
|
|
|
|
|
function mapStateToProps (state) { |
|
|
|
function mapStateToProps (state) { |
|
|
|
|
|
|
|
const { |
|
|
|
|
|
|
|
identities, |
|
|
|
|
|
|
|
accounts, |
|
|
|
|
|
|
|
address, |
|
|
|
|
|
|
|
} = state.metamask |
|
|
|
|
|
|
|
const selected = address || Object.keys(accounts)[0] |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
// state from plugin
|
|
|
|
// state from plugin
|
|
|
|
isLoading: state.appState.isLoading, |
|
|
|
isLoading: state.appState.isLoading, |
|
|
@ -57,6 +65,10 @@ function mapStateToProps (state) { |
|
|
|
lastUnreadNotice: state.metamask.lastUnreadNotice, |
|
|
|
lastUnreadNotice: state.metamask.lastUnreadNotice, |
|
|
|
lostAccounts: state.metamask.lostAccounts, |
|
|
|
lostAccounts: state.metamask.lostAccounts, |
|
|
|
frequentRpcList: state.metamask.frequentRpcList || [], |
|
|
|
frequentRpcList: state.metamask.frequentRpcList || [], |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// state needed to get account dropdown temporarily rendering from app bar
|
|
|
|
|
|
|
|
identities, |
|
|
|
|
|
|
|
selected, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -169,17 +181,27 @@ App.prototype.renderAppBar = function () { |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, [ |
|
|
|
}, [ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
props.isUnlocked && h(AccountDropdowns, { |
|
|
|
|
|
|
|
style: {}, |
|
|
|
|
|
|
|
enableAccountsSelector: true, |
|
|
|
|
|
|
|
identities: this.props.identities, |
|
|
|
|
|
|
|
selected: this.props.selected, |
|
|
|
|
|
|
|
network: this.props.network, |
|
|
|
|
|
|
|
}, []), |
|
|
|
|
|
|
|
|
|
|
|
// hamburger
|
|
|
|
// hamburger
|
|
|
|
props.isUnlocked && h(SandwichExpando, { |
|
|
|
props.isUnlocked && h(SandwichExpando, { |
|
|
|
|
|
|
|
className: 'sandwich-expando', |
|
|
|
width: 16, |
|
|
|
width: 16, |
|
|
|
barHeight: 2, |
|
|
|
barHeight: 2, |
|
|
|
padding: 0, |
|
|
|
padding: 0, |
|
|
|
isOpen: state.isMainMenuOpen, |
|
|
|
isOpen: state.isMainMenuOpen, |
|
|
|
color: 'rgb(247,146,30)', |
|
|
|
color: 'rgb(247,146,30)', |
|
|
|
onClick: (event) => { |
|
|
|
onClick: () => { |
|
|
|
event.preventDefault() |
|
|
|
|
|
|
|
event.stopPropagation() |
|
|
|
event.stopPropagation() |
|
|
|
this.setState({ isMainMenuOpen: !state.isMainMenuOpen }) |
|
|
|
this.setState({ |
|
|
|
|
|
|
|
isMainMenuOpen: !state.isMainMenuOpen, |
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
}), |
|
|
|
}), |
|
|
|
]), |
|
|
|
]), |
|
|
@ -227,6 +249,9 @@ App.prototype.renderNetworkDropdown = function () { |
|
|
|
key: 'main', |
|
|
|
key: 'main', |
|
|
|
closeMenu: () => this.setState({ isNetworkMenuOpen: !isOpen }), |
|
|
|
closeMenu: () => this.setState({ isNetworkMenuOpen: !isOpen }), |
|
|
|
onClick: () => props.dispatch(actions.setProviderType('mainnet')), |
|
|
|
onClick: () => props.dispatch(actions.setProviderType('mainnet')), |
|
|
|
|
|
|
|
style: { |
|
|
|
|
|
|
|
fontSize: '18px', |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
[ |
|
|
|
[ |
|
|
|
h('.menu-icon.diamond'), |
|
|
|
h('.menu-icon.diamond'), |
|
|
@ -241,6 +266,9 @@ App.prototype.renderNetworkDropdown = function () { |
|
|
|
key: 'ropsten', |
|
|
|
key: 'ropsten', |
|
|
|
closeMenu: () => this.setState({ isNetworkMenuOpen: !isOpen }), |
|
|
|
closeMenu: () => this.setState({ isNetworkMenuOpen: !isOpen }), |
|
|
|
onClick: () => props.dispatch(actions.setProviderType('ropsten')), |
|
|
|
onClick: () => props.dispatch(actions.setProviderType('ropsten')), |
|
|
|
|
|
|
|
style: { |
|
|
|
|
|
|
|
fontSize: '18px', |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
[ |
|
|
|
[ |
|
|
|
h('.menu-icon.red-dot'), |
|
|
|
h('.menu-icon.red-dot'), |
|
|
@ -255,6 +283,9 @@ App.prototype.renderNetworkDropdown = function () { |
|
|
|
key: 'kovan', |
|
|
|
key: 'kovan', |
|
|
|
closeMenu: () => this.setState({ isNetworkMenuOpen: !isOpen }), |
|
|
|
closeMenu: () => this.setState({ isNetworkMenuOpen: !isOpen }), |
|
|
|
onClick: () => props.dispatch(actions.setProviderType('kovan')), |
|
|
|
onClick: () => props.dispatch(actions.setProviderType('kovan')), |
|
|
|
|
|
|
|
style: { |
|
|
|
|
|
|
|
fontSize: '18px', |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
[ |
|
|
|
[ |
|
|
|
h('.menu-icon.hollow-diamond'), |
|
|
|
h('.menu-icon.hollow-diamond'), |
|
|
@ -269,6 +300,9 @@ App.prototype.renderNetworkDropdown = function () { |
|
|
|
key: 'rinkeby', |
|
|
|
key: 'rinkeby', |
|
|
|
closeMenu: () => this.setState({ isNetworkMenuOpen: !isOpen }), |
|
|
|
closeMenu: () => this.setState({ isNetworkMenuOpen: !isOpen }), |
|
|
|
onClick: () => props.dispatch(actions.setProviderType('rinkeby')), |
|
|
|
onClick: () => props.dispatch(actions.setProviderType('rinkeby')), |
|
|
|
|
|
|
|
style: { |
|
|
|
|
|
|
|
fontSize: '18px', |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
[ |
|
|
|
[ |
|
|
|
h('.menu-icon.golden-square'), |
|
|
|
h('.menu-icon.golden-square'), |
|
|
@ -283,6 +317,9 @@ App.prototype.renderNetworkDropdown = function () { |
|
|
|
key: 'default', |
|
|
|
key: 'default', |
|
|
|
closeMenu: () => this.setState({ isNetworkMenuOpen: !isOpen }), |
|
|
|
closeMenu: () => this.setState({ isNetworkMenuOpen: !isOpen }), |
|
|
|
onClick: () => props.dispatch(actions.setDefaultRpcTarget()), |
|
|
|
onClick: () => props.dispatch(actions.setDefaultRpcTarget()), |
|
|
|
|
|
|
|
style: { |
|
|
|
|
|
|
|
fontSize: '18px', |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
[ |
|
|
|
[ |
|
|
|
h('i.fa.fa-question-circle.fa-lg.menu-icon'), |
|
|
|
h('i.fa.fa-question-circle.fa-lg.menu-icon'), |
|
|
@ -299,6 +336,9 @@ App.prototype.renderNetworkDropdown = function () { |
|
|
|
{ |
|
|
|
{ |
|
|
|
closeMenu: () => this.setState({ isNetworkMenuOpen: !isOpen }), |
|
|
|
closeMenu: () => this.setState({ isNetworkMenuOpen: !isOpen }), |
|
|
|
onClick: () => this.props.dispatch(actions.showConfigPage()), |
|
|
|
onClick: () => this.props.dispatch(actions.showConfigPage()), |
|
|
|
|
|
|
|
style: { |
|
|
|
|
|
|
|
fontSize: '18px', |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
[ |
|
|
|
[ |
|
|
|
h('i.fa.fa-question-circle.fa-lg.menu-icon'), |
|
|
|
h('i.fa.fa-question-circle.fa-lg.menu-icon'), |
|
|
@ -318,9 +358,13 @@ App.prototype.renderDropdown = function () { |
|
|
|
isOpen: isOpen, |
|
|
|
isOpen: isOpen, |
|
|
|
zIndex: 11, |
|
|
|
zIndex: 11, |
|
|
|
onClickOutside: (event) => { |
|
|
|
onClickOutside: (event) => { |
|
|
|
const { classList } = event.target |
|
|
|
const classList = event.target.classList |
|
|
|
const isNotToggleElement = !classList.contains('sandwich-expando') |
|
|
|
const parentClassList = event.target.parentElement.classList |
|
|
|
if (isNotToggleElement) { |
|
|
|
|
|
|
|
|
|
|
|
const isToggleElement = classList.contains('sandwich-expando') || |
|
|
|
|
|
|
|
parentClassList.contains('sandwich-expando') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isOpen && !isToggleElement) { |
|
|
|
this.setState({ isMainMenuOpen: false }) |
|
|
|
this.setState({ isMainMenuOpen: false }) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
@ -579,7 +623,6 @@ App.prototype.renderCommonRpc = function (rpcList, provider) { |
|
|
|
if ((rpc === 'http://localhost:8545') || (rpc === rpcTarget)) { |
|
|
|
if ((rpc === 'http://localhost:8545') || (rpc === rpcTarget)) { |
|
|
|
return null |
|
|
|
return null |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
|
|
return h( |
|
|
|
return h( |
|
|
|
DropdownMenuItem, |
|
|
|
DropdownMenuItem, |
|
|
|
{ |
|
|
|
{ |
|
|
|