1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-23 03:36:18 +02:00
metamask-extension/ui/app/main-container.js

49 lines
1.3 KiB
JavaScript
Raw Normal View History

2017-07-31 05:42:12 +02:00
const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
const AccountAndTransactionDetails = require('./account-and-transaction-details')
const Settings = require('./components/pages/settings')
const UnlockScreen = require('./components/pages/unlock-page')
const log = require('loglevel')
2017-07-31 05:42:12 +02:00
module.exports = MainContainer
inherits(MainContainer, Component)
function MainContainer () {
Component.call(this)
}
MainContainer.prototype.render = function () {
// 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
const contents = {
component: AccountAndTransactionDetails,
2017-08-29 16:50:48 +02:00
key: 'account-detail',
style: {},
}
if (this.props.isUnlocked === false) {
switch (this.props.currentViewName) {
case 'config':
log.debug('rendering config screen from unlock screen.')
return h(Settings, {key: 'config'})
default:
log.debug('rendering locked screen')
return h('.unlock-screen-container', {}, h(UnlockScreen, { key: 'locked' }))
}
}
2017-08-03 07:23:48 +02:00
return h('div.main-container', {
style: contents.style,
}, [
h(contents.component, {
key: contents.key,
2017-08-29 16:50:48 +02:00
}, []),
])
2017-07-31 05:42:12 +02:00
}