import "./index.css"; import { FC } from "react"; import CircularProgress from "@mui/material/CircularProgress"; import ReactFlow, { Controls } from "react-flow-renderer"; import { NodeEditor } from "components/NodeEditor"; import { Modal } from "components/Modal"; import { nodeTypes } from "../nodes"; import { DAGGraphBoardProps } from "./types"; export const DAGGraphBoard: FC = ({ modalState, state, closeModal, additionalControls, }) => { // render unready or errored states if (!state.ready) { return (
); } if ("error" in state.data) { return
{state.data.error}
; } // useEffect(() => { // if (state.ready) { // reactFlow.fitView(); // } // }, [state.ready, reactFlow]); // modal let modalBody = <>; if (modalState) { modalBody = ( { modalState.update(n as any); closeModal(); }} allowedTypes={modalState.allowedTypes} saveBtnCreateText={modalState.saveBtnCreateText} /> ); } const elements = { nodes: state.data.elements.nodes, edges: state.data.elements.edges, }; // main render return ( <> {modalBody} {additionalControls} ); };