filo_caspar/app/main/graphic/view.js

27 lines
693 B
JavaScript
Raw Normal View History

2016-04-14 04:01:51 +00:00
const m = require('mithril')
2018-06-26 18:35:12 +00:00
const components = require('../common/components')
2016-04-14 04:01:51 +00:00
const engines = {
text: require('./engine/text'),
countdown: require('./engine/countdown'),
2016-07-28 18:21:50 +00:00
schedule: require('./engine/schedule'),
2016-04-14 04:01:51 +00:00
}
2018-06-26 18:35:12 +00:00
module.exports = function() {
let graphic = this.graphic
let currentView = graphic.engine && engines[graphic.engine][this.currentView] || null
2016-04-14 04:01:51 +00:00
2018-06-26 18:35:12 +00:00
return [
m('h4.header', 'Graphic'),
m('header', [
m('h3', graphic.name),
m('button', {
onclick: () => this.switchView(),
}, this.changeViewTitle()),
]),
components.error(this.error),
!currentView && m('p', 'Loading...')
|| currentView(this, graphic),
]
2016-04-14 04:01:51 +00:00
}