| 68 | } |
| 69 | |
| 70 | function defaultHtmlContent( |
| 71 | { userCalendars, userCalendarEvents, baseUrl, view, startDate, timezoneId, timezoneUtcOffset }: { |
| 72 | userCalendars: Calendar[]; |
| 73 | userCalendarEvents: CalendarEvent[]; |
| 74 | baseUrl: string; |
| 75 | view: CalendarView; |
| 76 | startDate: string; |
| 77 | timezoneId: string; |
| 78 | timezoneUtcOffset: number; |
| 79 | }, |
| 80 | ) { |
| 81 | return html` |
| 82 | <main id="main"> |
| 83 | <section id="main-calendar"> |
| 84 | ${Loading()} |
| 85 | </section> |
| 86 | </main> |
| 87 | |
| 88 | <script type="module"> |
| 89 | import { h, render, Fragment } from 'preact'; |
| 90 | |
| 91 | // Imported files need some preact globals to work |
| 92 | window.h = h; |
| 93 | window.Fragment = Fragment; |
| 94 | |
| 95 | import MainCalendar from '/public/components/calendar/MainCalendar.js'; |
| 96 | |
| 97 | const mainCalendarElement = document.getElementById('main-calendar'); |
| 98 | |
| 99 | if (mainCalendarElement) { |
| 100 | const mainCalendarApp = h(MainCalendar, { |
| 101 | initialCalendars: ${JSON.stringify(userCalendars || [])}, |
| 102 | initialCalendarEvents: ${JSON.stringify(userCalendarEvents || [])}, |
| 103 | baseUrl: ${JSON.stringify(baseUrl)}, |
| 104 | view: ${JSON.stringify(view)}, |
| 105 | startDate: ${JSON.stringify(startDate)}, |
| 106 | timezoneId: ${JSON.stringify(timezoneId)}, |
| 107 | timezoneUtcOffset: ${JSON.stringify(timezoneUtcOffset)}, |
| 108 | }); |
| 109 | |
| 110 | render(mainCalendarApp, mainCalendarElement); |
| 111 | |
| 112 | document.getElementById('loading')?.remove(); |
| 113 | } |
| 114 | </script> |
| 115 | `; |
| 116 | } |
| 117 | |
| 118 | export default page({ |
| 119 | get, |