97 lines
2.5 KiB
JavaScript
97 lines
2.5 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 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`
|
|
<tr>
|
|
<td>${sol.eventTitle(event).slice(0, 20)}</td>
|
|
<td>${schedule_persons(sol.eventPersons(event))}</td>
|
|
<td>${sol.eventPersonCount(event)}</td>
|
|
<td>${sol.eventType(event)}</td>
|
|
<td>${schedule_time(event)}</td>
|
|
<td>${dnrString}</td>
|
|
</tr>`;
|
|
};
|
|
|
|
const schedule_room = (events, room) => {
|
|
const rn = sol.roomName(room);
|
|
const evs = sol.eventsByRoomName(events, rn);
|
|
const evss = sol.sortEventsByStartDate(evs);
|
|
|
|
return html`
|
|
<h3>Room: ${rn}</h3>
|
|
<table>
|
|
<tr>
|
|
<th>Title</th>
|
|
<th>Speakers</th>
|
|
<th>#Speakers</th>
|
|
<th>Type</th>
|
|
<th>Time</th>
|
|
<th>DNR</th>
|
|
</tr>
|
|
${evss.map(e => schedule_event(e))}
|
|
</table>`;
|
|
};
|
|
|
|
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`
|
|
<h2>Day ${di}: ${dt.setLocale('de-DE').toFormat('EEEE')}</h2>
|
|
${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`
|
|
<h1>Schedule (v ${sol.scheduleVersion(schedule)})</h1>
|
|
${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
|
|
};
|