57 lines
1.2 KiB
JavaScript
57 lines
1.2 KiB
JavaScript
|
'use strict';
|
||
|
|
||
|
import * as sol from "../../solight/sol.js";
|
||
|
|
||
|
import * as serv from "../services/service.js";
|
||
|
|
||
|
const html = htm.bind(preact.h);
|
||
|
|
||
|
|
||
|
const person_row = (events, person) =>
|
||
|
html`
|
||
|
<tr>
|
||
|
<td>${sol.personName(person)}</td>
|
||
|
</tr>`;
|
||
|
|
||
|
|
||
|
const persons_table = (events, persons) => {
|
||
|
const ps = sol.sortPersonsByName(persons);
|
||
|
return html`
|
||
|
<h2>Persons (${ps.length})</h2>
|
||
|
<table>
|
||
|
<tr>
|
||
|
<th>Name</th>
|
||
|
</tr>
|
||
|
${ps.map(p => person_row(events, p))}
|
||
|
</table>`;
|
||
|
};
|
||
|
|
||
|
|
||
|
const persons_overview = (schedule) => {
|
||
|
const persons = sol.allPersons(schedule);
|
||
|
const events = sol.allEvents(schedule);
|
||
|
return html`
|
||
|
<h1>Schedule (v ${sol.scheduleVersion(schedule)})</h1>
|
||
|
${persons_table(events, persons)}`;
|
||
|
};
|
||
|
|
||
|
|
||
|
const update_main_slide = (data, time) => {
|
||
|
if (sol.defined(data.scheduleData)) {
|
||
|
const schedule = data.scheduleData;
|
||
|
|
||
|
const inner = html`
|
||
|
${persons_overview(schedule)}`;
|
||
|
|
||
|
// Add main slide to info beamer
|
||
|
const anchorElId = "main";
|
||
|
const el = document.getElementById(anchorElId);
|
||
|
preact.render(inner, el);
|
||
|
};
|
||
|
};
|
||
|
|
||
|
|
||
|
export {
|
||
|
update_main_slide
|
||
|
};
|