Make email block parameterized (#1581)

This commit is contained in:
Shuchang Zheng
2025-01-16 10:18:08 -08:00
committed by GitHub
parent 1694698255
commit 7fe979062a

View File

@@ -1,5 +1,4 @@
import { HelpTooltip } from "@/components/HelpTooltip"; import { HelpTooltip } from "@/components/HelpTooltip";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label"; import { Label } from "@/components/ui/label";
import { Separator } from "@/components/ui/separator"; import { Separator } from "@/components/ui/separator";
import { useDeleteNodeCallback } from "@/routes/workflows/hooks/useDeleteNodeCallback"; import { useDeleteNodeCallback } from "@/routes/workflows/hooks/useDeleteNodeCallback";
@@ -12,6 +11,8 @@ import { EditableNodeTitle } from "../components/EditableNodeTitle";
import { NodeActionMenu } from "../NodeActionMenu"; import { NodeActionMenu } from "../NodeActionMenu";
import { WorkflowBlockIcon } from "../WorkflowBlockIcon"; import { WorkflowBlockIcon } from "../WorkflowBlockIcon";
import { type SendEmailNode } from "./types"; import { type SendEmailNode } from "./types";
import { WorkflowBlockInput } from "@/components/WorkflowBlockInput";
import { WorkflowBlockInputTextarea } from "@/components/WorkflowBlockInputTextarea";
function SendEmailNode({ id, data }: NodeProps<SendEmailNode>) { function SendEmailNode({ id, data }: NodeProps<SendEmailNode>) {
const { updateNodeData } = useReactFlow(); const { updateNodeData } = useReactFlow();
@@ -77,12 +78,10 @@ function SendEmailNode({ id, data }: NodeProps<SendEmailNode>) {
</div> </div>
<div className="space-y-2"> <div className="space-y-2">
<Label className="text-xs text-slate-300">Recipients</Label> <Label className="text-xs text-slate-300">Recipients</Label>
<Input <WorkflowBlockInput
onChange={(event) => { nodeId={id}
if (!data.editable) { onChange={(value) => {
return; handleChange("recipients", value);
}
handleChange("recipients", event.target.value);
}} }}
value={inputs.recipients} value={inputs.recipients}
placeholder="example@gmail.com, example2@gmail.com..." placeholder="example@gmail.com, example2@gmail.com..."
@@ -92,12 +91,10 @@ function SendEmailNode({ id, data }: NodeProps<SendEmailNode>) {
<Separator /> <Separator />
<div className="space-y-2"> <div className="space-y-2">
<Label className="text-xs text-slate-300">Subject</Label> <Label className="text-xs text-slate-300">Subject</Label>
<Input <WorkflowBlockInput
onChange={(event) => { nodeId={id}
if (!data.editable) { onChange={(value) => {
return; handleChange("subject", value);
}
handleChange("subject", event.target.value);
}} }}
value={inputs.subject} value={inputs.subject}
placeholder="What is the gist?" placeholder="What is the gist?"
@@ -106,12 +103,10 @@ function SendEmailNode({ id, data }: NodeProps<SendEmailNode>) {
</div> </div>
<div className="space-y-2"> <div className="space-y-2">
<Label className="text-xs text-slate-300">Body</Label> <Label className="text-xs text-slate-300">Body</Label>
<Input <WorkflowBlockInputTextarea
onChange={(event) => { nodeId={id}
if (!data.editable) { onChange={(value) => {
return; handleChange("body", value);
}
handleChange("body", event.target.value);
}} }}
value={inputs.body} value={inputs.body}
placeholder="What would you like to say?" placeholder="What would you like to say?"
@@ -126,13 +121,11 @@ function SendEmailNode({ id, data }: NodeProps<SendEmailNode>) {
content={helpTooltips["sendEmail"]["fileAttachments"]} content={helpTooltips["sendEmail"]["fileAttachments"]}
/> />
</div> </div>
<Input <WorkflowBlockInput
nodeId={id}
value={inputs.fileAttachments} value={inputs.fileAttachments}
onChange={(event) => { onChange={(value) => {
if (!data.editable) { handleChange("fileAttachments", value);
return;
}
handleChange("fileAttachments", event.target.value);
}} }}
disabled disabled
className="nopan text-xs" className="nopan text-xs"