feat(webhooks): add webhook fields to frontend types, api, and edit sheet
This commit is contained in:
@@ -756,6 +756,8 @@ interface EditChannelSheetProps {
|
||||
logo?: string | null;
|
||||
logo_position?: LogoPosition;
|
||||
logo_opacity?: number;
|
||||
webhook_url?: string | null;
|
||||
webhook_poll_interval_secs?: number;
|
||||
},
|
||||
) => void;
|
||||
isPending: boolean;
|
||||
@@ -787,6 +789,8 @@ export function EditChannelSheet({
|
||||
const [logo, setLogo] = useState<string | null>(null);
|
||||
const [logoPosition, setLogoPosition] = useState<LogoPosition>("top_right");
|
||||
const [logoOpacity, setLogoOpacity] = useState(100);
|
||||
const [webhookUrl, setWebhookUrl] = useState("");
|
||||
const [webhookPollInterval, setWebhookPollInterval] = useState<number | "">(5);
|
||||
const [selectedBlockId, setSelectedBlockId] = useState<string | null>(null);
|
||||
const [fieldErrors, setFieldErrors] = useState<FieldErrors>({});
|
||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||
@@ -804,6 +808,8 @@ export function EditChannelSheet({
|
||||
setLogo(channel.logo ?? null);
|
||||
setLogoPosition(channel.logo_position ?? "top_right");
|
||||
setLogoOpacity(Math.round((channel.logo_opacity ?? 1) * 100));
|
||||
setWebhookUrl(channel.webhook_url ?? "");
|
||||
setWebhookPollInterval(channel.webhook_poll_interval_secs ?? 5);
|
||||
setSelectedBlockId(null);
|
||||
setFieldErrors({});
|
||||
}
|
||||
@@ -836,6 +842,10 @@ export function EditChannelSheet({
|
||||
logo: logo,
|
||||
logo_position: logoPosition,
|
||||
logo_opacity: logoOpacity / 100,
|
||||
webhook_url: webhookUrl || null,
|
||||
...(webhookUrl
|
||||
? { webhook_poll_interval_secs: webhookPollInterval === "" ? 5 : webhookPollInterval }
|
||||
: {}),
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1085,6 +1095,28 @@ export function EditChannelSheet({
|
||||
onChange={setRecyclePolicy}
|
||||
/>
|
||||
</section>
|
||||
|
||||
{/* Webhook */}
|
||||
<section className="space-y-3">
|
||||
<h3 className="text-xs font-semibold uppercase tracking-wider text-zinc-500">Webhook</h3>
|
||||
<Field label="Webhook URL" hint="POST events to this URL on broadcast changes">
|
||||
<TextInput
|
||||
value={webhookUrl}
|
||||
onChange={setWebhookUrl}
|
||||
placeholder="https://example.com/webhook"
|
||||
/>
|
||||
</Field>
|
||||
{webhookUrl && (
|
||||
<Field label="Poll interval (seconds)" hint="How often to check for broadcast changes">
|
||||
<NumberInput
|
||||
value={webhookPollInterval}
|
||||
onChange={setWebhookPollInterval}
|
||||
min={1}
|
||||
placeholder="5"
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
</section>
|
||||
</div>
|
||||
|
||||
{/* Footer */}
|
||||
|
||||
Reference in New Issue
Block a user