Isolate routing logic for isUnlocked, remove stray logs

This commit is contained in:
sdtsui 2017-08-02 23:54:21 -07:00
parent c7ac20ff65
commit 3ed81847d1
6 changed files with 49 additions and 21 deletions

View File

@ -13,7 +13,6 @@ function AccountAndTransactionDetails () {
}
AccountAndTransactionDetails.prototype.render = function () {
console.log('atdR')
return h('div', {
style: {
display: 'flex',

View File

@ -212,7 +212,6 @@ AddTokenScreen.prototype.attemptToAutoFillTokenParams = async function (address)
const [ symbol, decimals ] = results
if (symbol && decimals) {
console.log('SETTING SYMBOL AND DECIMALS', { symbol, decimals })
this.setState({ symbol: symbol[0], decimals: decimals[0].toString() })
}
}

View File

@ -458,20 +458,10 @@ App.prototype.renderPrimary = function () {
// show unlock screen
if (!props.isUnlocked) {
switch (props.currentView.name) {
case 'restoreVault':
log.debug('rendering restore vault screen')
return h(HDRestoreVaultScreen, {key: 'HDRestoreVaultScreen'})
case 'config':
log.debug('rendering config screen from unlock screen.')
return h(ConfigScreen, {key: 'config'})
default:
log.debug('rendering locked screen')
return h(UnlockScreen, {key: 'locked'})
}
return h(MainContainer, {
currentViewName: props.currentView.name,
isUnlocked: props.isUnlocked,
})
}
// show current view

View File

@ -51,7 +51,6 @@ TxView.prototype.render = function () {
}, [
h('div.phone-visible.fa.fa-bars', {
onClick: () => {
console.log("click received")
this.props.sidebarOpen ? this.props.hideSidebar() : this.props.showSidebar()
}
}, [

View File

@ -46,7 +46,6 @@ WalletView.prototype.render = function () {
h('div.phone-visible.fa.fa-bars', {
onClick: () => {
console.log("click received-inwalletview")
this.props.hideSidebar()
}
}, [
@ -128,7 +127,6 @@ WalletView.prototype.render = function () {
}, 'BUY'),
h('div.wallet-btn', {
onClick: () => {
console.log("SHOW");
this.props.showSendPage();
},
style: {

View File

@ -5,6 +5,9 @@ const TxView = require('./components/tx-view')
const WalletView = require('./components/wallet-view')
const SlideoutMenu = require('react-burger-menu').slide
const AccountAndTransactionDetails = require('./account-and-transaction-details')
const HDRestoreVaultScreen = require('./keychains/hd/restore-vault')
const ConfigScreen = require('./config')
const UnlockScreen = require('./unlock')
module.exports = MainContainer
@ -22,9 +25,49 @@ MainContainer.prototype.render = function () {
// - router in separate func
//
// 4. style all buttons as <button>s: accessibility + mobile focus
let contents = {
component: AccountAndTransactionDetails,
key: 'account-detail',
style: {},
}
if (this.props.isUnlocked === false) {
switch (this.props.currentViewName) {
case 'restoreVault':
log.debug('rendering restore vault screen')
contents = {
component: HDRestoreVaultScreen,
key: 'HDRestoreVaultScreen',
}
case 'config':
log.debug('rendering config screen from unlock screen.')
contents = {
component: ConfigScreen,
key: 'config',
}
default:
log.debug('rendering locked screen')
contents = {
component: UnlockScreen,
style: {
boxShadow: 'none',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
// must force 100%, because lock screen is full-width
width: '100%',
},
key: 'locked',
}
}
}
return h('div.main-container', {
style: {}
}, [h(AccountAndTransactionDetails, {}, [])])
style: contents.style,
}, [
h(contents.component, {
key: contents.key,
}, [])
])
}