🔥 refactor(genericModal/index.tsx): remove unused imports and lodash set function

🐛 fix(genericModal/index.tsx): update error message to be more descriptive and change setErrorData to setNoticeData
The commit removes unused imports for Tooltip components and the lodash set function, as they are no longer used in the file. Additionally, the error message displayed when the template does not contain any variables for data entry is updated to be more descriptive. Instead of setting an error message, a notice message is set using the setNoticeData function from the alertContext. This provides a clearer message to the user about the absence of variables in the template.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-07-06 15:51:13 -03:00
commit f6ed832f26

View file

@ -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);