переключение на графы и вывод модалки ветвления

This commit is contained in:
Tamara 2023-12-04 19:33:45 +03:00
parent 9ee2786956
commit 14efd54369
3 changed files with 7 additions and 6 deletions

@ -21,6 +21,7 @@ import SettingIcon from "../../assets/icons/questionsPage/settingIcon";
import type { AnyTypedQuizQuestion } from "../../model/questionTypes/shared";
import { updateOpenedModalSettingsId } from "@root/questions/actions";
import {enqueueSnackbar} from "notistack";
import {useQuestionsStore} from "@root/questions/store";
interface Props {
@ -38,14 +39,13 @@ export default function ButtonsOptions({
const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down(790));
const isWrappMiniButtonSetting = useMediaQuery(theme.breakpoints.down(920));
const {openBranchingPanel} = useQuestionsStore.getState()
const openedModal = () => {
updateOpenedModalSettingsId(question.id)
};
const handleClickBranching = (_, value) => {
const parentId = question.content.rule.parentId
console.log(parentId.length)
if (parentId.length === 0 ){
return enqueueSnackbar("Вопрос не учавствует в ветвлении")
}
@ -54,6 +54,7 @@ export default function ButtonsOptions({
}
if (parentId.length !== 0) {
setTimeout(() => updateOpenBranchingPanel(!value), 10)
openedModal()
}
}
@ -94,7 +95,7 @@ export default function ButtonsOptions({
),
title: "Ветвление",
value: "branching",
myFunc: openedModal, handleClickBranching
myFunc: handleClickBranching(question.id, openBranchingPanel),
},
];

@ -55,7 +55,6 @@ export default function ButtonsOptionsAndPict({
const handleClickBranching = (_, value) => {
const parentId = question.content.rule.parentId
console.log(parentId.length)
if (parentId.length === 0 ) {
return enqueueSnackbar("Вопрос не учавствует в ветвлении")
}
@ -64,6 +63,7 @@ export default function ButtonsOptionsAndPict({
}
if (parentId.length !== 0) {
setTimeout(() => updateOpenBranchingPanel(!value), 10)
updateOpenedModalSettingsId(question.id)
}
}
@ -203,7 +203,6 @@ export default function ButtonsOptionsAndPict({
onMouseEnter={() => setButtonHover("branching")}
onMouseLeave={() => setButtonHover("")}
onClick={() => {
updateOpenedModalSettingsId(question.id)
handleClickBranching(question.id, openBranchingPanel)
}}
sx={{

@ -24,7 +24,8 @@ export default function QuestionsPage() {
const { openedModalSettingsId } = useQuestionsStore();
const isMobile = useMediaQuery(theme.breakpoints.down(660));
const quiz = useCurrentQuiz();
const openBranchingPanel = useQuestionsStore.getState()
const {openBranchingPanel} = useQuestionsStore.getState()
if (!quiz) return null;
return (