Merge branch 'modalRefactor' into input-refactor
This commit is contained in:
commit
97045a3bc0
2 changed files with 15 additions and 3 deletions
|
|
@ -1,10 +1,11 @@
|
|||
import { useEffect, useState } from "react";
|
||||
import { useEffect, useState, useContext } from "react";
|
||||
import { InputListComponentType } from "../../types/components";
|
||||
|
||||
import _ from "lodash";
|
||||
import _, { set } from "lodash";
|
||||
import IconComponent from "../genericIconComponent";
|
||||
import { Input } from "../ui/input";
|
||||
import { classNames } from "../../utils/utils";
|
||||
import { PopUpContext } from "../../contexts/popUpContext";
|
||||
|
||||
export default function InputListComponent({
|
||||
value,
|
||||
|
|
@ -14,6 +15,13 @@ export default function InputListComponent({
|
|||
onAddInput,
|
||||
}: InputListComponentType) {
|
||||
const [inputList, setInputList] = useState(value ?? [""]);
|
||||
const { closeEdit } = useContext(PopUpContext);
|
||||
|
||||
useEffect(() => {
|
||||
if (value) {
|
||||
setInputList(value);
|
||||
}
|
||||
}, [closeEdit]);
|
||||
|
||||
useEffect(() => {
|
||||
if (disabled) {
|
||||
|
|
|
|||
|
|
@ -25,8 +25,9 @@ import { limitScrollFieldsModal } from "../../constants/constants";
|
|||
import { TabsContext } from "../../contexts/tabsContext";
|
||||
import { typesContext } from "../../contexts/typesContext";
|
||||
import { NodeDataType } from "../../types/flow";
|
||||
import { classNames } from "../../utils/utils";
|
||||
import { classNames, getRandomKeyByssmm } from "../../utils/utils";
|
||||
import BaseModal from "../baseModal";
|
||||
import { PopUpContext } from "../../contexts/popUpContext";
|
||||
|
||||
const EditNodeModal = forwardRef(
|
||||
(
|
||||
|
|
@ -47,6 +48,7 @@ const EditNodeModal = forwardRef(
|
|||
const [myData, setMyData] = useState(data);
|
||||
const { setTabsState, tabId } = useContext(TabsContext);
|
||||
const { reactFlowInstance } = useContext(typesContext);
|
||||
const { setCloseEdit } = useContext(PopUpContext);
|
||||
|
||||
let disabled =
|
||||
reactFlowInstance?.getEdges().some((e) => e.targetHandle === data.id) ??
|
||||
|
|
@ -70,8 +72,10 @@ const EditNodeModal = forwardRef(
|
|||
|
||||
useEffect(() => {
|
||||
setMyData(data); // reset data to what it is on node when opening modal
|
||||
setCloseEdit(getRandomKeyByssmm().toString());
|
||||
}, [modalOpen]);
|
||||
|
||||
|
||||
return (
|
||||
<BaseModal size="large-h-full" open={modalOpen} setOpen={setModalOpen}>
|
||||
<BaseModal.Trigger>{children}</BaseModal.Trigger>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue