- {type === TypeModal.PROMPT && (
-
-
-
-
-
- Prompt Variables:
-
+
+
+
+
+
+ Prompt Variables:
+
- {Array.from(wordsHighlight).map((word, index) => (
-
(
+
+
-
-
-
- {word.replace(/[{}]/g, "").length > 59
- ? word.replace(/[{}]/g, "").slice(0, 56) + "..."
- : word.replace(/[{}]/g, "")}
-
-
-
-
- ))}
-
+
+
+ {word.replace(/[{}]/g, "").length > 59
+ ? word.replace(/[{}]/g, "").slice(0, 56) + "..."
+ : word.replace(/[{}]/g, "")}
+
+
+
+
+ ))}
-
- Prompt variables can be created with any chosen name inside
- curly brackets, e.g. {"{variable_name}"}
-
- )}
+
+ Prompt variables can be created with any chosen name inside
+ curly brackets, e.g. {"{variable_name}"}
+
+
diff --git a/src/frontend/src/modals/genericModal/utils/var-highlight-html.tsx b/src/frontend/src/modals/promptModal/utils/var-highlight-html.tsx
similarity index 100%
rename from src/frontend/src/modals/genericModal/utils/var-highlight-html.tsx
rename to src/frontend/src/modals/promptModal/utils/var-highlight-html.tsx
diff --git a/src/frontend/src/modals/textAreaModal/index.tsx b/src/frontend/src/modals/textAreaModal/index.tsx
new file mode 100644
index 000000000..b825801ec
--- /dev/null
+++ b/src/frontend/src/modals/textAreaModal/index.tsx
@@ -0,0 +1,106 @@
+import { useEffect, useRef, useState } from "react";
+import IconComponent from "../../components/genericIconComponent";
+import { Button } from "../../components/ui/button";
+import { Textarea } from "../../components/ui/textarea";
+import {
+ EDIT_TEXT_PLACEHOLDER,
+ TEXT_DIALOG_SUBTITLE,
+} from "../../constants/constants";
+import { textModalPropsType } from "../../types/components";
+import { handleKeyDown } from "../../utils/reactflowUtils";
+import { classNames } from "../../utils/utils";
+import BaseModal from "../baseModal";
+
+export default function ComponentTextModal({
+ value,
+ setValue,
+ children,
+ disabled,
+ readonly = false,
+ password,
+ changeVisibility,
+}: textModalPropsType): JSX.Element {
+ const [modalOpen, setModalOpen] = useState(false);
+ const [inputValue, setInputValue] = useState(value);
+
+ const textRef = useRef
(null);
+ useEffect(() => {
+ if (typeof value === "string") setInputValue(value);
+ }, [value, modalOpen]);
+
+ return (
+ {}}
+ open={modalOpen}
+ setOpen={setModalOpen}
+ >
+
+ {children}
+
+
+
+
+
+ {TEXT_DIALOG_SUBTITLE}
+
+
+
+ {password !== undefined && (
+
+
+
+ )}
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/src/frontend/src/style/applies.css b/src/frontend/src/style/applies.css
index 8c0f2cb5c..3f9a8df77 100644
--- a/src/frontend/src/style/applies.css
+++ b/src/frontend/src/style/applies.css
@@ -196,7 +196,7 @@
/* The same as primary-input but no-truncate */
.textarea-primary {
- @apply form-input block w-full rounded-md border-border bg-muted px-3 text-left shadow-sm placeholder:text-muted-foreground focus:border-ring focus:placeholder-transparent focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 sm:text-sm;
+ @apply form-input block w-full rounded-md border-border bg-background px-3 text-left shadow-sm placeholder:text-muted-foreground focus:border-ring focus:placeholder-transparent focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 sm:text-sm;
}
.input-edit-node {
diff --git a/src/frontend/src/types/components/index.ts b/src/frontend/src/types/components/index.ts
index 6e489f0e3..fb1722ed0 100644
--- a/src/frontend/src/types/components/index.ts
+++ b/src/frontend/src/types/components/index.ts
@@ -700,6 +700,28 @@ export type genericModalPropsType = {
changeVisibility?: () => void;
};
+export type PromptModalType = {
+ field_name?: string;
+ setValue: (value: string) => void;
+ value: string;
+ disabled?: boolean;
+ nodeClass?: APIClassType;
+ setNodeClass?: (Class: APIClassType, type?: string) => void;
+ children: ReactNode;
+ id?: string;
+ readonly?: boolean;
+};
+
+export type textModalPropsType = {
+ setValue: (value: string) => void;
+ value: string;
+ disabled?: boolean;
+ children: ReactNode;
+ readonly?: boolean;
+ password?: boolean;
+ changeVisibility?: () => void;
+};
+
export type newFlowModalPropsType = {
open: boolean;
setOpen: (open: boolean) => void;