🔨 refactor(ApiModal/index.tsx): remove unused imports and variables for cleaner code
🔥 chore(ApiModal/index.tsx): remove unused PopUpContext and related code 🔧 chore(ApiModal/index.tsx): remove unused setOpen function 🔧 chore(ApiModal/index.tsx): remove unnecessary useEffect dependency on flow["data"]["nodes"] 🔧 chore(ApiModal/index.tsx): remove unnecessary setOpenAccordion and tweakList.current assignments 🔧 chore(ApiModal/index.tsx): remove unnecessary setIsCopied assignment in copyToClipboard function 🔧 chore(ApiModal/index.tsx): remove unnecessary setCloseEdit calls in setOpen function 🔧 chore(ApiModal/index.tsx): remove unnecessary setOpen function argument in BaseModal component
This commit is contained in:
parent
728c625407
commit
e0e2be6d27
1 changed files with 2 additions and 15 deletions
|
|
@ -50,7 +50,6 @@ import { TabsContext } from "../../contexts/tabsContext";
|
||||||
import { FlowType } from "../../types/flow/index";
|
import { FlowType } from "../../types/flow/index";
|
||||||
import { buildTweaks, classNames } from "../../utils";
|
import { buildTweaks, classNames } from "../../utils";
|
||||||
import BaseModal from "../baseModal";
|
import BaseModal from "../baseModal";
|
||||||
import { PopUpContext } from "../../contexts/popUpContext";
|
|
||||||
|
|
||||||
const ApiModal = forwardRef(
|
const ApiModal = forwardRef(
|
||||||
(
|
(
|
||||||
|
|
@ -63,14 +62,12 @@ const ApiModal = forwardRef(
|
||||||
},
|
},
|
||||||
ref
|
ref
|
||||||
) => {
|
) => {
|
||||||
const { closeEdit, setCloseEdit } = useContext(PopUpContext);
|
|
||||||
const [activeTab, setActiveTab] = useState("0");
|
const [activeTab, setActiveTab] = useState("0");
|
||||||
const [isCopied, setIsCopied] = useState<Boolean>(false);
|
const [isCopied, setIsCopied] = useState<Boolean>(false);
|
||||||
const [openAccordion, setOpenAccordion] = useState([]);
|
const [openAccordion, setOpenAccordion] = useState([]);
|
||||||
const tweak = useRef([]);
|
const tweak = useRef([]);
|
||||||
const tweaksList = useRef([]);
|
const tweaksList = useRef([]);
|
||||||
const { setTweak, getTweak, tabsState } = useContext(TabsContext);
|
const { setTweak, getTweak, tabsState } = useContext(TabsContext);
|
||||||
|
|
||||||
const copyToClipboard = () => {
|
const copyToClipboard = () => {
|
||||||
if (!navigator.clipboard || !navigator.clipboard.writeText) {
|
if (!navigator.clipboard || !navigator.clipboard.writeText) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -110,14 +107,9 @@ const ApiModal = forwardRef(
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
tweaksList.current = [];
|
|
||||||
filterNodes();
|
filterNodes();
|
||||||
|
}, []);
|
||||||
}, [flow["data"]["nodes"]]);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (Object.keys(tweaksCode).length > 0) {
|
if (Object.keys(tweaksCode).length > 0) {
|
||||||
tabs.push({
|
tabs.push({
|
||||||
|
|
@ -246,13 +238,8 @@ const ApiModal = forwardRef(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const setOpen = (x: boolean) => {
|
|
||||||
x ? setCloseEdit("apimodal") : setCloseEdit("");
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BaseModal setOpen={setOpen}>
|
<BaseModal>
|
||||||
<BaseModal.Trigger>{children}</BaseModal.Trigger>
|
<BaseModal.Trigger>{children}</BaseModal.Trigger>
|
||||||
<BaseModal.Header description={EXPORT_CODE_DIALOG}>
|
<BaseModal.Header description={EXPORT_CODE_DIALOG}>
|
||||||
<span className="pr-2">Code</span>
|
<span className="pr-2">Code</span>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue