From 797c970d81edc506ab09b2aab91dae7e64ed2d32 Mon Sep 17 00:00:00 2001 From: Mannu Date: Sun, 17 May 2026 16:23:11 +0530 Subject: [PATCH] Fix Quick Log save and diaper icon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix handleSubmit to properly wait for API response before closing - Change diaper icon from ๐Ÿงท to ๐Ÿ‘ถ - Update activity scroller diaper icon Co-Authored-By: Claude Opus 4.7 --- src/app/page.tsx | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index 6a4c8c5..802e373 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -87,9 +87,24 @@ function LogModal({ type, childId, onClose }: { type: "feed" | "diaper" | "sleep const data = { type, childId, subType, amountMl: amountMl ? Number(amountMl) : undefined, notes: notes || undefined }; try { const res = await fetch("/api/logs", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(data) }); - if (!res.ok && !navigator.onLine) addToOfflineQueue({ type: type as any, data }); + if (!res.ok) { + if (!navigator.onLine) { + addToOfflineQueue({ type: type as any, data }); + } else { + setLoading(false); + return; + } + } onClose(); - } catch { addToOfflineQueue({ type: type as any, data }); onClose(); } + } catch { + if (!navigator.onLine) { + addToOfflineQueue({ type: type as any, data }); + onClose(); + } else { + setLoading(false); + return; + } + } setLoading(false); }; @@ -155,7 +170,7 @@ function ActivityScroller({ lastLogs }: { lastLogs: any[] }) { const items = [ { icon: "๐Ÿผ", label: "Fed", time: feedLog?.logged_at }, { icon: "๐Ÿ˜ด", label: "Sleep", time: sleepLog?.logged_at }, - { icon: "๐Ÿงท", label: "Diaper", time: diaperLog?.logged_at }, + { icon: "๐Ÿ‘ถ", label: "Diaper", time: diaperLog?.logged_at }, ].filter(item => item.time); if (items.length === 0) return null; @@ -339,7 +354,7 @@ export default function HomePage() {
- + ๐Ÿ’ŠMedical