Changed tooltip handler to not use PopupContext
This commit is contained in:
parent
d283ce5600
commit
07ff2cc52f
2 changed files with 11 additions and 21 deletions
|
|
@ -14,7 +14,6 @@ import PromptAreaComponent from "../../../../components/promptComponent";
|
||||||
import TextAreaComponent from "../../../../components/textAreaComponent";
|
import TextAreaComponent from "../../../../components/textAreaComponent";
|
||||||
import ToggleShadComponent from "../../../../components/toggleShadComponent";
|
import ToggleShadComponent from "../../../../components/toggleShadComponent";
|
||||||
import { MAX_LENGTH_TO_SCROLL_TOOLTIP } from "../../../../constants/constants";
|
import { MAX_LENGTH_TO_SCROLL_TOOLTIP } from "../../../../constants/constants";
|
||||||
import { PopUpContext } from "../../../../contexts/popUpContext";
|
|
||||||
import { TabsContext } from "../../../../contexts/tabsContext";
|
import { TabsContext } from "../../../../contexts/tabsContext";
|
||||||
import { typesContext } from "../../../../contexts/typesContext";
|
import { typesContext } from "../../../../contexts/typesContext";
|
||||||
import { ParameterComponentType } from "../../../../types/components";
|
import { ParameterComponentType } from "../../../../types/components";
|
||||||
|
|
@ -52,7 +51,8 @@ export default function ParameterComponent({
|
||||||
const updateNodeInternals = useUpdateNodeInternals();
|
const updateNodeInternals = useUpdateNodeInternals();
|
||||||
const [position, setPosition] = useState(0);
|
const [position, setPosition] = useState(0);
|
||||||
const { setTabsState, tabId, save, flows } = useContext(TabsContext);
|
const { setTabsState, tabId, save, flows } = useContext(TabsContext);
|
||||||
const { closeEdit } = useContext(PopUpContext);
|
|
||||||
|
const flow = flows.find((f) => f.id === tabId).data.nodes;
|
||||||
|
|
||||||
// Update component position
|
// Update component position
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -87,6 +87,7 @@ export default function ParameterComponent({
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
renderTooltips();
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -102,14 +103,8 @@ export default function ParameterComponent({
|
||||||
);
|
);
|
||||||
}, [info]);
|
}, [info]);
|
||||||
|
|
||||||
useEffect(() => {
|
function renderTooltips() {
|
||||||
let groupedObj = groupByFamily(
|
let groupedObj = groupByFamily(myData, tooltipTitle, left, data.type, flow);
|
||||||
myData,
|
|
||||||
tooltipTitle,
|
|
||||||
left,
|
|
||||||
data.type,
|
|
||||||
flows.find((f) => f.id === tabId).data.nodes
|
|
||||||
);
|
|
||||||
|
|
||||||
if (groupedObj?.length === 0) {
|
if (groupedObj?.length === 0) {
|
||||||
groupedObj = groupByFamilyCustom(
|
groupedObj = groupByFamilyCustom(
|
||||||
|
|
@ -117,7 +112,7 @@ export default function ParameterComponent({
|
||||||
tooltipTitle,
|
tooltipTitle,
|
||||||
left,
|
left,
|
||||||
data.type,
|
data.type,
|
||||||
flows.find((f) => f.id === tabId).data.nodes
|
flow
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -172,11 +167,11 @@ export default function ParameterComponent({
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [
|
}
|
||||||
tooltipTitle,
|
|
||||||
flows.find((f) => f.id === tabId).data.nodes.length,
|
useEffect(() => {
|
||||||
closeEdit,
|
renderTooltips();
|
||||||
]);
|
}, [tooltipTitle, flow.length]);
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,9 @@ import { Button } from "../../components/ui/button";
|
||||||
import { CODE_PROMPT_DIALOG_SUBTITLE } from "../../constants/constants";
|
import { CODE_PROMPT_DIALOG_SUBTITLE } from "../../constants/constants";
|
||||||
import { alertContext } from "../../contexts/alertContext";
|
import { alertContext } from "../../contexts/alertContext";
|
||||||
import { darkContext } from "../../contexts/darkContext";
|
import { darkContext } from "../../contexts/darkContext";
|
||||||
import { PopUpContext } from "../../contexts/popUpContext";
|
|
||||||
import { typesContext } from "../../contexts/typesContext";
|
import { typesContext } from "../../contexts/typesContext";
|
||||||
import { postCustomComponent, postValidateCode } from "../../controllers/API";
|
import { postCustomComponent, postValidateCode } from "../../controllers/API";
|
||||||
import { APIClassType } from "../../types/api";
|
import { APIClassType } from "../../types/api";
|
||||||
import { getRandomKeyByssmm } from "../../utils/utils";
|
|
||||||
import BaseModal from "../baseModal";
|
import BaseModal from "../baseModal";
|
||||||
|
|
||||||
export default function CodeAreaModal({
|
export default function CodeAreaModal({
|
||||||
|
|
@ -41,7 +39,6 @@ export default function CodeAreaModal({
|
||||||
const [error, setError] = useState<{
|
const [error, setError] = useState<{
|
||||||
detail: { error: string; traceback: string };
|
detail: { error: string; traceback: string };
|
||||||
}>(null);
|
}>(null);
|
||||||
const { setCloseEdit } = useContext(PopUpContext);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// if nodeClass.template has more fields other than code and dynamic is true
|
// if nodeClass.template has more fields other than code and dynamic is true
|
||||||
|
|
@ -64,7 +61,6 @@ export default function CodeAreaModal({
|
||||||
});
|
});
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
setValue(code);
|
setValue(code);
|
||||||
setCloseEdit(getRandomKeyByssmm().toString());
|
|
||||||
// setValue(code);
|
// setValue(code);
|
||||||
} else {
|
} else {
|
||||||
if (funcErrors.length !== 0) {
|
if (funcErrors.length !== 0) {
|
||||||
|
|
@ -101,7 +97,6 @@ export default function CodeAreaModal({
|
||||||
setNodeClass(data);
|
setNodeClass(data);
|
||||||
setValue(code);
|
setValue(code);
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
setCloseEdit(getRandomKeyByssmm().toString());
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue