Files
formbricks/apps/web/modules/integrations/webhooks/components/trigger-checkbox-group.tsx
T
Dhruwang Jariwala a5fa876aa3 feat: refactor translation key management (#6717)
Co-authored-by: Piyush Gupta <piyushguptaa2z123@gmail.com>
Co-authored-by: Piyush Gupta <56182734+gupta-piyush19@users.noreply.github.com>
Co-authored-by: Victor Hugo dos Santos <115753265+victorvhs017@users.noreply.github.com>
Co-authored-by: pandeymangg <anshuman.pandey9999@gmail.com>
Co-authored-by: Matti Nannt <matti@formbricks.com>
Co-authored-by: Matti Nannt <mail@matthiasnannt.com>
Co-authored-by: Johannes <johannes@formbricks.com>
Co-authored-by: Johannes <72809645+jobenjada@users.noreply.github.com>
2025-10-23 14:53:11 +00:00

69 lines
2.0 KiB
TypeScript

"use client";
import { PipelineTriggers } from "@prisma/client";
import React from "react";
import { useTranslation } from "react-i18next";
import { Checkbox } from "@/modules/ui/components/checkbox";
interface TriggerCheckboxGroupProps {
selectedTriggers: PipelineTriggers[];
onCheckboxChange: (selectedValue: PipelineTriggers) => void;
allowChanges: boolean;
}
export const TriggerCheckboxGroup: React.FC<TriggerCheckboxGroupProps> = ({
selectedTriggers,
onCheckboxChange,
allowChanges,
}) => {
const { t } = useTranslation();
const triggers: {
title: string;
value: PipelineTriggers;
}[] = [
{
title: t("environments.integrations.webhooks.response_created"),
value: "responseCreated",
},
{
title: t("environments.integrations.webhooks.response_updated"),
value: "responseUpdated",
},
{
title: t("environments.integrations.webhooks.response_finished"),
value: "responseFinished",
},
];
return (
<div className="mt-1 rounded-lg border border-slate-200">
<div className="grid content-center rounded-lg bg-slate-50 p-3 text-left text-sm text-slate-900">
{triggers.map((trigger) => (
<div key={trigger.value} className="my-1 flex items-center space-x-2">
<label
htmlFor={trigger.value}
className={`flex ${
!allowChanges ? "cursor-not-allowed opacity-50" : "cursor-pointer"
} items-center`}>
<Checkbox
type="button"
id={trigger.value}
value={trigger.value}
className="bg-white"
checked={selectedTriggers.includes(trigger.value)}
onCheckedChange={() => {
if (allowChanges) {
onCheckboxChange(trigger.value);
}
}}
disabled={!allowChanges}
/>
<span className="ml-2">{trigger.title}</span>
</label>
</div>
))}
</div>
</div>
);
};