57 lines
1.6 KiB
JavaScript
57 lines
1.6 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 event_info = (event) => {
|
||
|
const title = serv.fix_dash(sol.eventTitle(event));
|
||
|
const names = serv.fix_dash(serv.person_names_concat(sol.eventPersons(event)));
|
||
|
return html`
|
||
|
<div class="talk-box">
|
||
|
<div class="talk">
|
||
|
<div class="title">${title}</div>
|
||
|
<div class="names">${names}</div>
|
||
|
</div>
|
||
|
</div>`;
|
||
|
};
|
||
|
|
||
|
|
||
|
const update_main_slide = (data, time, config) => {
|
||
|
if (sol.defined(data.scheduleData)) {
|
||
|
const schedule = data.scheduleData;
|
||
|
|
||
|
const thisRoom = config.roomName;
|
||
|
|
||
|
// const dt = luxon.Duration.fromObject({minutes: 5});
|
||
|
|
||
|
const events = sol.allEvents(schedule);
|
||
|
const eventsHere = sol.eventsByRoomName(events, thisRoom);
|
||
|
|
||
|
// const startingEventsHere = sol.startingEvents(eventsHere, time, dt);
|
||
|
// const currentEventsHere = sol.currentEvents(eventsHere, time);
|
||
|
// const endedEventsHere = sol.endedEvents(eventsHere, time, dt);
|
||
|
// const upcomingEventsHere = sol.distinctEvents(startingEventsHere.concat(currentEventsHere, endedEventsHere));
|
||
|
|
||
|
const upcomingEventsHere = sol.currentEvents(eventsHere, time);
|
||
|
|
||
|
const inner = html`
|
||
|
${upcomingEventsHere.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
|
||
|
};
|