dpaw-qweb-app
Version:
Simple viewer app to interface with QGIS/monorail
55 lines (45 loc) • 1.26 kB
JavaScript
let Cycle = require('@cycle/core');
let CycleDOM = require('@cycle/dom');
let Rx = require('rx');
let Leaflet = require('./leaflet-component');
let u = require('dpaw-brocket-utility');
let Obs = Rx.Observable;
let log = u.log;
let leaflet = Object.create(Leaflet);
let h = CycleDOM.h;
function renderWeightSlider(weight) {
return h('div', [
'Weight ' + weight + 'kg',
h('input#weight', {type: 'range', min: 40, max: 140, value: weight})
]);
}
function renderHeightSlider(height) {
return h('div', [
'Height ' + height + 'cm',
h('input#height', {type: 'range', min: 140, max: 210, value: height})
]);
}
function view({state$, admin$, incoming$}) {
// log('App.view: state$ is ', state$);
// log('App.view: vtree$ is ', admin$);
// log('App.view: incoming$ is ', incoming$);
let vtree$ = Obs.combineLatest(
state$, admin$, incoming$, render);
// log('App.view: got vtree$ ', vtree$);
return vtree$;
}
function render(state, admin, incoming) {
let view = h('div#map-container', [
leaflet,
h('div#admin', [
h('h2', 'Admin goes here'),
admin
]),
h('div.log-container', [
h('div', [incoming])
// h('div', [outgoing])
])
]);
return view;
};
module.exports = view;