"use client"; import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { Input } from "@kandev/ui/input"; import { Label } from "@kandev/ui/label"; type GitHubPushConfigProps = { config: Record; onUpdate: (config: Record) => void; }; export function GitHubPushConfig({ config, onUpdate }: GitHubPushConfigProps) { const { t } = useTranslation(); const configBranches = ((config.branches as string[]) ?? []).join(", "); const [branches, setBranches] = useState(configBranches); useEffect(() => { setBranches(configBranches); }, [configBranches]); const handleBlur = () => { const parsed = branches .split(",") .map((b) => b.trim()) .filter(Boolean); onUpdate({ ...config, branches: parsed }); }; return (
{/* Example branch glob patterns — data the user types verbatim. */} setBranches(e.target.value)} onBlur={handleBlur} // eslint-disable-next-line i18next/no-literal-string -- example branch globs, see above placeholder="main, release/*" />

{t("automations:pushTriggerHelp")}

); }