54 lines
1.4 KiB
JavaScript
54 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 event_info = (event) => {
|
|
const title = serv.fix_dash(sol.eventTitle(event));
|
|
const names = serv.fix_dash(serv.person_names_concat(sol.eventPersons(event)));
|
|
const ti = serv.type_index(sol.eventType(event));
|
|
return html`
|
|
<div class="talk-box type-${ti}">
|
|
<div class="talk">
|
|
<div class="title">${title}</div>
|
|
<div class="names">${names}</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
|
|
};
|