import type { WebhookFormat } from "@/hooks/use-channel-form"; import { WEBHOOK_PRESETS } from "@/hooks/use-channel-form"; function Field({ label, hint, children, }: { label: string; hint?: string; children: React.ReactNode; }) { return (
{children} {hint &&

{hint}

}
); } interface WebhookEditorProps { webhookUrl: string; webhookPollInterval: number | ""; webhookFormat: WebhookFormat; webhookBodyTemplate: string; webhookHeaders: string; onWebhookUrlChange: (v: string) => void; onWebhookPollIntervalChange: (v: number | "") => void; onWebhookFormatChange: (fmt: WebhookFormat) => void; onWebhookBodyTemplateChange: (v: string) => void; onWebhookHeadersChange: (v: string) => void; } export function WebhookEditor({ webhookUrl, webhookPollInterval, webhookFormat, webhookBodyTemplate, webhookHeaders, onWebhookUrlChange, onWebhookPollIntervalChange, onWebhookFormatChange, onWebhookBodyTemplateChange, onWebhookHeadersChange, }: WebhookEditorProps) { return (
onWebhookUrlChange(e.target.value)} placeholder="https://example.com/webhook" className="w-full rounded-md border border-zinc-700 bg-zinc-800 px-3 py-2 text-sm text-zinc-100 placeholder:text-zinc-600 focus:border-zinc-500 focus:outline-none" /> {webhookUrl && ( <> onWebhookPollIntervalChange( e.target.value === "" ? "" : Number(e.target.value), ) } className="w-full rounded-md border border-zinc-700 bg-zinc-800 px-3 py-2 text-sm text-zinc-100 placeholder:text-zinc-600 focus:border-zinc-500 focus:outline-none" />

Payload format

{(["default", "discord", "slack", "custom"] as WebhookFormat[]).map( (fmt) => ( ), )}
{webhookFormat !== "default" && (