import { PlusIcon } from "@radix-ui/react-icons"; import { cn } from "@/util/utils"; import { AutoResizingTextarea } from "./AutoResizingTextarea/AutoResizingTextarea"; import { Popover, PopoverContent, PopoverTrigger } from "./ui/popover"; import { WorkflowBlockParameterSelect } from "@/routes/workflows/editor/nodes/WorkflowBlockParameterSelect"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "./ui/tooltip"; import { useEdges, useNodes } from "@xyflow/react"; type Props = Omit< React.ComponentProps, "onChange" > & { onChange: (value: string) => void; nodeId: string; isFirstInputInNode?: boolean; }; function WorkflowBlockInputTextarea(props: Props) { const { nodeId, onChange, ...textAreaProps } = props; const edges = useEdges(); const nodes = useNodes(); function isInsideFirstNode() { const node = nodes.find((node) => node.id === nodeId); if (!node) { return; } const incomingEdge = edges.find((edge) => edge.target === node.id); if (!incomingEdge) { return; } const source = incomingEdge.source; const sourceNode = nodes.find((node) => node.id === source); if (!sourceNode) { return; } return !node.parentId && sourceNode.type === "start"; } const showInputTooltip = isInsideFirstNode() && props.isFirstInputInNode; return (
{ onChange(event.target.value); }} className={cn("pr-9", props.className)} />
Add parameters using the + button
{ onChange(`${props.value ?? ""}{{${parameterKey}}}`); }} />
); } export { WorkflowBlockInputTextarea };