🐛 fix(parameterComponent): set disabled prop to false in TextAreaComponent to enable editing
✨ feat(GenericNode): import Zap icon from lucide-react to use in validation status tooltip 🐛 fix(textAreaComponent): import classNames from utils to fix missing import error 🐛 fix(constants): update HIGHLIGH_CSS constant to add overflow-y-hidden and max-w-[75vw] classes 🐛 fix(ApiModal): add condition to check if tweak.current exists before calling startTweaks() ✨ feat(ApiModal): import Variable icon from lucide-react to use in input variables section 🐛 fix(genericModal): import Variable icon from lucide-react to use in input variables section 🐛 fix(utils): add newline character to INVALID_CHARACTERS array 🐛 fix(tailwind.config.js): set height property to "8px" for scrollbar in custom-scroll class
This commit is contained in:
parent
54b13a6bb6
commit
4595d51e62
8 changed files with 68 additions and 65 deletions
|
|
@ -222,7 +222,7 @@ export default function ParameterComponent({
|
||||||
/>
|
/>
|
||||||
) : data.node.template[name].multiline ? (
|
) : data.node.template[name].multiline ? (
|
||||||
<TextAreaComponent
|
<TextAreaComponent
|
||||||
disabled={disabled}
|
disabled={false}
|
||||||
value={data.node.template[name].value ?? ""}
|
value={data.node.template[name].value ?? ""}
|
||||||
onChange={handleOnNewValue}
|
onChange={handleOnNewValue}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import { NodeToolbar } from "reactflow";
|
||||||
import NodeToolbarComponent from "../../pages/FlowPage/components/nodeToolbarComponent";
|
import NodeToolbarComponent from "../../pages/FlowPage/components/nodeToolbarComponent";
|
||||||
import ShadTooltip from "../../components/ShadTooltipComponent";
|
import ShadTooltip from "../../components/ShadTooltipComponent";
|
||||||
import { useSSE } from "../../contexts/SSEContext";
|
import { useSSE } from "../../contexts/SSEContext";
|
||||||
|
import { Zap } from "lucide-react";
|
||||||
|
|
||||||
export default function GenericNode({
|
export default function GenericNode({
|
||||||
data,
|
data,
|
||||||
|
|
@ -117,7 +118,8 @@ export default function GenericNode({
|
||||||
<Tooltip
|
<Tooltip
|
||||||
title={
|
title={
|
||||||
!validationStatus ? (
|
!validationStatus ? (
|
||||||
"Validating..."
|
<span className="flex">Build <Zap className="mx-0.5 h-5 fill-build-trigger stroke-build-trigger stroke-1" strokeWidth={1.5} /> flow to validate status.</span>
|
||||||
|
|
||||||
) : (
|
) : (
|
||||||
<div className="max-h-96 overflow-auto">
|
<div className="max-h-96 overflow-auto">
|
||||||
{validationStatus.params
|
{validationStatus.params
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { useContext, useEffect, useState } from "react";
|
||||||
import { PopUpContext } from "../../contexts/popUpContext";
|
import { PopUpContext } from "../../contexts/popUpContext";
|
||||||
import { TextAreaComponentType } from "../../types/components";
|
import { TextAreaComponentType } from "../../types/components";
|
||||||
import GenericModal from "../../modals/genericModal";
|
import GenericModal from "../../modals/genericModal";
|
||||||
import { TypeModal } from "../../utils";
|
import { TypeModal, classNames } from "../../utils";
|
||||||
|
|
||||||
import { ExternalLink } from "lucide-react";
|
import { ExternalLink } from "lucide-react";
|
||||||
|
|
||||||
|
|
@ -30,34 +30,24 @@ export default function TextAreaComponent({
|
||||||
<div className={disabled ? "cursor-not-allowed" : ""}>
|
<div className={disabled ? "cursor-not-allowed" : ""}>
|
||||||
<div
|
<div
|
||||||
className={
|
className={
|
||||||
(editNode ? "w-full items-center" : "flex w-full items-center") +
|
(editNode ? "w-full relative top-2" : "flex w-full items-center") +
|
||||||
(disabled ? " pointer-events-none" : "")
|
(disabled ? " pointer-events-none" : "")
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<span
|
|
||||||
onClick={() => {
|
<input
|
||||||
openPopUp(
|
|
||||||
<GenericModal
|
|
||||||
type={TypeModal.TEXT}
|
|
||||||
buttonText="Finishing Editing"
|
|
||||||
modalTitle="Edit Text"
|
|
||||||
value={myValue}
|
value={myValue}
|
||||||
setValue={(t: string) => {
|
|
||||||
setMyValue(t);
|
|
||||||
onChange(t);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
className={
|
className={
|
||||||
editNode
|
editNode
|
||||||
? "input-edit-node input-dialog "
|
? "input-edit-node"
|
||||||
: "input-dialog input-primary " +
|
: "input-primary" + (disabled ? " input-disable " : "")
|
||||||
(disabled ? "input-disable" : "")
|
|
||||||
}
|
}
|
||||||
>
|
placeholder={"Type something..."}
|
||||||
{myValue !== "" ? myValue : "Type something..."}
|
onChange={(e) => {
|
||||||
</span>
|
setMyValue(e.target.value);
|
||||||
|
onChange(e.target.value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|
|
||||||
|
|
@ -529,4 +529,4 @@ export const USER_PROJECTS_HEADER = "My Collection";
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export const HIGHLIGH_CSS =
|
export const HIGHLIGH_CSS =
|
||||||
"block pl-3 pr-14 py-2 w-full h-full text-sm outline-0 border-0 break-all";
|
"block pl-3 pr-14 py-2 w-full h-full text-sm outline-0 border-0 break-all overflow-y-hidden max-w-[75vw]";
|
||||||
|
|
|
||||||
|
|
@ -111,8 +111,10 @@ export default function ApiModal({ flow }: { flow: FlowType }) {
|
||||||
startTweaks();
|
startTweaks();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if(tweak?.current){
|
||||||
startTweaks();
|
startTweaks();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}, [closeEdit]);
|
}, [closeEdit]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -313,7 +315,7 @@ export default function ApiModal({ flow }: { flow: FlowType }) {
|
||||||
>
|
>
|
||||||
{index < 3 ? (
|
{index < 3 ? (
|
||||||
<SyntaxHighlighter
|
<SyntaxHighlighter
|
||||||
className="h-[60vh] w-full overflow-auto"
|
className="h-[60vh] w-full overflow-auto custom-scroll"
|
||||||
language={tab.mode}
|
language={tab.mode}
|
||||||
style={oneDark}
|
style={oneDark}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ import {
|
||||||
import ShadTooltip from "../../components/ShadTooltipComponent";
|
import ShadTooltip from "../../components/ShadTooltipComponent";
|
||||||
import { set } from "lodash";
|
import { set } from "lodash";
|
||||||
import DOMPurify from "dompurify";
|
import DOMPurify from "dompurify";
|
||||||
|
import { Variable } from "lucide-react";
|
||||||
|
|
||||||
export default function GenericModal({
|
export default function GenericModal({
|
||||||
field_name = "",
|
field_name = "",
|
||||||
|
|
@ -206,39 +207,6 @@ export default function GenericModal({
|
||||||
</DialogDescription>
|
</DialogDescription>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|
||||||
{type == TypeModal.PROMPT &&
|
|
||||||
inputValue &&
|
|
||||||
inputValue != "" &&
|
|
||||||
wordsHighlight.length > 0 && (
|
|
||||||
<>
|
|
||||||
<div>
|
|
||||||
<span className="">Variables: </span>
|
|
||||||
{wordsHighlight.map((word, index) => (
|
|
||||||
<ShadTooltip
|
|
||||||
key={getRandomKeyByssmm() + index}
|
|
||||||
content={word.replace(/[{}]/g, "")}
|
|
||||||
asChild={false}
|
|
||||||
delayDuration={1500}
|
|
||||||
>
|
|
||||||
<Badge
|
|
||||||
key={index}
|
|
||||||
size="lg"
|
|
||||||
className="m-1 max-w-[40vw] cursor-default truncate p-2.5 text-sm"
|
|
||||||
>
|
|
||||||
<div className="relative bottom-[1px]">
|
|
||||||
<span>
|
|
||||||
{word.replace(/[{}]/g, "").length > 59
|
|
||||||
? word.replace(/[{}]/g, "").slice(0, 56) + "..."
|
|
||||||
: word.replace(/[{}]/g, "")}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</Badge>
|
|
||||||
</ShadTooltip>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
className={classNames(
|
className={classNames(
|
||||||
!isEdit ? "rounded-lg border" : "",
|
!isEdit ? "rounded-lg border" : "",
|
||||||
|
|
@ -248,7 +216,7 @@ export default function GenericModal({
|
||||||
{type == TypeModal.PROMPT && isEdit ? (
|
{type == TypeModal.PROMPT && isEdit ? (
|
||||||
<Textarea
|
<Textarea
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className="form-input h-full w-full rounded-lg border-gray-300 focus-visible:ring-1 dark:border-gray-700 dark:bg-gray-900 dark:text-white"
|
className="form-input h-full w-full rounded-lg border-gray-300 focus-visible:ring-1 dark:border-gray-700 dark:bg-gray-900 dark:text-white custom-scroll"
|
||||||
value={inputValue}
|
value={inputValue}
|
||||||
onBlur={() => {
|
onBlur={() => {
|
||||||
blur();
|
blur();
|
||||||
|
|
@ -278,6 +246,45 @@ export default function GenericModal({
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
{type == TypeModal.PROMPT && (
|
||||||
|
<>
|
||||||
|
<div className="">
|
||||||
|
<div className="items-center flex flex-wrap">
|
||||||
|
<Variable className=" -ml-px mr-1 h-4 w-4 text-primary flex"></Variable>
|
||||||
|
<span className="text-md font-semibold text-primary">
|
||||||
|
Input Variables: {wordsHighlight &&
|
||||||
|
wordsHighlight.length == 0 ? '-' : ''}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
{wordsHighlight.map((word, index) => (
|
||||||
|
<ShadTooltip
|
||||||
|
key={getRandomKeyByssmm() + index}
|
||||||
|
content={word.replace(/[{}]/g, "")}
|
||||||
|
asChild={false}
|
||||||
|
delayDuration={1500}
|
||||||
|
>
|
||||||
|
<Badge
|
||||||
|
key={index}
|
||||||
|
variant="gray" size="md"
|
||||||
|
className="m-1 max-w-[40vw] cursor-default truncate p-2.5 text-sm"
|
||||||
|
>
|
||||||
|
<div className="relative bottom-[1px]">
|
||||||
|
<span>
|
||||||
|
{word.replace(/[{}]/g, "").length > 59
|
||||||
|
? word.replace(/[{}]/g, "").slice(0, 56) + "..."
|
||||||
|
: word.replace(/[{}]/g, "")}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</Badge>
|
||||||
|
</ShadTooltip>
|
||||||
|
))}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
<Button
|
<Button
|
||||||
className="mt-3"
|
className="mt-3"
|
||||||
|
|
|
||||||
|
|
@ -1022,6 +1022,7 @@ export const INVALID_CHARACTERS = [
|
||||||
")",
|
")",
|
||||||
"[",
|
"[",
|
||||||
"]",
|
"]",
|
||||||
|
"\n"
|
||||||
];
|
];
|
||||||
|
|
||||||
export const regexHighlight = /\{([^}]+)\}/g;
|
export const regexHighlight = /\{([^}]+)\}/g;
|
||||||
|
|
|
||||||
|
|
@ -199,6 +199,7 @@ module.exports = {
|
||||||
".custom-scroll": {
|
".custom-scroll": {
|
||||||
"&::-webkit-scrollbar": {
|
"&::-webkit-scrollbar": {
|
||||||
width: "8px",
|
width: "8px",
|
||||||
|
height: "8px"
|
||||||
},
|
},
|
||||||
"&::-webkit-scrollbar-track": {
|
"&::-webkit-scrollbar-track": {
|
||||||
backgroundColor: "#f1f1f1",
|
backgroundColor: "#f1f1f1",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue