'use strict'; import * as sol from "../../solight/sol.js"; import * as serv from "../services/service.js"; const html = htm.bind(preact.h); const schedule_event_modus = (event) => html`${serv.event_modus_string(event)}`; 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 person_count_class = (count) => { switch (true) { case count === 1: return 'speaker-cnt-1'; case count === 2: return 'speaker-cnt-2'; case count === 3: return 'speaker-cnt-3'; default: return 'speaker-cnt-many'; } }; const schedule_event = (event) => { const dnrString = sol.eventDoNotRecord(event) ? '✘' : '✔'; const dnrClass = sol.eventDoNotRecord(event) ? 'dnr-true' : 'dnr-false'; const speakerCnt = sol.eventPersonCount(event); const speakerCntClass = person_count_class(speakerCnt); return html` ${sol.eventTitle(event).slice(0, 30)} ${schedule_persons(sol.eventPersons(event))} ${speakerCnt} ${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}

${evss.map(e => schedule_event(e))}
Title Speakers #Speakers Type Time Record?
`; }; const schedule_day = (con, events, room, 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')}

${schedule_room(evs, room)}`; }; const schedule_table = (schedule, thisRoomName) => { const con = sol.conference(schedule); const days = sol.allDays(schedule); const events = sol.allEvents(schedule); const rooms = sol.allRooms(schedule); const room = sol.roomsByName(rooms, thisRoomName).at(0); return html`

Schedule (v ${sol.scheduleVersion(schedule)})

${days.map(d => schedule_day(con, events, room, d))}`; }; const update_main_slide = (data, time, config) => { console.log("Our data:"); console.log(data); if (sol.defined(data.scheduleData)) { const schedule = data.scheduleData; const thisRoomName = config.roomName; const inner = html` ${schedule_table(schedule, thisRoomName)}`; // Add main slide to info beamer const anchorElId = "main"; const el = document.getElementById(anchorElId); preact.render(inner, el); }; }; export { update_main_slide };