2017-07-31 05:42:12 +02:00
|
|
|
const Component = require('react').Component
|
|
|
|
const h = require('react-hyperscript')
|
|
|
|
const inherits = require('util').inherits
|
2017-08-03 06:53:40 +02:00
|
|
|
const AccountAndTransactionDetails = require('./account-and-transaction-details')
|
2017-08-03 08:54:21 +02:00
|
|
|
const HDRestoreVaultScreen = require('./keychains/hd/restore-vault')
|
2017-10-23 07:40:03 +02:00
|
|
|
const Settings = require('./settings')
|
2017-08-03 08:54:21 +02:00
|
|
|
const UnlockScreen = require('./unlock')
|
2017-07-31 05:42:12 +02:00
|
|
|
|
|
|
|
module.exports = MainContainer
|
|
|
|
|
|
|
|
inherits(MainContainer, Component)
|
|
|
|
function MainContainer () {
|
|
|
|
Component.call(this)
|
|
|
|
}
|
|
|
|
|
|
|
|
MainContainer.prototype.render = function () {
|
2017-08-03 06:53:40 +02:00
|
|
|
// 3. summarize:
|
|
|
|
// switch statement goes inside MainContainer,
|
|
|
|
// or a method in renderPrimary
|
|
|
|
// - pass resulting h() to MainContainer
|
|
|
|
// - error checking in separate func
|
|
|
|
// - router in separate func
|
2017-08-03 08:54:21 +02:00
|
|
|
let contents = {
|
|
|
|
component: AccountAndTransactionDetails,
|
2017-08-29 16:50:48 +02:00
|
|
|
key: 'account-detail',
|
2017-08-03 08:54:21 +02:00
|
|
|
style: {},
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.props.isUnlocked === false) {
|
|
|
|
switch (this.props.currentViewName) {
|
|
|
|
case 'restoreVault':
|
|
|
|
log.debug('rendering restore vault screen')
|
|
|
|
contents = {
|
|
|
|
component: HDRestoreVaultScreen,
|
|
|
|
key: 'HDRestoreVaultScreen',
|
|
|
|
}
|
2017-08-29 16:50:48 +02:00
|
|
|
break
|
2017-08-03 08:54:21 +02:00
|
|
|
case 'config':
|
|
|
|
log.debug('rendering config screen from unlock screen.')
|
|
|
|
contents = {
|
2017-10-23 07:40:03 +02:00
|
|
|
component: Settings,
|
2017-08-03 08:54:21 +02:00
|
|
|
key: 'config',
|
|
|
|
}
|
2017-08-29 16:50:48 +02:00
|
|
|
break
|
2017-08-03 08:54:21 +02:00
|
|
|
default:
|
|
|
|
log.debug('rendering locked screen')
|
|
|
|
contents = {
|
|
|
|
component: UnlockScreen,
|
|
|
|
style: {
|
|
|
|
boxShadow: 'none',
|
|
|
|
display: 'flex',
|
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'center',
|
2017-08-03 09:21:19 +02:00
|
|
|
background: '#F7F7F7',
|
2017-08-03 08:54:21 +02:00
|
|
|
// must force 100%, because lock screen is full-width
|
|
|
|
width: '100%',
|
|
|
|
},
|
|
|
|
key: 'locked',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-08-03 06:53:40 +02:00
|
|
|
|
2017-08-03 07:23:48 +02:00
|
|
|
return h('div.main-container', {
|
2017-08-03 08:54:21 +02:00
|
|
|
style: contents.style,
|
|
|
|
}, [
|
|
|
|
h(contents.component, {
|
|
|
|
key: contents.key,
|
2017-08-29 16:50:48 +02:00
|
|
|
}, []),
|
2017-08-03 08:54:21 +02:00
|
|
|
])
|
2017-07-31 05:42:12 +02:00
|
|
|
}
|
|
|
|
|