import React from "react"; import { UseFormReturn } from "react-hook-form"; import { FormField, FormItem, FormLabel, FormControl, FormMessage, FormDescription, } from "@/components/ui/form"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Trash2 } from "lucide-react"; import { CampaignActionFields } from "./CampaignActionFields"; import { ManageSubscriberActionFields } from "./ManageSubscriberActionFields"; import { TransactionalEmailActionFields } from "./TransactionalEmailActionFields"; import { ListmonkList, ListmonkTemplate } from "@/lib/types"; interface ActionFormProps { form: UseFormReturn; index: number; remove: (index: number) => void; lists: ListmonkList[]; templates: ListmonkTemplate[]; } export function ActionForm({ form, index, remove, lists, templates, }: ActionFormProps) { const actionType: string = form.watch(`actions.${index}.type`); const trigger: string = form.watch("trigger"); return ( Action {index + 1} ( Action Type {actionType === "manage_subscriber" && (

This action will automatically create the subscriber on listmonk if he doesn't exist already.

Subscribers will be automatically added or removed to lists with the same name as the newsletters on Ghost.
)}
)} /> {actionType === "create_campaign" && ( )} {actionType === "manage_subscriber" && trigger === "member_created" && ( )} {actionType === "send_transactional_email" && ( )}
); }