const html = require('choo/html'); const Component = require('choo/component'); const Account = require('./account'); const assets = require('../../common/assets'); const { platform } = require('../utils'); class Header extends Component { constructor(name, state, emit) { super(name); this.state = state; this.emit = emit; this.account = state.cache(Account, 'account'); } update() { this.account.render(); return false; } createElement() { let assetMap = {}; if (this.state.ui !== undefined) assetMap = this.state.ui.assets; else assetMap = { icon: this.state.WEB_UI.CUSTOM_ASSETS.icon !== '' ? this.state.WEB_UI.CUSTOM_ASSETS.icon : assets.get('icon.svg'), wordmark: this.state.WEB_UI.CUSTOM_ASSETS.wordmark !== '' ? this.state.WEB_UI.CUSTOM_ASSETS.wordmark : assets.get('wordmark.svg') + '#logo' }; const title = platform() === 'android' ? html` ` : html` ${this.state.translate('title')} `; return html`
${title} ${this.account.render()}
`; } } module.exports = Header;