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