diff --git a/src/app.js b/src/app.js index 300b567..7ac192f 100644 --- a/src/app.js +++ b/src/app.js @@ -4193,10 +4193,15 @@ }); // ---------- collapsible panels ---------- - // Each main section carrying a data-panel key can be folded by clicking its + // Anything in main carrying a data-panel key can be folded by clicking its // heading; collapsed keys are remembered across reloads. State is device-global // (like the theme), so a single non-namespaced key is fine — it's not per-user // data. Only collapsed panels are stored, so newly added panels default open. + // + // A whole section heads with an h2, a foldable block inside one with an h3. + // The two nest without special handling: each has its own key, and a folded + // section hides the block along with everything else it holds, which leaves + // the block's own state to reappear as it was when the section reopens. const PANELS_KEY = "puppy-tracker:panels:v1"; function loadPanelState() { try { @@ -4209,25 +4214,25 @@ } function initPanels() { const state = loadPanelState(); - document.querySelectorAll("main section[data-panel]").forEach(section => { - const key = section.dataset.panel; - const h2 = section.querySelector(":scope > h2"); - if (!h2) return; - section.classList.add("collapsible"); + document.querySelectorAll("main [data-panel]").forEach(panel => { + const key = panel.dataset.panel; + const head = panel.querySelector(":scope > h2, :scope > h3"); + if (!head) return; + panel.classList.add("collapsible"); const collapsed = !!state[key]; - section.classList.toggle("collapsed", collapsed); - h2.setAttribute("role", "button"); - h2.setAttribute("tabindex", "0"); - h2.setAttribute("aria-expanded", String(!collapsed)); + panel.classList.toggle("collapsed", collapsed); + head.setAttribute("role", "button"); + head.setAttribute("tabindex", "0"); + head.setAttribute("aria-expanded", String(!collapsed)); const toggle = () => { - const nowCollapsed = section.classList.toggle("collapsed"); - h2.setAttribute("aria-expanded", String(!nowCollapsed)); + const nowCollapsed = panel.classList.toggle("collapsed"); + head.setAttribute("aria-expanded", String(!nowCollapsed)); const s = loadPanelState(); if (nowCollapsed) s[key] = true; else delete s[key]; savePanelState(s); }; - h2.addEventListener("click", toggle); - h2.addEventListener("keydown", (e) => { + head.addEventListener("click", toggle); + head.addEventListener("keydown", (e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); toggle(); } }); }); diff --git a/src/changelog.json b/src/changelog.json index 87ed00a..4ebbd74 100644 --- a/src/changelog.json +++ b/src/changelog.json @@ -1,4 +1,5 @@ [ + { "date": "2026-08-31", "text": "The list of weigh-ins under the Weight chart folds away on its own now — tap “History” inside the panel to collapse just the rows and keep the latest figure and the curve on screen. It remembers the choice like the panels do, and folding the whole Weight panel still takes everything with it" }, { "date": "2026-08-31", "text": "Walks now get the same two pattern views sleep has. “When … walks” is a day-per-row grid shaded where a walk was on, so you can see at a glance whether the routine is actually regular or drifts around. “Walk trend” draws the minutes walked so far at each point of the day against yesterday and the average over the picked window, with the age-based goal as a line and a ✓ once the day clears it — the line climbs only while a walk is on, so every step is one walk. Both appear under the Walks panel as soon as you have logged a walk, and stay out of the way until then" }, { "date": "2026-08-31", "text": "The 7d / 14d / 30d buttons now set the window for the Timing panel too. Until now the typical, shortest and longest gaps between pees, poos and meals were always measured over the last 7 days whatever you picked; switch to 30d and they are measured over 30, which settles down the typical gap once there is a month of history to draw on" }, { "date": "2026-08-31", "text": "The charts are grouped by subject instead of all sharing one “Last 7 days” panel. Sleep hours per day is now its own Sleep panel, sitting just above the “When … sleeps” timeline with the rest of the sleep views. Daily counts and Food have joined the by-hour chart in one “Pees, poos & meals” panel, so how many a day, how much food went with them and what hours they fall in read together. Minutes walked per day has moved into the Walks panel. The 7d / 14d / 30d picker now sits in the Sleep panel and still sets the window for every one of these charts" }, diff --git a/src/index.html b/src/index.html index a8ef363..375c3f2 100644 --- a/src/index.html +++ b/src/index.html @@ -342,8 +342,14 @@
-No weigh-ins logged yet.
+ +No weigh-ins logged yet.
+