анкета не отваливается при создании результата и перехода на стр вопросов
This commit is contained in:
parent
7dfa0069a2
commit
5f191a258d
@ -18,7 +18,6 @@ function createQuestion(body: CreateQuestionRequest) {
|
||||
}
|
||||
|
||||
async function getQuestionList(body?: Partial<GetQuestionListRequest>) {
|
||||
console.log("body" , body)
|
||||
if (!body?.quiz_id) return null;
|
||||
|
||||
const response = await makeRequest<GetQuestionListRequest, GetQuestionListResponse>({
|
||||
|
||||
@ -17,8 +17,6 @@ interface Props {
|
||||
export default function ButtonsNewField ({SSHC, switchState, type}:Props) {
|
||||
const theme = useTheme();
|
||||
const quiz = useCurrentQuiz()
|
||||
console.log(quiz)
|
||||
console.log(type)
|
||||
const buttonSetting: {icon: JSX.Element; title: string; value: string} [] =[
|
||||
{icon: <NameIcon color={switchState === 'name' ? '#ffffff' : theme.palette.grey3.main}/>, title: 'Имя', value: 'name'},
|
||||
{icon: <EmailIcon color={switchState === 'email' ? '#ffffff' : theme.palette.grey3.main}/>, title: 'Email', value: 'email'},
|
||||
|
||||
@ -18,7 +18,6 @@ interface Props {
|
||||
|
||||
export default function NewFieldParent({ drawerNewFieldHC, defaultValue, placeholderHelp, placeholderField, outerContainerSx: sx, children }: Props) {
|
||||
const quiz = useCurrentQuiz()
|
||||
console.log({ defaultValue, placeholderHelp, placeholderField, outerContainerSx: sx, children })
|
||||
return (
|
||||
<Box sx={{ padding: '20px', display: 'flex', flexDirection: 'column', gap: '20px' }}>
|
||||
<Box sx={{ display: 'flex', flexDirection: 'column', gap: '15px' }}>
|
||||
@ -73,7 +72,6 @@ export default function NewFieldParent({ drawerNewFieldHC, defaultValue, placeho
|
||||
<CustomCheckbox
|
||||
checked={quiz.config.formContact[defaultValue].required}
|
||||
handleChange={({ target }) => {
|
||||
console.log("click")
|
||||
updateQuiz(quiz.id, (quiz) => {
|
||||
quiz.config.formContact[defaultValue].required = target.checked
|
||||
})
|
||||
|
||||
@ -14,7 +14,6 @@ interface Props {
|
||||
|
||||
export default function SwitchNewField({switchState ='name', drawerNewFieldHC}: Props) {
|
||||
const [SwitchMask, setSwitchMask] = React.useState(false);
|
||||
console.log(switchState)
|
||||
const SwitchMaskHC = (bool:boolean) => {
|
||||
setSwitchMask(bool)
|
||||
}
|
||||
|
||||
@ -48,7 +48,6 @@ type BackgroundType = "text" | "video";
|
||||
|
||||
export default function InstallQuiz() {
|
||||
const quiz = useCurrentQuiz()
|
||||
console.log(quiz)
|
||||
|
||||
const [display, setDisplay] = React.useState("1");
|
||||
const handleChange = (event: SelectChangeEvent) => {
|
||||
|
||||
@ -197,7 +197,6 @@ function CsComponent({
|
||||
}
|
||||
])
|
||||
cy?.layout(lyopts).run()
|
||||
console.log(es)
|
||||
cy?.center(es)
|
||||
} else {
|
||||
enqueueSnackbar("Добавляемый вопрос не найден")
|
||||
@ -212,7 +211,6 @@ function CsComponent({
|
||||
//смотрим не добавлен ли родителю result. Если да - убираем его. Веточкам result не нужен
|
||||
trashQuestions.forEach((targetQuestion) => {
|
||||
if (targetQuestion.type === "result" && targetQuestion.content.rule.parentId === parentQuestion.content.id) {
|
||||
console.log('deleteQ', targetQuestion.id)
|
||||
deleteQuestion(targetQuestion.id);
|
||||
}
|
||||
})
|
||||
@ -237,7 +235,6 @@ function CsComponent({
|
||||
|
||||
|
||||
const removeNode = ({ targetNodeContentId }: { targetNodeContentId: string }) => {
|
||||
console.log("старт удаление")
|
||||
const deleteNodes = [] as string[]
|
||||
const deleteEdges: any = []
|
||||
const cy = cyRef?.current
|
||||
@ -672,7 +669,6 @@ function CsComponent({
|
||||
gearElement.style.zIndex = "1"
|
||||
gearsContainer.current?.appendChild(gearElement);
|
||||
gearElement.addEventListener("mouseup", (e) => {
|
||||
console.log("up")
|
||||
updateOpenedModalSettingsId(item.id())
|
||||
});
|
||||
|
||||
@ -828,16 +824,6 @@ function CsComponent({
|
||||
}}
|
||||
autoungrabify={true}
|
||||
/>
|
||||
{/* <button onClick={() => {
|
||||
console.log("NODES____________________________")
|
||||
cyRef.current?.elements().forEach((ele: any) => {
|
||||
console.log(ele.data())
|
||||
})
|
||||
}}>nodes</button>
|
||||
<button onClick={() => {
|
||||
console.log("ELEMENTS____________________________")
|
||||
console.log(questions)
|
||||
}}>elements</button> */}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@ -18,7 +18,6 @@ export const FirstNodeField = ({ setOpenedModalQuestions, modalQuestionTargetCon
|
||||
|
||||
useLayoutEffect(() => {
|
||||
updateOpenedModalSettingsId()
|
||||
console.log("first render firstComponent")
|
||||
updateRootContentId(quiz.id, "")
|
||||
clearRuleForAll()
|
||||
}, [])
|
||||
|
||||
@ -106,7 +106,6 @@ export default function ButtonsOptions({
|
||||
deleteQuestion(question.id);
|
||||
|
||||
} else {
|
||||
console.log("удаляю безтипогово");
|
||||
deleteQuestion(question.id);
|
||||
}
|
||||
};
|
||||
@ -149,7 +148,6 @@ export default function ButtonsOptions({
|
||||
title: "Ветвление",
|
||||
value: "branching",
|
||||
myFunc: (question) => {
|
||||
console.log("buttons opiums")
|
||||
updateOpenBranchingPanel(true);
|
||||
updateDesireToOpenABranchingModal(question.content.id);
|
||||
}
|
||||
|
||||
@ -107,7 +107,6 @@ export default function ButtonsOptionsAndPict({
|
||||
deleteQuestion(question.id);
|
||||
|
||||
} else {
|
||||
console.log("удаляю безтипогово");
|
||||
deleteQuestion(question.id);
|
||||
}
|
||||
};
|
||||
@ -254,7 +253,6 @@ export default function ButtonsOptionsAndPict({
|
||||
onMouseEnter={() => setButtonHover("branching")}
|
||||
onMouseLeave={() => setButtonHover("")}
|
||||
onClick={() => {
|
||||
console.log("buttonsOptions")
|
||||
updateOpenBranchingPanel(true);
|
||||
updateDesireToOpenABranchingModal(question.content.id);
|
||||
}}
|
||||
|
||||
@ -123,7 +123,6 @@ export default function QuestionsPageCard({ question, draggableProps, isDragging
|
||||
|
||||
deleteQuestion(question.id);
|
||||
} else {
|
||||
console.log("удаляю безтипогово");
|
||||
deleteQuestion(question.id);
|
||||
}
|
||||
};
|
||||
|
||||
@ -6,8 +6,7 @@ import FormDraggableListItem from "./FormDraggableListItem";
|
||||
import { useQuestions } from "@root/questions/hooks";
|
||||
|
||||
export const FormDraggableList = () => {
|
||||
const { questions } = useQuestions();
|
||||
|
||||
const questions = useQuestions().questions.filter((q) => q.type !== "result");
|
||||
const onDragEnd = ({ destination, source }: DropResult) => {
|
||||
if (destination) reorderQuestions(source.index, destination.index);
|
||||
};
|
||||
|
||||
@ -13,6 +13,7 @@ export default function FormQuestionsPage() {
|
||||
const quiz = useCurrentQuiz();
|
||||
|
||||
if (!quiz) return null;
|
||||
console.log("Анкета")
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@ -14,8 +14,6 @@ export const QuestionSwitchWindowTool = () => {
|
||||
const {openBranchingPanel} = useUiTools()
|
||||
const theme = useTheme();
|
||||
const isMobile = useMediaQuery(theme.breakpoints.down(600));
|
||||
console.log("questions ", questions)
|
||||
console.log("rules ", questions.filter((q) => q.type !== null).map((q) => ({id: q.content.id, rule: q.content.rule})))
|
||||
return (
|
||||
<Box sx={{ display: "flex", gap: "20px", flexWrap: "wrap", marginBottom: isMobile ? "20px" : undefined }}>
|
||||
<Box sx={{ flexBasis: "796px" }}>
|
||||
|
||||
@ -42,7 +42,6 @@ export const UploadImageModal: React.FC<ModalkaProps> = ({
|
||||
|
||||
const acceptedFormats = accept ? accept.map((format) => "." + format).join(", ") : "";
|
||||
|
||||
console.log(acceptedFormats);
|
||||
|
||||
return (
|
||||
<Modal
|
||||
|
||||
@ -120,7 +120,6 @@ const InfoView = ({ resultData }: { resultData: QuizQuestionResult }) => {
|
||||
}
|
||||
|
||||
export const ResultCard = ({ resultContract, resultData }: Props) => {
|
||||
console.log("resultData", resultData)
|
||||
|
||||
const quizQid = useCurrentQuiz()?.qid;
|
||||
const theme = useTheme();
|
||||
|
||||
@ -78,7 +78,6 @@ export const Footer = ({ setCurrentQuestion, question, setShowContactForm, setSh
|
||||
}, [question, answers]);
|
||||
|
||||
const showResult = (nextQuestion) => {
|
||||
console.log(nextQuestion);
|
||||
|
||||
if (nextQuestion && quiz?.config.resultInfo.when === "before") {
|
||||
setShowResultForm(true);
|
||||
@ -154,14 +153,9 @@ export const Footer = ({ setCurrentQuestion, question, setShowContactForm, setSh
|
||||
const questionIndex = questions.findIndex(({ id }) => id === question.id);
|
||||
const nextQuestion = questions[questionIndex + 1];
|
||||
|
||||
console.log("questionIndex ", questionIndex);
|
||||
console.log(nextQuestion);
|
||||
console.log(questions);
|
||||
if (nextQuestion && nextQuestion.type !== "result") {
|
||||
console.log("следующий вопрос результирующий ", nextQuestion.type === "result");
|
||||
setCurrentQuestion(nextQuestion);
|
||||
} else {
|
||||
console.log("следующий вопрос результирующий ", nextQuestion.type === "result");
|
||||
showResult(nextQuestion);
|
||||
}
|
||||
|
||||
@ -173,7 +167,6 @@ export const Footer = ({ setCurrentQuestion, question, setShowContactForm, setSh
|
||||
if (nextQuestionId) {
|
||||
const nextQuestion = getQuestionByContentId(nextQuestionId);
|
||||
|
||||
console.log(nextQuestion);
|
||||
if (nextQuestion?.type && nextQuestion.type !== "result") {
|
||||
setCurrentQuestion(nextQuestion);
|
||||
return;
|
||||
|
||||
@ -43,7 +43,8 @@ const QUESTIONS_MAP: any = {
|
||||
|
||||
export const Question = ({ questions }: QuestionProps) => {
|
||||
const quiz = useCurrentQuiz();
|
||||
const [currentQuestion, setCurrentQuestion] = useState<AnyTypedQuizQuestion>();
|
||||
const [currentQuestion, setCurrentQuestion] =
|
||||
useState<AnyTypedQuizQuestion>();
|
||||
const [showContactForm, setShowContactForm] = useState<boolean>(false);
|
||||
const [showResultForm, setShowResultForm] = useState<boolean>(false);
|
||||
|
||||
@ -61,9 +62,9 @@ export const Question = ({ questions }: QuestionProps) => {
|
||||
|
||||
if (!currentQuestion) return <>не смог отобразить вопрос</>;
|
||||
|
||||
const QuestionComponent = QUESTIONS_MAP[currentQuestion.type as Exclude<QuestionType, "nonselected">];
|
||||
const QuestionComponent =
|
||||
QUESTIONS_MAP[currentQuestion.type as Exclude<QuestionType, "nonselected">];
|
||||
|
||||
console.log("showResultForm " , showResultForm)
|
||||
return (
|
||||
<Box>
|
||||
{!showContactForm && !showResultForm && (
|
||||
|
||||
@ -30,11 +30,6 @@ export const ResultForm = ({
|
||||
);
|
||||
|
||||
|
||||
console.log(currentQuestion)
|
||||
console.log(resultQuestion
|
||||
)
|
||||
console.log(questions)
|
||||
console.log(quiz?.config.resultInfo.when)
|
||||
|
||||
|
||||
const followNextForm = () => {
|
||||
|
||||
@ -52,7 +52,6 @@ export const ViewPage = () => {
|
||||
questions.filter(({ type }) => type) as AnyTypedQuizQuestion[]
|
||||
).sort((previousItem, item) => previousItem.page - item.page);
|
||||
|
||||
console.log("visualStartPage ", visualStartPage);
|
||||
if (visualStartPage === undefined) return <></>;
|
||||
if (questions.length === 0) return <ApologyPage message="Нет созданных вопросов"/>
|
||||
return (
|
||||
|
||||
@ -31,8 +31,6 @@ export const Varimg = ({ currentQuestion }: VarimgProps) => {
|
||||
({ id }) => answer === id
|
||||
);
|
||||
|
||||
console.log(currentQuestion)
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<Typography variant="h5">{currentQuestion.title}</Typography>
|
||||
|
||||
@ -89,7 +89,6 @@ export default function EditPage() {
|
||||
|
||||
|
||||
const updateQuestionHint = useDebouncedCallback((questions: AnyTypedQuizQuestion[]) => {
|
||||
console.log("пересчитываю")
|
||||
|
||||
const problems: any = {}
|
||||
|
||||
@ -117,23 +116,15 @@ export default function EditPage() {
|
||||
updateCanCreatePublic(true)
|
||||
}
|
||||
|
||||
console.log(problems)
|
||||
console.log(Object.keys(problems).length > 0)
|
||||
|
||||
}, 600);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
updateQuestionHint(questions)
|
||||
console.log(canCreatePublic)
|
||||
}, [questions]);
|
||||
|
||||
|
||||
|
||||
|
||||
console.log(currentStep)
|
||||
console.log(quizConfig)
|
||||
|
||||
async function handleLogoutClick() {
|
||||
const [, logoutError] = await logout();
|
||||
|
||||
|
||||
@ -41,7 +41,6 @@ export const Restore: FC = () => {
|
||||
initialValues,
|
||||
validationSchema,
|
||||
onSubmit: (values) => {
|
||||
console.log(values);
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@ -297,7 +297,6 @@ export const uploadQuestionImage = async (
|
||||
if (!question || !quizQid) return;
|
||||
|
||||
try {
|
||||
console.log(question.quizId)
|
||||
const response = await quizApi.addImages(question.quizId, blob);
|
||||
|
||||
const values = Object.values(response);
|
||||
@ -387,16 +386,13 @@ export const createTypedQuestion = async (
|
||||
});
|
||||
|
||||
export const deleteQuestion = async (questionId: string) => requestQueue.enqueue(async () => {
|
||||
console.log("Я получил запрос на удаление. ИД - ", questionId)
|
||||
|
||||
const question = useQuestionsStore.getState().questions.find(q => q.id === questionId);
|
||||
console.log("delete question ", question)
|
||||
if (!question) return;
|
||||
|
||||
|
||||
|
||||
if (question.type === null) {
|
||||
console.log("removeQuestion")
|
||||
removeQuestion(questionId);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -179,7 +179,6 @@ export const deleteQuiz = async (quizId: string) => requestQueue.enqueue(async (
|
||||
export const updateRootContentId = (quizId: string, id:string) => updateQuiz(
|
||||
quizId,
|
||||
quiz => {
|
||||
console.log("Я изменение статуса корня проекта дерева, меняю на ", id)
|
||||
quiz.config.haveRoot = id
|
||||
},
|
||||
);
|
||||
|
||||
@ -24,6 +24,7 @@ export default function SwitchStepPages({
|
||||
quizStartPageType,
|
||||
quizResults,
|
||||
}: Props) {
|
||||
console.log("Выбор текущей странички")
|
||||
switch (activeStep) {
|
||||
case 0: {
|
||||
if (!quizType) return <StepOne />;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user