'use strict';
import * as sol from "../../solight/sol.js";
import * as serv from "../services/general.js";
const html = htm.bind(preact.h);
const schedule_persons = (persons) =>
html`${persons.map(p => sol.personName(p)).join(', ')}`;
const schedule_time = (event) =>
html`${sol.eventStartDate(event).toFormat('HH:mm')} - ${sol.eventEndDate(event).toFormat('HH:mm')}`;
const schedule_event = (event) => {
const dnrString = sol.eventDoNotRecord(event) ? 'True' : '-';
return html`
${sol.eventTitle(event).slice(0, 20)} |
${schedule_persons(sol.eventPersons(event))} |
${sol.eventPersonCount(event)} |
${sol.eventType(event)} |
${schedule_time(event)} |
${dnrString} |
`;
};
const schedule_room = (events, room) => {
const rn = sol.roomName(room);
const evs = sol.eventsByRoomName(events, rn);
const evss = sol.sortEventsByStartDate(evs);
return html`
Room: ${rn}
Title |
Speakers |
#Speakers |
Type |
Time |
DNR |
${evss.map(e => schedule_event(e))}
`;
};
const schedule_day = (con, events, rooms, day) => {
const dt = sol.dayStartDate(day);
const di = sol.dayIndex(day);
const evs = sol.eventsByDayIndex(events, di);
const rms = sol.roomsByDayIndex(con, rooms, di);
return html`
Day ${di}: ${dt.setLocale('de-DE').toFormat('EEEE')}
${rms.map(r => schedule_room(evs, r))}`;
};
const schedule_table = (schedule) => {
const con = sol.conference(schedule);
const days = sol.allDays(schedule);
const events = sol.allEvents(schedule);
const rooms = sol.allRooms(schedule);
return html`
Schedule (v ${sol.scheduleVersion(schedule)})
${days.map(d => schedule_day(con, events, rooms, d))}`;
};
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`
${schedule_table(schedule)}`;
// Add main slide to frame
const anchorElId = "main";
const el = document.getElementById(anchorElId);
preact.render(inner, el);
};
};
export {
update_main_slide
};