import { useFetcher, Link } from "react-router"; type Props = { discordPingEnabled: boolean; hasDiscordLinked: boolean; success?: boolean; }; export function NotificationsSection({ discordPingEnabled, hasDiscordLinked, success }: Props) { const fetcher = useFetcher(); const optimisticEnabled = fetcher.state !== "idle" ? fetcher.formData?.get("discordPingEnabled") === "true" : discordPingEnabled; const handleToggle = () => { fetcher.submit( { intent: "update-discord-ping", discordPingEnabled: String(!optimisticEnabled) }, { method: "post" } ); }; return (
Manage how you receive league notifications.
Link your Discord account in{" "} Account settings {" "} to enable Discord pings for league notifications.
) : ( <>Ping me in standings updates
When enabled, you'll be @mentioned in league Discord notifications and your Discord display name will appear in place of your brackt username.
Notification preference saved.
)} > )}