From ba56697e23e0858a7f610ae024a76d0d77038b3f Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Wed, 25 Mar 2026 17:10:44 -0700 Subject: [PATCH] fix(rcal): show calendar event locations on map in all spaces, not just demo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit REST API events use location_lat/location_lng while the map panel filters on latitude/longitude. Demo events set both, but non-demo events only had location_lat/location_lng — so the map was always empty outside demo. Normalize both REST and Automerge event data to include latitude/ longitude aliases. Co-Authored-By: Claude Opus 4.6 --- modules/rcal/components/folk-calendar-view.ts | 11 ++++++++++- modules/rcal/mod.ts | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/rcal/components/folk-calendar-view.ts b/modules/rcal/components/folk-calendar-view.ts index 0f8e529..1c33d0a 100644 --- a/modules/rcal/components/folk-calendar-view.ts +++ b/modules/rcal/components/folk-calendar-view.ts @@ -261,6 +261,8 @@ class FolkCalendarView extends HTMLElement { source_name: e.sourceName, source_color: e.sourceColor, location_name: e.locationName, location_lat: e.locationLat, location_lng: e.locationLng, + latitude: e.locationLat ?? null, + longitude: e.locationLng ?? null, })); // Only use doc events if REST hasn't loaded yet if (this.events.length === 0 && docEvents.length > 0) { @@ -692,7 +694,14 @@ class FolkCalendarView extends HTMLElement { fetch(`${base}/api/lunar?start=${start}&end=${end}`), fetch(`${schedBase}/api/reminders?upcoming=true`).catch(() => null), ]); - if (eventsRes.ok) { const data = await eventsRes.json(); this.events = data.results || []; } + if (eventsRes.ok) { + const data = await eventsRes.json(); + this.events = (data.results || []).map((e: any) => ({ + ...e, + latitude: e.latitude ?? e.location_lat ?? null, + longitude: e.longitude ?? e.location_lng ?? null, + })); + } if (sourcesRes.ok) { const data = await sourcesRes.json(); this.sources = data.results || []; } if (lunarRes.ok) { this.lunarData = await lunarRes.json(); } if (remindersRes?.ok) { const data = await remindersRes.json(); this.reminders = data.reminders || []; } diff --git a/modules/rcal/mod.ts b/modules/rcal/mod.ts index 2e5a22c..490a2ab 100644 --- a/modules/rcal/mod.ts +++ b/modules/rcal/mod.ts @@ -985,7 +985,7 @@ routes.get("/", (c) => { modules: getModuleInfoList(), theme: "dark", body: ``, - scripts: ``, + scripts: ``, styles: ` `, }));