html5-infobeamer-dhcp/assets/js/custom/dom/voc-talks.js

69 lines
1.4 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 speaker = (event) => {
const speaker = sol.eventPersons(event);
const names = speaker.map(s => sol.personName(s)).join(", ");
return html`${names}`;
};
const num_speaker = (event) =>
sol.eventPersons(event).length;
const event_row = (event) =>
html`
<tr>
<td>${sol.eventTitle(event)}</td>
<td>${speaker(event)}</td>
<td>${num_speaker(event)}</td>
</tr>`;
const talks_table = (events) => {
const evs = sol.sortEventsByStartDate(events);
return html`
<h2>Events (${evs.length})</h2>
<table>
<tr>
<th>Event Title</th>
<th>Person(s)</th>
<th>#Person(s)</th>
</tr>
${evs.map(e => event_row(e))}
</table>`;
};
const talks_overview = (schedule) => {
const events = sol.allEvents(schedule);
return html`
<h1>Schedule (v ${sol.scheduleVersion(schedule)})</h1>
${talks_table(events)}`;
};
const update_main_slide = (data, time) => {
if (sol.defined(data.scheduleData)) {
const schedule = data.scheduleData;
const inner = html`
${talks_overview(schedule)}`;
// Add main slide to info beamer
const anchorElId = "main";
const el = document.getElementById(anchorElId);
preact.render(inner, el);
};
};
export {
update_main_slide
};