diff --git a/static/calendar.html b/static/calendar.html index 08a463f..0574411 100644 --- a/static/calendar.html +++ b/static/calendar.html @@ -62,6 +62,12 @@
+ +
+ Color the calendar by +
+
diff --git a/static/calendar.js b/static/calendar.js index d5d7a9a..e104be0 100644 --- a/static/calendar.js +++ b/static/calendar.js @@ -144,19 +144,27 @@ initFindButton(findBtn, "Find a location", () => selected, (lat, lon) => selectLocation(lat, lon)); // ---- metric toggle ---- -// Reflect the restored metric on the toggle (the HTML defaults to High). -document.querySelectorAll("#metric-toggle button").forEach((b) => - b.classList.toggle("active", b.dataset.metric === metric)); - -document.getElementById("metric-toggle").addEventListener("click", (e) => { - const btn = e.target.closest("button[data-metric]"); - if (!btn) return; - metric = btn.dataset.metric; +// An inline selector (above the grid) plus a synced copy in the filter sheet; the sheet +// copy mirrors the inline 8 buttons (cloned). Either drives the shared `metric`. +document.getElementById("metric-toggle-sheet").innerHTML = + document.getElementById("metric-toggle").innerHTML; +const syncColorButtons = () => + document.querySelectorAll("#metric-toggle button, #metric-toggle-sheet button") + .forEach((b) => b.classList.toggle("active", b.dataset.metric === metric)); +function setColorMetric(m) { + metric = m; try { localStorage.setItem("thermograph:calMetric", metric); } catch (err) {} - document.querySelectorAll("#metric-toggle button").forEach((b) => b.classList.toggle("active", b === btn)); + syncColorButtons(); renderCalendar(); renderKey(); -}); +} +syncColorButtons(); // reflect the restored metric on both (the HTML defaults to High) +for (const id of ["metric-toggle", "metric-toggle-sheet"]) { + document.getElementById(id).addEventListener("click", (e) => { + const btn = e.target.closest("button[data-metric]"); + if (btn) setColorMetric(btn.dataset.metric); + }); +} // ---- category totals: share vs. count toggle ---- // The strip normally prints each category's share; ticking "Show count" swaps every @@ -290,9 +298,7 @@ filtersEl.addEventListener("change", (e) => { // Wire the per-season "Months" expand toggles (delegated on the stable container), // and the mobile floating pill that slides the whole filter panel up as a sheet. initSeasonExpand(seasonYearEl); -// On phones the "Color the calendar by" metric selector rides the filter sheet too. -const calSheet = initFilterSheet({ panel: filtersEl, label: "Filters", - sheetOnly: [document.getElementById("metric-block")] }); +const calSheet = initFilterSheet({ panel: filtersEl, label: "Filters" }); calSheet.setActive(checkedMonths.size < 12); // Close any open filter dropdown when tapping outside it (native
stays diff --git a/static/compare.html b/static/compare.html index 45f7d86..d0b5d30 100644 --- a/static/compare.html +++ b/static/compare.html @@ -81,10 +81,9 @@ Inner handles set your comfort range; outer handles set the tolerance range. Days in tolerance still count toward the score, scaled by how far past comfort they fall. - - -