2026-02-20 17:05:40 +00:00
|
|
|
import { Switch } from "~/components/ui/switch";
|
|
|
|
|
import { Label } from "~/components/ui/label";
|
|
|
|
|
|
|
|
|
|
interface NotificationSettingsProps {
|
|
|
|
|
enabled: boolean;
|
|
|
|
|
onEnabledChange: (enabled: boolean) => void;
|
|
|
|
|
permissionState: NotificationPermission | "unsupported";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function NotificationSettings({
|
|
|
|
|
enabled,
|
|
|
|
|
onEnabledChange,
|
|
|
|
|
permissionState,
|
|
|
|
|
}: NotificationSettingsProps) {
|
2026-02-20 21:45:35 +00:00
|
|
|
if (permissionState === "unsupported") {
|
2026-02-20 17:05:40 +00:00
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="border-t pt-4 mt-4">
|
|
|
|
|
<div className="flex items-center justify-between">
|
|
|
|
|
<Label htmlFor="notifications-switch" className="text-sm font-semibold">
|
|
|
|
|
Notifications
|
|
|
|
|
</Label>
|
|
|
|
|
<Switch
|
|
|
|
|
id="notifications-switch"
|
|
|
|
|
checked={enabled}
|
|
|
|
|
onCheckedChange={onEnabledChange}
|
|
|
|
|
disabled={permissionState === "denied"}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{permissionState === "denied" && (
|
|
|
|
|
<p className="text-xs text-muted-foreground mt-2">
|
|
|
|
|
Notifications blocked by browser. Update in browser settings to
|
|
|
|
|
enable.
|
|
|
|
|
</p>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|