"use client"; import { useSyncExternalStore } from "react"; const subscribe = (onChange: () => void) => { window.addEventListener("online", onChange); window.addEventListener("offline", onChange); return () => { window.removeEventListener("online", onChange); window.removeEventListener("offline", onChange); }; }; /** "You're offline" above a page the service worker kept (APP-1.0-PLAN ยง2). */ export function OfflineNotice() { const offline = useSyncExternalStore(subscribe, () => !navigator.onLine, () => false); if (!offline) return null; return (
You're offline: showing what was saved. Booking, cancelling and requests need a connection.
); }