Removed closePopup from API modal
This commit is contained in:
parent
eaa4f1343a
commit
f3b4e6e76f
4 changed files with 16 additions and 36 deletions
|
|
@ -18,7 +18,6 @@ export default function AccordionComponent({
|
||||||
|
|
||||||
console.log(open);
|
console.log(open);
|
||||||
|
|
||||||
|
|
||||||
function getOpenAccordion() {
|
function getOpenAccordion() {
|
||||||
let value = "";
|
let value = "";
|
||||||
open.forEach((el) => {
|
open.forEach((el) => {
|
||||||
|
|
|
||||||
|
|
@ -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,13 @@ const ApiModal = forwardRef(
|
||||||
},
|
},
|
||||||
ref
|
ref
|
||||||
) => {
|
) => {
|
||||||
|
|
||||||
const [activeTab, setActiveTab] = useState("0");
|
const [activeTab, setActiveTab] = useState("0");
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
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 { closePopUp } = useContext(PopUpContext);
|
|
||||||
|
|
||||||
const copyToClipboard = () => {
|
const copyToClipboard = () => {
|
||||||
if (!navigator.clipboard || !navigator.clipboard.writeText) {
|
if (!navigator.clipboard || !navigator.clipboard.writeText) {
|
||||||
|
|
@ -109,22 +107,18 @@ const ApiModal = forwardRef(
|
||||||
image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png",
|
image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png",
|
||||||
code: pythonCode,
|
code: pythonCode,
|
||||||
},
|
},
|
||||||
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
function startState(){
|
function startState() {
|
||||||
tweak.current = [];
|
tweak.current = [];
|
||||||
setTweak([]);
|
setTweak([]);
|
||||||
tweaksList.current = [];
|
tweaksList.current = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (flow["data"]["nodes"].length == 0) {
|
||||||
if(flow["data"]["nodes"].length == 0){
|
|
||||||
startState();
|
startState();
|
||||||
}
|
} else {
|
||||||
|
|
||||||
else {
|
|
||||||
tweak.current = [];
|
tweak.current = [];
|
||||||
const t = buildTweaks(flow);
|
const t = buildTweaks(flow);
|
||||||
tweak.current.push(t);
|
tweak.current.push(t);
|
||||||
|
|
@ -159,12 +153,9 @@ const ApiModal = forwardRef(
|
||||||
mode: "python",
|
mode: "python",
|
||||||
image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png",
|
image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png",
|
||||||
code: pythonCode,
|
code: pythonCode,
|
||||||
}
|
},
|
||||||
|
]);
|
||||||
])
|
} else {
|
||||||
}
|
|
||||||
|
|
||||||
else{
|
|
||||||
setTabs([
|
setTabs([
|
||||||
{
|
{
|
||||||
name: "cURL",
|
name: "cURL",
|
||||||
|
|
@ -184,13 +175,10 @@ const ApiModal = forwardRef(
|
||||||
mode: "python",
|
mode: "python",
|
||||||
image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png",
|
image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png",
|
||||||
code: pythonCode,
|
code: pythonCode,
|
||||||
}
|
},
|
||||||
|
]);
|
||||||
])
|
|
||||||
}
|
}
|
||||||
|
}, [flow["data"]["nodes"], open]);
|
||||||
}, [flow["data"]["nodes"], closePopUp]);
|
|
||||||
|
|
||||||
|
|
||||||
function filterNodes() {
|
function filterNodes() {
|
||||||
let arrNodesWithValues = [];
|
let arrNodesWithValues = [];
|
||||||
|
|
@ -309,20 +297,13 @@ const ApiModal = forwardRef(
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if(accordionsToOpen.length == 0){
|
if (accordionsToOpen.length == 0) {
|
||||||
setOpenAccordion([]);
|
setOpenAccordion([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const setOpen = (x: boolean) => {
|
|
||||||
if(x) {
|
|
||||||
closePopUp();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BaseModal setOpen={setOpen}>
|
<BaseModal open={open} setOpen={setOpen}>
|
||||||
<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>
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,12 @@ import {
|
||||||
TableHeader,
|
TableHeader,
|
||||||
TableRow,
|
TableRow,
|
||||||
} from "../../components/ui/table";
|
} from "../../components/ui/table";
|
||||||
|
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 { NodeDataType } from "../../types/flow";
|
import { NodeDataType } from "../../types/flow";
|
||||||
import { classNames, limitScrollFieldsModal } from "../../utils";
|
import { classNames, limitScrollFieldsModal } from "../../utils";
|
||||||
import BaseModal from "../baseModal";
|
import BaseModal from "../baseModal";
|
||||||
import { PopUpContext } from "../../contexts/popUpContext";
|
|
||||||
|
|
||||||
const EditNodeModal = forwardRef(
|
const EditNodeModal = forwardRef(
|
||||||
(
|
(
|
||||||
|
|
@ -76,7 +76,7 @@ const EditNodeModal = forwardRef(
|
||||||
};
|
};
|
||||||
|
|
||||||
const setOpen = (x: boolean) => {
|
const setOpen = (x: boolean) => {
|
||||||
if(!x) {
|
if (!x) {
|
||||||
closePopUp();
|
closePopUp();
|
||||||
}
|
}
|
||||||
if (nodeLength > 0) setModalOpen(x);
|
if (nodeLength > 0) setModalOpen(x);
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ module.exports = {
|
||||||
keyframes: {
|
keyframes: {
|
||||||
slideDown: {
|
slideDown: {
|
||||||
from: { height: 0 },
|
from: { height: 0 },
|
||||||
to: { height: '100vh' },
|
to: { height: "100vh" },
|
||||||
},
|
},
|
||||||
slideUp: {
|
slideUp: {
|
||||||
from: { height: "var(--radix-accordion-content-height)" },
|
from: { height: "var(--radix-accordion-content-height)" },
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue