From f6ed832f26caf131a4ca699aa96cc335242166fd Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 6 Jul 2023 15:51:13 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20refactor(genericModal/index.tsx)?= =?UTF-8?q?:=20remove=20unused=20imports=20and=20lodash=20set=20function?= =?UTF-8?q?=20=F0=9F=90=9B=20fix(genericModal/index.tsx):=20update=20error?= =?UTF-8?q?=20message=20to=20be=20more=20descriptive=20and=20change=20setE?= =?UTF-8?q?rrorData=20to=20setNoticeData=20The=20commit=20removes=20unused?= =?UTF-8?q?=20imports=20for=20Tooltip=20components=20and=20the=20lodash=20?= =?UTF-8?q?set=20function,=20as=20they=20are=20no=20longer=20used=20in=20t?= =?UTF-8?q?he=20file.=20Additionally,=20the=20error=20message=20displayed?= =?UTF-8?q?=20when=20the=20template=20does=20not=20contain=20any=20variabl?= =?UTF-8?q?es=20for=20data=20entry=20is=20updated=20to=20be=20more=20descr?= =?UTF-8?q?iptive.=20Instead=20of=20setting=20an=20error=20message,=20a=20?= =?UTF-8?q?notice=20message=20is=20set=20using=20the=20setNoticeData=20fun?= =?UTF-8?q?ction=20from=20the=20alertContext.=20This=20provides=20a=20clea?= =?UTF-8?q?rer=20message=20to=20the=20user=20about=20the=20absence=20of=20?= =?UTF-8?q?variables=20in=20the=20template.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/modals/genericModal/index.tsx | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/frontend/src/modals/genericModal/index.tsx b/src/frontend/src/modals/genericModal/index.tsx index 3367c956b..0e68a02e7 100644 --- a/src/frontend/src/modals/genericModal/index.tsx +++ b/src/frontend/src/modals/genericModal/index.tsx @@ -30,14 +30,7 @@ import { varHighlightHTML, } from "../../utils"; import { Badge } from "../../components/ui/badge"; -import { - Tooltip, - TooltipContent, - TooltipProvider, - TooltipTrigger, -} from "../../components/ui/tooltip"; import ShadTooltip from "../../components/ShadTooltipComponent"; -import { set } from "lodash"; import DOMPurify from "dompurify"; export default function GenericModal({ @@ -68,7 +61,8 @@ export default function GenericModal({ const [wordsHighlightInvalid, setWordsHighlightInvalid] = useState([]); const [wordsHighlight, setWordsHighlight] = useState([]); const { dark } = useContext(darkContext); - const { setErrorData, setSuccessData } = useContext(alertContext); + const { setErrorData, setSuccessData, setNoticeData } = + useContext(alertContext); const { closePopUp, setCloseEdit } = useContext(PopUpContext); const ref = useRef(); function setModalOpen(x: boolean) { @@ -149,9 +143,8 @@ export default function GenericModal({ let inputVariables = apiReturn.data.input_variables; if (inputVariables.length === 0) { setIsEdit(true); - setErrorData({ - title: - "The template you are attempting to use does not contain any variables for data entry.", + setNoticeData({ + title: "Your template does not have any variables.", }); } else { setIsEdit(false);