frontPanel/src/pages/Questions/BranchingMap/index.tsx

44 lines
1.9 KiB
TypeScript
Raw Normal View History

2023-11-29 15:45:15 +00:00
import { Box } from "@mui/material";
import { FirstNodeField } from "./FirstNodeField";
import { CsComponent } from "./CsComponent";
import { useQuestionsStore } from "@root/questions/store"
import { useCurrentQuiz } from "@root/quizes/hooks";
2023-12-01 08:12:59 +00:00
import { useState } from "react";
import {BranchingQuestionsModal} from "../BranchingQuestionsModal"
2023-11-29 15:45:15 +00:00
export const BranchingMap = () => {
const quiz = useCurrentQuiz();
const { dragQuestionContentId } = useQuestionsStore()
const [modalQuestionParentContentId, setModalQuestionParentContentId] = useState<string>("")
const [modalQuestionTargetContentId, setModalQuestionTargetContentId] = useState<string>("")
const [openedModalQuestions, setOpenedModalQuestions] = useState<boolean>(false)
2023-11-29 15:45:15 +00:00
2023-12-04 13:33:43 +00:00
2023-11-29 15:45:15 +00:00
return (
<Box
id="cytoscape-container"
sx={{
overflow: "hidden",
padding: "20px",
background: "#FFFFFF",
borderRadius: "12px",
boxShadow: "0px 8px 24px rgba(210, 208, 225, 0.4)",
marginBottom: "40px",
height: "521px",
border: dragQuestionContentId === null ? "none" : "#7e2aea 2px dashed"
2023-11-29 15:45:15 +00:00
}}
>
{
quiz?.config.haveRoot ?
<CsComponent modalQuestionParentContentId={modalQuestionParentContentId} modalQuestionTargetContentId={modalQuestionTargetContentId} setOpenedModalQuestions={setOpenedModalQuestions} setModalQuestionParentContentId={setModalQuestionParentContentId} setModalQuestionTargetContentId={setModalQuestionTargetContentId}/>
2023-11-29 15:45:15 +00:00
:
<FirstNodeField setOpenedModalQuestions={setOpenedModalQuestions} modalQuestionTargetContentId={modalQuestionTargetContentId}/>
2023-11-29 15:45:15 +00:00
}
<BranchingQuestionsModal openedModalQuestions={openedModalQuestions} setOpenedModalQuestions={setOpenedModalQuestions} setModalQuestionTargetContentId={setModalQuestionTargetContentId} />
2023-11-29 15:45:15 +00:00
</Box>
);
};