28 lines
780 B
JavaScript
28 lines
780 B
JavaScript
|
const m = require('mithril')
|
||
|
const Graphic = require('./controller')
|
||
|
const components = require('../components')
|
||
|
|
||
|
const engines = {
|
||
|
text: require('./engine/text'),
|
||
|
countdown: require('./engine/countdown'),
|
||
|
}
|
||
|
|
||
|
Graphic.view = function(ctrl) {
|
||
|
graphic = Graphic.vm.graphic
|
||
|
|
||
|
return m('div', [
|
||
|
m('h3.container-header', 'Graphic'),
|
||
|
m('div.container-panel.panel-graphic',
|
||
|
!graphic.name && m('p', 'Loading...') ||
|
||
|
[
|
||
|
m('a.panel-graphic-settings.button', {
|
||
|
onclick: Graphic.vm.switchView
|
||
|
}, Graphic.vm.currentView === 'view' && 'Settings' || 'Control'),
|
||
|
m('h4', graphic.name),
|
||
|
components.error(Graphic.vm.error),
|
||
|
engines[graphic.engine][Graphic.vm.currentView](ctrl, graphic, Graphic.vm),
|
||
|
]
|
||
|
),
|
||
|
])
|
||
|
}
|