import { Show, createSignal, onCleanup, onMount } from "solid-js"; import { Button } from "@/components/ui/button"; import { IconWifiOff } from "@/components/ui/icons"; import { useT } from "@/stores/preferences-context"; /** * Reflects the browser's own online/offline signal — nothing invented, no * queued-write promise the app can't keep. Sits above the routed content so * a lost connection is visible everywhere, not just on the page that * happened to trigger a fetch. */ export function NetworkStatusBanner() { const t = useT(); const [online, setOnline] = createSignal(true); onMount(() => { setOnline(navigator.onLine); const handleOnline = () => setOnline(true); const handleOffline = () => setOnline(false); window.addEventListener("online", handleOnline); window.addEventListener("offline", handleOffline); onCleanup(() => { window.removeEventListener("online", handleOnline); window.removeEventListener("offline", handleOffline); }); }); return (
{t("network.offlineTitle")}
); }