From 1bac464268eeb1868eb41f799bae50bc1bffbd38 Mon Sep 17 00:00:00 2001 From: Brian Bjarke Jensen Date: Wed, 3 Dec 2025 19:20:56 +0100 Subject: [PATCH 1/6] streamlined logging workflow --- src/baby_monitor/static/index.html | 39 ++---------------------------- 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/src/baby_monitor/static/index.html b/src/baby_monitor/static/index.html index 153c7b2..c053243 100644 --- a/src/baby_monitor/static/index.html +++ b/src/baby_monitor/static/index.html @@ -510,7 +510,7 @@ ` : ` - `; @@ -802,42 +802,7 @@ } function showStartSleepModal() { - const modal = document.getElementById("startSleepModal"); - const childSelect = document.getElementById("modalSleepChildId"); - - // Clear and populate child select or show single child - if (userChildren.length === 1) { - // Single child: replace dropdown with text display - const child = userChildren[0]; - const formGroup = childSelect.parentElement; - formGroup.innerHTML = ` - - - - `; - } else { - // Multiple children: show dropdown - childSelect.innerHTML = ''; - userChildren.forEach((child) => { - const option = document.createElement("option"); - option.value = child.id; - option.textContent = child.name; - childSelect.appendChild(option); - }); - - // Set default based on last sleep - if (lastSleep) { - childSelect.value = lastSleep.child_id; - } - } - - modal.classList.add("show"); + window.location.href = "/log-sleep.html"; } function closeStartSleepModal() { From fdcfb3c8a50dcfbbf3c4a121c8b958f9a8a6b472 Mon Sep 17 00:00:00 2001 From: Brian Bjarke Jensen Date: Wed, 3 Dec 2025 19:23:26 +0100 Subject: [PATCH 2/6] feeding type dropdown now defaults to last entry feeding type --- src/baby_monitor/static/log-feeding.html | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/baby_monitor/static/log-feeding.html b/src/baby_monitor/static/log-feeding.html index c1a8fb9..9b84aa2 100644 --- a/src/baby_monitor/static/log-feeding.html +++ b/src/baby_monitor/static/log-feeding.html @@ -303,6 +303,21 @@ // If editing, load the feeding data if (isEditMode) { loadFeedingData(); + } else { + // Set default feeding type to most recent log entry + try { + const response = await fetch("/api/feedings", { + headers: { Authorization: `Bearer ${token}` }, + }); + if (response.ok) { + const feedings = await response.json(); + if (feedings.length > 0) { + document.getElementById("feedingType").value = feedings[0].feeding_type; + } + } + } catch (error) { + // Ignore error, just use default + } } } else { showMessage("Failed to load children", "error"); From 32946e116518f55a6b479feb46855fa39f29a53b Mon Sep 17 00:00:00 2001 From: Brian Bjarke Jensen Date: Wed, 3 Dec 2025 19:39:48 +0100 Subject: [PATCH 3/6] added redirect to overview page when clicking most recent entry box --- src/baby_monitor/static/index.html | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/baby_monitor/static/index.html b/src/baby_monitor/static/index.html index c053243..c3e3370 100644 --- a/src/baby_monitor/static/index.html +++ b/src/baby_monitor/static/index.html @@ -547,7 +547,7 @@ // Build diaper card const diaperCard = lastDiaperChange ? ` - - + ` : ` - + `; // Build feeding card const feedingCard = lastFeeding ? ` - - + ` : ` - + `; // Build sleep card const sleepCard = lastSleep ? ` - + ` : ` - + `; return ` From 2c4336a5e4807d4166c9648cf7d01bb7cebf1429 Mon Sep 17 00:00:00 2001 From: Brian Bjarke Jensen Date: Wed, 3 Dec 2025 19:40:07 +0100 Subject: [PATCH 4/6] added edit button to entries --- src/baby_monitor/static/sleep.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/baby_monitor/static/sleep.html b/src/baby_monitor/static/sleep.html index 3d33504..c667f02 100644 --- a/src/baby_monitor/static/sleep.html +++ b/src/baby_monitor/static/sleep.html @@ -1104,6 +1104,9 @@
${durationText}
+
+ +
`; } From 95c2bf67448c14182aa2945cfdd8d5514281a5b3 Mon Sep 17 00:00:00 2001 From: Brian Bjarke Jensen Date: Wed, 3 Dec 2025 19:45:03 +0100 Subject: [PATCH 5/6] added peopulation of field values based on most recent entry --- src/baby_monitor/static/log-diaper.html | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/baby_monitor/static/log-diaper.html b/src/baby_monitor/static/log-diaper.html index 2b2813a..55c013d 100644 --- a/src/baby_monitor/static/log-diaper.html +++ b/src/baby_monitor/static/log-diaper.html @@ -336,6 +336,25 @@ lastDiaperChange.child_id; } } + + // Prepopulate poop and pee fields from most recent entry + try { + const response = await fetch("/api/diaper-changes", { + headers: { Authorization: `Bearer ${token}` }, + }); + if (response.ok) { + const changes = await response.json(); + if (changes.length > 0) { + const last = changes[0]; + document.getElementById("poopAmount").value = last.poop_amount || ""; + document.getElementById("poopColor").value = last.poop_color || ""; + document.getElementById("peeAmount").value = last.pee_amount || ""; + document.getElementById("peeColor").value = last.pee_color || ""; + } + } + } catch (error) { + // Ignore error, just use default + } } } else { showMessage("Failed to load children", "error"); From 5b17508ade9167a4e7905dffe78eb9af8020cc09 Mon Sep 17 00:00:00 2001 From: Brian Bjarke Jensen Date: Wed, 3 Dec 2025 19:49:48 +0100 Subject: [PATCH 6/6] CQ fixes --- src/baby_monitor/static/admin.html | 4 ++-- src/baby_monitor/static/log-diaper.html | 12 ++++++++---- src/baby_monitor/static/log-feeding.html | 3 ++- src/baby_monitor/static/sleep.html | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/baby_monitor/static/admin.html b/src/baby_monitor/static/admin.html index acf2843..9088f07 100644 --- a/src/baby_monitor/static/admin.html +++ b/src/baby_monitor/static/admin.html @@ -506,8 +506,8 @@ ID: ${user.id} โ€ข Created: ${new Date(user.created_at).toLocaleDateString()} -