Merge branch 'result-page' into upload-file
This commit is contained in:
commit
11200a38ca
@ -216,6 +216,7 @@ function CsComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const removeNode = ({ targetNodeContentId }: { targetNodeContentId: string }) => {
|
const removeNode = ({ targetNodeContentId }: { targetNodeContentId: string }) => {
|
||||||
const deleteNodes = [] as string[]
|
const deleteNodes = [] as string[]
|
||||||
const deleteEdges: any = []
|
const deleteEdges: any = []
|
||||||
@ -331,6 +332,7 @@ function CsComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (startCreate) {
|
if (startCreate) {
|
||||||
addNode({ parentNodeContentId: startCreate });
|
addNode({ parentNodeContentId: startCreate });
|
||||||
@ -734,10 +736,10 @@ function CsComponent({
|
|||||||
};
|
};
|
||||||
|
|
||||||
//node?.on("position", update);
|
//node?.on("position", update);
|
||||||
let pressed = false
|
let pressed = false
|
||||||
let hide = false
|
let hide = false
|
||||||
cy?.on('mousedown',() => {pressed = true})
|
cy?.on('mousedown', () => { pressed = true })
|
||||||
cy?.on('mouseup',() => {
|
cy?.on('mouseup', () => {
|
||||||
pressed = false
|
pressed = false
|
||||||
hide = false
|
hide = false
|
||||||
|
|
||||||
@ -750,22 +752,22 @@ let pressed = false
|
|||||||
if (pc) pc.style.display = 'block'
|
if (pc) pc.style.display = 'block'
|
||||||
if (xc) xc.style.display = 'block'
|
if (xc) xc.style.display = 'block'
|
||||||
if (lc) lc.style.display = 'block'
|
if (lc) lc.style.display = 'block'
|
||||||
update()
|
update()
|
||||||
})
|
})
|
||||||
|
|
||||||
cy?.on('mousemove',() => {
|
cy?.on('mousemove', () => {
|
||||||
if (pressed && !hide) {
|
if (pressed && !hide) {
|
||||||
hide = true
|
hide = true
|
||||||
const gc = gearsContainer.current
|
const gc = gearsContainer.current
|
||||||
if (gc) gc.style.display = 'none'
|
if (gc) gc.style.display = 'none'
|
||||||
const pc = plusesContainer.current
|
const pc = plusesContainer.current
|
||||||
const xc = crossesContainer.current
|
const xc = crossesContainer.current
|
||||||
const lc = layoutsContainer.current
|
const lc = layoutsContainer.current
|
||||||
if (pc) pc.style.display = 'none'
|
if (pc) pc.style.display = 'none'
|
||||||
if (xc) xc.style.display = 'none'
|
if (xc) xc.style.display = 'none'
|
||||||
if (lc) lc.style.display = 'block'
|
if (lc) lc.style.display = 'block'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
cy?.on("zoom render", onZoom);
|
cy?.on("zoom render", onZoom);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { Box } from "@mui/material"
|
import { Box } from "@mui/material"
|
||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import { updateDragQuestionContentId, updateQuestion } from "@root/questions/actions"
|
import { deleteQuestion, updateDragQuestionContentId, updateQuestion } from "@root/questions/actions"
|
||||||
import { updateRootContentId } from "@root/quizes/actions"
|
import { updateRootContentId } from "@root/quizes/actions"
|
||||||
import { useCurrentQuiz } from "@root/quizes/hooks"
|
import { useCurrentQuiz } from "@root/quizes/hooks"
|
||||||
import { useQuestionsStore } from "@root/questions/store"
|
import { useQuestionsStore } from "@root/questions/store"
|
||||||
@ -11,8 +11,9 @@ interface Props {
|
|||||||
modalQuestionTargetContentId: string;
|
modalQuestionTargetContentId: string;
|
||||||
}
|
}
|
||||||
export const FirstNodeField = ({ setOpenedModalQuestions, modalQuestionTargetContentId }: Props) => {
|
export const FirstNodeField = ({ setOpenedModalQuestions, modalQuestionTargetContentId }: Props) => {
|
||||||
|
|
||||||
const quiz = useCurrentQuiz();
|
const quiz = useCurrentQuiz();
|
||||||
const { dragQuestionContentId } = useQuestionsStore()
|
const { dragQuestionContentId, questions } = useQuestionsStore()
|
||||||
const Container = useRef<HTMLDivElement | null>(null);
|
const Container = useRef<HTMLDivElement | null>(null);
|
||||||
|
|
||||||
const modalOpen = () => setOpenedModalQuestions(true)
|
const modalOpen = () => setOpenedModalQuestions(true)
|
||||||
@ -22,6 +23,11 @@ export const FirstNodeField = ({ setOpenedModalQuestions, modalQuestionTargetCon
|
|||||||
if (dragQuestionContentId) {
|
if (dragQuestionContentId) {
|
||||||
updateRootContentId(quiz?.id, dragQuestionContentId)
|
updateRootContentId(quiz?.id, dragQuestionContentId)
|
||||||
updateQuestion(dragQuestionContentId, (question) => question.content.rule.parentId = "root")
|
updateQuestion(dragQuestionContentId, (question) => question.content.rule.parentId = "root")
|
||||||
|
//если были результаты - удалить
|
||||||
|
questions.forEach((q) => {
|
||||||
|
if (q.type === 'result') deleteQuestion(q.id)
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
enqueueSnackbar("Нет информации о взятом опроснике")
|
enqueueSnackbar("Нет информации о взятом опроснике")
|
||||||
@ -44,6 +50,10 @@ export const FirstNodeField = ({ setOpenedModalQuestions, modalQuestionTargetCon
|
|||||||
if (modalQuestionTargetContentId) {
|
if (modalQuestionTargetContentId) {
|
||||||
updateRootContentId(quiz?.id, modalQuestionTargetContentId)
|
updateRootContentId(quiz?.id, modalQuestionTargetContentId)
|
||||||
updateQuestion(modalQuestionTargetContentId, (question) => question.content.rule.parentId = "root")
|
updateQuestion(modalQuestionTargetContentId, (question) => question.content.rule.parentId = "root")
|
||||||
|
//если были результаты - удалить
|
||||||
|
questions.forEach((q) => {
|
||||||
|
if (q.type === 'result') deleteQuestion(q.id)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
enqueueSnackbar("Нет информации о взятом опроснике")
|
enqueueSnackbar("Нет информации о взятом опроснике")
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import {
|
|||||||
useMediaQuery,
|
useMediaQuery,
|
||||||
useTheme,
|
useTheme,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { copyQuestion, deleteQuestion, updateOpenBranchingPanel, updateDesireToOpenABranchingModal } from "@root/questions/actions";
|
import { copyQuestion, deleteQuestion, updateOpenBranchingPanel, updateDesireToOpenABranchingModal, updateOpenedModalSettingsId, clearRuleForAll } from "@root/questions/actions";
|
||||||
import MiniButtonSetting from "@ui_kit/MiniButtonSetting";
|
import MiniButtonSetting from "@ui_kit/MiniButtonSetting";
|
||||||
import { CopyIcon } from "../../assets/icons/questionsPage/CopyIcon";
|
import { CopyIcon } from "../../assets/icons/questionsPage/CopyIcon";
|
||||||
import Branching from "../../assets/icons/questionsPage/branching";
|
import Branching from "../../assets/icons/questionsPage/branching";
|
||||||
@ -22,7 +22,7 @@ import type { AnyTypedQuizQuestion } from "../../model/questionTypes/shared";
|
|||||||
import { useCurrentQuiz } from "@root/quizes/hooks";
|
import { useCurrentQuiz } from "@root/quizes/hooks";
|
||||||
import { enqueueSnackbar } from "notistack";
|
import { enqueueSnackbar } from "notistack";
|
||||||
import { useQuestionsStore } from "@root/questions/store";
|
import { useQuestionsStore } from "@root/questions/store";
|
||||||
import { updateOpenedModalSettingsId } from "@root/questions/actions";
|
import { updateRootContentId } from "@root/quizes/actions";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
switchState: string;
|
switchState: string;
|
||||||
@ -40,7 +40,7 @@ export default function ButtonsOptions({
|
|||||||
const isMobile = useMediaQuery(theme.breakpoints.down(790));
|
const isMobile = useMediaQuery(theme.breakpoints.down(790));
|
||||||
const isWrappMiniButtonSetting = useMediaQuery(theme.breakpoints.down(920));
|
const isWrappMiniButtonSetting = useMediaQuery(theme.breakpoints.down(920));
|
||||||
const quiz = useCurrentQuiz();
|
const quiz = useCurrentQuiz();
|
||||||
const { openBranchingPanel } = useQuestionsStore.getState()
|
const { questions } = useQuestionsStore.getState()
|
||||||
|
|
||||||
const openedModal = () => {
|
const openedModal = () => {
|
||||||
updateOpenedModalSettingsId(question.id)
|
updateOpenedModalSettingsId(question.id)
|
||||||
|
|||||||
@ -33,7 +33,6 @@ export const ResultSettings = () => {
|
|||||||
isReadyToLeave = false;
|
isReadyToLeave = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log(`setting isReadyToLeaveRef to ${isReadyToLeave}`);
|
|
||||||
isReadyToLeaveRef.current = isReadyToLeave;
|
isReadyToLeaveRef.current = isReadyToLeave;
|
||||||
}, [results])
|
}, [results])
|
||||||
|
|
||||||
|
|||||||
@ -1409,7 +1409,7 @@
|
|||||||
|
|
||||||
"@frontend/kitui@^1.0.54":
|
"@frontend/kitui@^1.0.54":
|
||||||
version "1.0.54"
|
version "1.0.54"
|
||||||
resolved "https://penahub.gitlab.yandexcloud.net/api/v4/projects/21/packages/npm/@frontend/kitui/-/@frontend/kitui-1.0.54.tgz"
|
resolved "https://penahub.gitlab.yandexcloud.net/api/v4/projects/21/packages/npm/@frontend/kitui/-/@frontend/kitui-1.0.54.tgz#0235d5a8effb9b92351471c3c7775f28cb2839f6"
|
||||||
integrity sha1-AjXVqO/7m5I1FHHDx3dfKMsoOfY=
|
integrity sha1-AjXVqO/7m5I1FHHDx3dfKMsoOfY=
|
||||||
dependencies:
|
dependencies:
|
||||||
immer "^10.0.2"
|
immer "^10.0.2"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user