diff --git a/src/frontend/src/constants.tsx b/src/frontend/src/constants.tsx index b9dd2aa1f..4f01bafb4 100644 --- a/src/frontend/src/constants.tsx +++ b/src/frontend/src/constants.tsx @@ -11,6 +11,12 @@ import { buildInputs, buildTweaks } from "./utils"; */ export const MAX_LENGTH_TO_SCROLL_TOOLTIP = 200; +/** + * Number maximum of components to scroll on tooltips + * @constant + */ +export const MAX_WORDS_HIGHLIGHT = 110; + /** * The base text for subtitle of Export Dialog (Toolbar) * @constant diff --git a/src/frontend/src/index.css b/src/frontend/src/index.css index dfe862183..411da9ff7 100644 --- a/src/frontend/src/index.css +++ b/src/frontend/src/index.css @@ -935,6 +935,10 @@ The cursor: default; property value restores the browser's default cursor style .code-highlight{ @apply block px-3 py-2 w-full max-h-[64vh] text-sm outline-0 border-0 break-all overflow-y-hidden } + + .code-nohighlight{ + @apply block px-3 py-2 w-full max-h-[70vh] text-sm outline-0 border-0 break-all overflow-y-hidden + } .form-modal-lockchat { @apply form-input focus:ring-ring focus:border-ring block w-full rounded-md border-border p-4 pr-16 custom-scroll sm:text-sm } diff --git a/src/frontend/src/modals/genericModal/index.tsx b/src/frontend/src/modals/genericModal/index.tsx index 3565b1673..ca2ec585c 100644 --- a/src/frontend/src/modals/genericModal/index.tsx +++ b/src/frontend/src/modals/genericModal/index.tsx @@ -6,7 +6,7 @@ import { Badge } from "../../components/ui/badge"; import { Button } from "../../components/ui/button"; import { DialogTitle } from "../../components/ui/dialog"; import { Textarea } from "../../components/ui/textarea"; -import { PROMPT_DIALOG_SUBTITLE, TEXT_DIALOG_SUBTITLE } from "../../constants"; +import { MAX_WORDS_HIGHLIGHT, PROMPT_DIALOG_SUBTITLE, TEXT_DIALOG_SUBTITLE } from "../../constants"; import { alertContext } from "../../contexts/alertContext"; import { darkContext } from "../../contexts/darkContext"; import { PopUpContext } from "../../contexts/popUpContext"; @@ -110,7 +110,7 @@ export default function GenericModal({ const TextAreaContentView = () => { return ( { setIsEdit(true); @@ -120,6 +120,16 @@ export default function GenericModal({ ); }; + function getClassByNumberLength(){ + let sumOfCaracteres: number = 0; + wordsHighlight.forEach(element => { + sumOfCaracteres = sumOfCaracteres + element.replace(/[{}]/g, "").length + }); + console.log(sumOfCaracteres); + + return sumOfCaracteres > MAX_WORDS_HIGHLIGHT ? "code-highlight" : "code-nohighlight" + } + function validatePrompt(closeModal: boolean) { postValidatePrompt(field_name, inputValue, nodeClass)