import { useState } from "react"; import { Download } from "lucide-react"; import { applyUpdate, installApp, useOnline, usePwa } from "../pwa/client"; import { Button } from "./design-system/primitives"; import { Modal } from "./design-system/Modal"; export function InstallApp() { const { enabled, installed, installPrompt } = usePwa(); const [help, setHelp] = useState(false); if (!enabled || installed) return null; return <> {help && setHelp(false)}>

iPhone or iPad: open the Share menu, then choose Add to Home Screen.

Mac Safari: choose File → Add to Dock.

Chrome or Edge: use the install icon in the address bar, or Install app in the browser menu.

An internet connection is required to load and save habits.

} ; } export function PwaStatus() { const online = useOnline(); const { updateReady, error } = usePwa(); const [confirmUpdate, setConfirmUpdate] = useState(false); return <> {!online &&
You’re offline. Reconnect to load or save your habits. Changes are not queued.
} {error &&
{error}
} {updateReady &&
A new version of Mina Habits is ready.
} {confirmUpdate && setConfirmUpdate(false)}>

This window will reload. Save any unfinished changes first.

} ; }