import { useState } from "react"; import { Switch } from "~/components/ui/switch"; import { Label } from "~/components/ui/label"; import { RadioGroup, RadioGroupItem } from "~/components/ui/radio-group"; import { Popover, PopoverAnchor, PopoverContent } from "~/components/ui/popover"; import type { NotificationMode } from "~/hooks/useDraftNotifications"; interface NotificationSettingsProps { enabled: boolean; onEnabledChange: (enabled: boolean) => void; mode: NotificationMode; onModeChange: (mode: NotificationMode) => void; permissionState: NotificationPermission | "unsupported"; switchOnly?: boolean; } export function NotificationSettings({ enabled, onEnabledChange, mode, onModeChange, permissionState, switchOnly = false, }: NotificationSettingsProps) { const [popoverOpen, setPopoverOpen] = useState(false); if (permissionState === "unsupported") { return null; } if (switchOnly) { const handleEnabledChange = (val: boolean) => { onEnabledChange(val); setPopoverOpen(val); }; return ( onModeChange(value as NotificationMode)} className="space-y-2" >
); } return (
{permissionState === "denied" && (

Notifications blocked by browser. Update in browser settings to enable.

)} {enabled && ( onModeChange(value as NotificationMode)} className="space-y-2 mt-3" >
)}
); }