import { useEffect, useState } from "react" import { Button } from "@/components/ui/button" interface PwaUpdateToastProps { needRefresh: boolean updateServiceWorker: (() => Promise) | undefined } export function PwaUpdateToast({ needRefresh, updateServiceWorker, }: PwaUpdateToastProps) { const [dismissed, setDismissed] = useState(false) useEffect(() => { if (needRefresh) { setDismissed(false) } }, [needRefresh]) if (!needRefresh || dismissed) { return null } return (

A new version is available.

Reload to update the dashboard.

) }