Make info panels collapsible with remembered state
Each main section with a data-panel key can now be folded by clicking its heading (rotating chevron, keyboard-accessible via role/tabindex/aria-expanded and Enter/Space). Collapsed keys are persisted in localStorage and restored on load, so the layout stays how you left it across reloads. State is device-global like the theme (a single non-namespaced key, not per-user data), and only collapsed panels are stored — so any panel added later defaults to open.
This commit is contained in:
+7
-7
@@ -97,7 +97,7 @@
|
||||
<button type="button" id="day-next" class="ghost" aria-label="Next day">→</button>
|
||||
</section>
|
||||
|
||||
<section class="overview">
|
||||
<section class="overview" data-panel="overview">
|
||||
<h2 id="overview-title">Today's overview</h2>
|
||||
<div class="stats">
|
||||
<div class="stat">
|
||||
@@ -131,7 +131,7 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="timing">
|
||||
<section class="timing" data-panel="timing">
|
||||
<h2>Bathroom timing <span class="muted-note">(last 7 days)</span></h2>
|
||||
<div class="lasts">
|
||||
<div class="last-row"><span>Typical time between pees</span><span id="gap-pee">—</span></div>
|
||||
@@ -142,19 +142,19 @@
|
||||
<p class="muted-note timing-hint" id="timing-hint"></p>
|
||||
</section>
|
||||
|
||||
<section class="sleep">
|
||||
<section class="sleep" data-panel="sleep-windows">
|
||||
<h2>Sleep windows</h2>
|
||||
<ul id="sleep-list" class="wake-list"></ul>
|
||||
<p id="sleep-empty" class="empty">No sleep windows yet for this day.</p>
|
||||
</section>
|
||||
|
||||
<section class="wake">
|
||||
<section class="wake" data-panel="wake-windows">
|
||||
<h2>Wake windows</h2>
|
||||
<ul id="wake-list" class="wake-list"></ul>
|
||||
<p id="wake-empty" class="empty">No wake windows yet for this day.</p>
|
||||
</section>
|
||||
|
||||
<section class="weekly">
|
||||
<section class="weekly" data-panel="weekly">
|
||||
<h2>Last 7 days</h2>
|
||||
<div class="chart">
|
||||
<div class="chart-title">Sleep (hours)</div>
|
||||
@@ -183,7 +183,7 @@
|
||||
<p class="muted-note">Darker = happens more often at that hour.</p>
|
||||
</section>
|
||||
|
||||
<section class="weight">
|
||||
<section class="weight" data-panel="weight">
|
||||
<h2>Weight</h2>
|
||||
<div class="weight-summary">
|
||||
<div class="stat">
|
||||
@@ -204,7 +204,7 @@
|
||||
<p id="weight-empty" class="empty">No weigh-ins logged yet.</p>
|
||||
</section>
|
||||
|
||||
<section class="history">
|
||||
<section class="history" data-panel="history">
|
||||
<h2>History</h2>
|
||||
<ul id="event-list" class="event-list"></ul>
|
||||
<p id="empty-state" class="empty">No events logged for this day.</p>
|
||||
|
||||
Reference in New Issue
Block a user