import { usePushNotifications } from "~/hooks/usePushNotifications"; /** * A settings row with a switch to enable/disable web push notifications. * Mirrors the existing theme-toggle row styling on the settings pages. */ export function PushSettingToggle({ className = "" }: { className?: string }) { const { supported, permission, isSubscribed, subscribe, disable, busy } = usePushNotifications(); const blocked = permission === "denied"; const checked = isSubscribed && permission === "granted"; const onToggle = () => { if (busy || blocked) return; if (checked) { disable(); } else { subscribe(); } }; return (
اعلانها
{blocked ? "اعلانها در مرورگر مسدود شدهاند. از تنظیمات مرورگر اجازه دهید." : !supported ? "مرورگر شما از اعلان پشتیبانی نمیکند." : "دریافت اعلان برای پیامها و وضعیت سفارشها"}