"use client"; // Topbar bell → offline-notification control. Click opens a small popover to enable/disable Web Push // for this browser. The dot is lit when this browser is subscribed. Hidden entirely when push isn't // available (demo mode, or a browser without ServiceWorker/PushManager). import { useState } from "react"; import { Icon } from "./ui"; import { usePushNotifications } from "@/lib/push-notifications"; export function NotificationBell() { const push = usePushNotifications(); const [open, setOpen] = useState(false); if (!push.supported) return null; const denied = push.permission === "denied"; return (
{push.subscribed ? "You'll get push notifications for new direct messages and mentions, even when this tab is closed." : "Get notified about direct messages and mentions when the CRM isn't open."}
{denied ? (Notifications are blocked in your browser settings. Allow them for this site, then try again.
) : push.subscribed ? ( ) : ( )} {push.error &&{push.error}
}