fix(rcal): show calendar event locations on map in all spaces, not just demo
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 <noreply@anthropic.com>
This commit is contained in:
parent
aa02473d0d
commit
ba56697e23
|
|
@ -261,6 +261,8 @@ class FolkCalendarView extends HTMLElement {
|
||||||
source_name: e.sourceName, source_color: e.sourceColor,
|
source_name: e.sourceName, source_color: e.sourceColor,
|
||||||
location_name: e.locationName,
|
location_name: e.locationName,
|
||||||
location_lat: e.locationLat, location_lng: e.locationLng,
|
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
|
// Only use doc events if REST hasn't loaded yet
|
||||||
if (this.events.length === 0 && docEvents.length > 0) {
|
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(`${base}/api/lunar?start=${start}&end=${end}`),
|
||||||
fetch(`${schedBase}/api/reminders?upcoming=true`).catch(() => null),
|
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 (sourcesRes.ok) { const data = await sourcesRes.json(); this.sources = data.results || []; }
|
||||||
if (lunarRes.ok) { this.lunarData = await lunarRes.json(); }
|
if (lunarRes.ok) { this.lunarData = await lunarRes.json(); }
|
||||||
if (remindersRes?.ok) { const data = await remindersRes.json(); this.reminders = data.reminders || []; }
|
if (remindersRes?.ok) { const data = await remindersRes.json(); this.reminders = data.reminders || []; }
|
||||||
|
|
|
||||||
|
|
@ -985,7 +985,7 @@ routes.get("/", (c) => {
|
||||||
modules: getModuleInfoList(),
|
modules: getModuleInfoList(),
|
||||||
theme: "dark",
|
theme: "dark",
|
||||||
body: `<folk-calendar-view space="${space}"></folk-calendar-view>`,
|
body: `<folk-calendar-view space="${space}"></folk-calendar-view>`,
|
||||||
scripts: `<script type="module" src="/modules/rcal/folk-calendar-view.js?v=3"></script>`,
|
scripts: `<script type="module" src="/modules/rcal/folk-calendar-view.js?v=4"></script>`,
|
||||||
styles: `<link rel="stylesheet" href="/modules/rcal/cal.css">
|
styles: `<link rel="stylesheet" href="/modules/rcal/cal.css">
|
||||||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" crossorigin="">`,
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" crossorigin="">`,
|
||||||
}));
|
}));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue