persisted selection of child and time range when switching between pages. Also added automatic total sleep time scaling on vertical axis
This commit is contained in:
@@ -304,9 +304,15 @@
|
||||
|
||||
let allFeedings = [];
|
||||
let allChildren = [];
|
||||
let currentDaysRange = 7;
|
||||
let currentDaysRange = parseInt(localStorage.getItem("lastFeedingTimeRange")) || 7;
|
||||
let selectedChildId = null; // null means "All Children"
|
||||
|
||||
// Restore last selected child from localStorage
|
||||
const lastChildId = localStorage.getItem("lastFeedingChildFilter");
|
||||
if (lastChildId && lastChildId !== "all") {
|
||||
selectedChildId = parseInt(lastChildId);
|
||||
}
|
||||
|
||||
// Load feedings data
|
||||
async function loadFeedings() {
|
||||
try {
|
||||
@@ -348,12 +354,14 @@
|
||||
|
||||
function onDaysRangeChange(event) {
|
||||
currentDaysRange = parseInt(event.target.value);
|
||||
localStorage.setItem("lastFeedingTimeRange", currentDaysRange);
|
||||
displayFeedings(allFeedings);
|
||||
}
|
||||
|
||||
function onChildChange(event) {
|
||||
selectedChildId =
|
||||
event.target.value === "all" ? null : parseInt(event.target.value);
|
||||
localStorage.setItem("lastFeedingChildFilter", event.target.value);
|
||||
displayFeedings(allFeedings);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user