From 260e287f0b941f073f3661c62d6780b306c2e2ef Mon Sep 17 00:00:00 2001 From: Mannu Date: Sat, 16 May 2026 16:31:12 +0530 Subject: [PATCH] Add vaccine reminders to home page - Show vaccine reminder banner on home page - Link to medical page for details - Show due/overdue status Co-Authored-By: Claude Opus 4.7 --- src/app/page.tsx | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index 2e58bfa..aa783a7 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -136,6 +136,7 @@ export default function HomePage() { const [aiLoading, setAiLoading] = useState(false); const [pendingCount, setPendingCount] = useState(0); const [lastLogs, setLastLogs] = useState([]); + const [vaccineReminders, setVaccineReminders] = useState([]); const { theme, toggle: toggleTheme } = useTheme(); const { childId, child, familyId, loading } = useFamily(); @@ -167,10 +168,17 @@ export default function HomePage() { setPendingCount(queue.length); const handleOnline = () => processOfflineQueue(); window.addEventListener("online", handleOnline); + // Fetch vaccine notifications + if (childId) { + fetch(`/api/notifications?childId=${childId}`) + .then(res => res.json()) + .then(data => setVaccineReminders(data.notifications || [])) + .catch(console.error); + } // Service worker disabled - causes errors in production // if ("serviceWorker" in navigator) navigator.serviceWorker.register("/sw.js").catch(console.error); return () => window.removeEventListener("online", handleOnline); - }, []); + }, [childId]); useEffect(() => { Promise.all([ @@ -261,6 +269,22 @@ export default function HomePage() { {pendingCount > 0 &&
{pendingCount} pending log{pendingCount > 1 ? "s" : ""}
} + {vaccineReminders.length > 0 && ( +
+ +
+
💊 Vaccine Reminder
+
+ {vaccineReminders[0].status === "overdue" + ? `${vaccineReminders[0].message}` + : `${vaccineReminders[0].vaccineName} due today`} +
+
+ → + +
+ )} +

Quick Log