html5-infobeamer-aalen-geek.../assets/js/custom/dom/speaker-info.js
2023-11-02 02:59:42 +01:00

52 lines
1.3 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 event_info = (event) => {
const ti = serv.type_index(sol.eventType(event));
return html`
<div class="speaker_event_logo"></div>
<div class="speaker-box type-${ti}">
<div class="speaker">
<div class="names">${serv.fix_dash(serv.person_names_concat(sol.eventPersons(event)))}</div>
</div>
</div>`;
};
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 thisRoom = config.roomName;
const events = sol.allEvents(schedule);
const eventsHere = sol.eventsByRoomName(events, thisRoom);
const eventsHereNow = sol.currentEvents(eventsHere, time);
const inner = html`
${eventsHereNow.slice(0,1).map(e => event_info(e))}`;
// Add main slide to frame
const anchorElId = "main";
const el = document.getElementById(anchorElId);
preact.render(inner, el);
};
};
export {
update_main_slide
};