brackt/app/components/league/settings/NotificationsSection.tsx
Chris Parsons b1a1a472f5 Refactor league settings into per-section components (#347)
Extract all settings sections from the monolithic 1009-line route file into
individual components under app/components/league/settings/. Route file drops
to ~300 lines. Separates draft-order dirty state from general settings dirty
state, deduplicates section-change handling, and fixes several bugs found
during review (typo in pointsFor5th, wrong mock in tests, lint violations).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-05 14:00:35 -07:00

42 lines
1.4 KiB
TypeScript

import { Bell } from "lucide-react";
import { Input } from "~/components/ui/input";
import { Label } from "~/components/ui/label";
import { SettingsSection, SettingsStatusPill } from "./SettingsSection";
export function NotificationsSection({
active,
savedDiscordWebhookUrl,
discordWebhookUrl,
onDiscordWebhookUrlChange,
}: {
active: boolean;
savedDiscordWebhookUrl: string | null;
discordWebhookUrl: string;
onDiscordWebhookUrlChange: (v: string) => void;
}) {
return (
<SettingsSection
id="notifications"
icon={Bell}
title="Notifications"
description="Send Discord alerts when standings change after scoring events."
status={<SettingsStatusPill tone={savedDiscordWebhookUrl ? "success" : "warning"}>{savedDiscordWebhookUrl ? "Configured" : "Optional"}</SettingsStatusPill>}
className={active ? undefined : "hidden"}
>
<div className="space-y-2">
<Label htmlFor="discordWebhookUrl">Discord Webhook URL</Label>
<Input
id="discordWebhookUrl"
name="discordWebhookUrl"
type="url"
value={discordWebhookUrl}
onChange={(e) => onDiscordWebhookUrlChange(e.target.value)}
placeholder="https://discord.com/api/webhooks/..."
/>
<p className="text-sm text-muted-foreground">
Create a webhook in Discord under Server Settings, Integrations, Webhooks.
</p>
</div>
</SettingsSection>
);
}