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