@bobfrankston/rmfmail 1.0.670 → 1.0.672

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3447,7 +3447,8 @@ async function fetchUpcoming(from) {
3447
3447
  source: r.providerId ? "google" : "local",
3448
3448
  recurringEventId: r.recurringEventId,
3449
3449
  htmlLink: r.htmlLink,
3450
- isHoliday: !!r.isHoliday
3450
+ isHoliday: !!r.isHoliday,
3451
+ calendarId: r.calendarId
3451
3452
  }));
3452
3453
  }
3453
3454
  function formatDayHeader(d, today, tomorrow) {
@@ -3528,9 +3529,13 @@ function renderEvents(events) {
3528
3529
  }
3529
3530
  }
3530
3531
  let lastDayKey = "";
3532
+ const nowMs = Date.now();
3533
+ const recurHolidayCutoff = nowMs + HOLIDAY_RECUR_HORIZON_MS;
3531
3534
  for (const e of events) {
3532
3535
  if (e.recurringEventId && dailyKeys.has(e.recurringEventId))
3533
3536
  continue;
3537
+ if ((e.isHoliday || e.recurringEventId) && e.start > recurHolidayCutoff)
3538
+ continue;
3534
3539
  const d = new Date(e.start);
3535
3540
  const dayKey = `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}`;
3536
3541
  if (dayKey !== lastDayKey) {
@@ -3539,15 +3544,32 @@ function renderEvents(events) {
3539
3544
  }
3540
3545
  const recurMark = e.recurringEventId ? `<span class="cal-side-event-recur" title="Recurring event">\u21BB</span>` : "";
3541
3546
  const link = e.htmlLink || "";
3542
- const holidayAttr = e.isHoliday ? ' data-holiday="1"' : "";
3547
+ let holidayKind;
3548
+ if (e.isHoliday) {
3549
+ const cid = (e.calendarId || "").toLowerCase();
3550
+ if (cid.includes("usa"))
3551
+ holidayKind = "us";
3552
+ else if (cid.includes("jewish"))
3553
+ holidayKind = "jewish";
3554
+ else
3555
+ holidayKind = "other";
3556
+ }
3557
+ const holidayAttr = e.isHoliday ? ` data-holiday="1" data-holiday-kind="${holidayKind}"` : "";
3558
+ const recurAttr = e.recurringEventId ? ' data-recurring="1"' : "";
3543
3559
  const clickable = !e.isHoliday;
3544
3560
  const titleAttr = clickable && link ? 'title="Click to open in Google Calendar"' : "";
3545
3561
  const dataLink = clickable ? `data-link="${escapeHtml4(link)}"` : "";
3546
- html += `<div class="cal-side-event" data-id="${e.id}"${holidayAttr} ${dataLink} ${titleAttr}>
3547
- <span class="cal-side-event-dot ${e.isHoliday ? "h" : e.source === "google" ? "g" : "l"}"></span>
3548
- <span class="cal-side-event-time">${escapeHtml4(formatTime(e))}</span>
3549
- <span class="cal-side-event-title">${escapeHtml4(e.title)}${recurMark}</span>
3550
- </div>`;
3562
+ if (e.isHoliday) {
3563
+ html += `<div class="cal-side-event"${holidayAttr} data-id="${e.id}">
3564
+ <span class="cal-side-event-title cal-side-event-holiday-title">${escapeHtml4(e.title)}</span>
3565
+ </div>`;
3566
+ } else {
3567
+ html += `<div class="cal-side-event" data-id="${e.id}"${recurAttr} ${dataLink} ${titleAttr}>
3568
+ <span class="cal-side-event-dot ${e.source === "google" ? "g" : "l"}"></span>
3569
+ <span class="cal-side-event-time">${escapeHtml4(formatTime(e))}</span>
3570
+ <span class="cal-side-event-title">${escapeHtml4(e.title)}${recurMark}</span>
3571
+ </div>`;
3572
+ }
3551
3573
  }
3552
3574
  body.innerHTML = html;
3553
3575
  const openInCalendar = (url) => {
@@ -4013,7 +4035,7 @@ function initCalendarSidebar() {
4013
4035
  }
4014
4036
  }
4015
4037
  }
4016
- var SIDEBAR_PREF, SHOW_RECURRING_PREF, SHOW_DONE_PREF, HORIZON_DAYS_PREF, HORIZON_DEFAULT_DAYS, viewYear, viewMonth, viewDay, lastEvents, selectedTaskUuids;
4038
+ var SIDEBAR_PREF, SHOW_RECURRING_PREF, SHOW_DONE_PREF, HORIZON_DAYS_PREF, HORIZON_DEFAULT_DAYS, HOLIDAY_RECUR_HORIZON_MS, viewYear, viewMonth, viewDay, lastEvents, selectedTaskUuids;
4017
4039
  var init_calendar_sidebar = __esm({
4018
4040
  "client/components/calendar-sidebar.js"() {
4019
4041
  "use strict";
@@ -4024,6 +4046,7 @@ var init_calendar_sidebar = __esm({
4024
4046
  SHOW_DONE_PREF = "mailx-task-show-done";
4025
4047
  HORIZON_DAYS_PREF = "mailx-cal-horizon-days";
4026
4048
  HORIZON_DEFAULT_DAYS = 30;
4049
+ HOLIDAY_RECUR_HORIZON_MS = 14 * 864e5;
4027
4050
  viewYear = (/* @__PURE__ */ new Date()).getFullYear();
4028
4051
  viewMonth = (/* @__PURE__ */ new Date()).getMonth();
4029
4052
  viewDay = (/* @__PURE__ */ new Date()).getDate();