html5-infobeamer-aalen-geek.../assets/js/custom/dom/voc-talks.js
2023-11-01 01:59:19 +01:00

71 lines
1.4 KiB
JavaScript

'use strict';
import * as sol from "../../solight/sol.js";
import * as serv from "../services/general.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 event_row = (event) =>
html`
<tr>
<td>${sol.eventTitle(event)}</td>
<td>${speaker(event)}</td>
</tr>`;
const talks_table = (events) => {
const evs = sol.sortEventsByStartDate(events);
return html`
<h2>Talks</h2>
<table>
<tr>
<th>Title</th>
<th>Speakers</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, config) => {
// console.group("Updating Main Slide with:");
// console.info(data);
// console.info(time);
// console.info(config);
// console.groupEnd();
if (sol.defined(data.scheduleData)) {
const schedule = data.scheduleData;
const inner = html`
${talks_overview(schedule)}`;
// Add main slide to frame
const anchorElId = "main";
const el = document.getElementById(anchorElId);
preact.render(inner, el);
};
};
export {
update_main_slide
};