updated the calendar and settings pages, added a new calendar page, and made some minor styling changes to the app.

This commit is contained in:
2026-04-15 23:15:45 -07:00
parent 4872e814c9
commit 5902d5f0b1
5 changed files with 222 additions and 26 deletions
+47 -4
View File
@@ -19,6 +19,10 @@
return config.getCurrentGeo?.() || null;
}
function getCurrentSettings() {
return config.getCurrentSettings?.() || null;
}
function normalizeGeoForSky(geo) {
const latitude = Number(geo?.latitude);
const longitude = Number(geo?.longitude);
@@ -51,14 +55,53 @@
return wrapperUrl.toString();
}
function syncNowSkyBackground(geo, force = false) {
function normalizeSkySyncOptions(optionsOrForce = false) {
if (typeof optionsOrForce === "boolean") {
return { force: optionsOrForce };
}
return {
force: Boolean(optionsOrForce?.force),
backgroundEnabled: optionsOrForce?.backgroundEnabled,
hasExplicitLocation: optionsOrForce?.hasExplicitLocation
};
}
function clearNowSkyBackground() {
const nowSkyLayerEl = getNowSkyLayerEl();
if (!nowSkyLayerEl || !geo) {
if (!nowSkyLayerEl) {
return;
}
nowSkyLayerEl.removeAttribute("src");
lastNowSkyGeoKey = "";
lastNowSkySourceUrl = "";
}
function syncNowSkyBackground(geo, optionsOrForce = false) {
const nowSkyLayerEl = getNowSkyLayerEl();
const nowPanelEl = getNowPanelEl();
if (!nowSkyLayerEl) {
return;
}
const options = normalizeSkySyncOptions(optionsOrForce);
const settings = getCurrentSettings();
const backgroundEnabled = typeof options.backgroundEnabled === "boolean"
? options.backgroundEnabled
: settings?.stellariumBackgroundEnabled === true;
const hasExplicitLocation = typeof options.hasExplicitLocation === "boolean"
? options.hasExplicitLocation
: settings?.hasExplicitLocation === true;
const normalizedGeo = normalizeGeoForSky(geo);
if (!normalizedGeo) {
const shouldLoadSky = Boolean(backgroundEnabled && hasExplicitLocation && normalizedGeo);
if (nowPanelEl) {
nowPanelEl.classList.toggle("is-sky-disabled", !shouldLoadSky);
}
if (!shouldLoadSky) {
clearNowSkyBackground();
return;
}
@@ -68,7 +111,7 @@
return;
}
if (!force && geoKey === lastNowSkyGeoKey && stellariumUrl === lastNowSkySourceUrl) {
if (!options.force && geoKey === lastNowSkyGeoKey && stellariumUrl === lastNowSkySourceUrl) {
return;
}