From b6cd28497219e56ae97e625ea00450cfd5782988 Mon Sep 17 00:00:00 2001 From: nflnkr Date: Sun, 3 Dec 2023 16:09:57 +0300 Subject: [PATCH] rename missing type --- src/pages/Questions/BranchingMap/CsComponent.tsx | 6 +++--- src/pages/Questions/BranchingMap/helper.ts | 4 ++-- .../BranchingModal/BranchingQuestionsModal.tsx | 6 +++--- src/pages/Questions/BranchingModal/Settings.tsx | 10 +++++----- src/pages/Questions/DraggableList/QuestionPageCard.tsx | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/pages/Questions/BranchingMap/CsComponent.tsx b/src/pages/Questions/BranchingMap/CsComponent.tsx index 6cdc66d9..a388c7f1 100644 --- a/src/pages/Questions/BranchingMap/CsComponent.tsx +++ b/src/pages/Questions/BranchingMap/CsComponent.tsx @@ -4,7 +4,7 @@ import CytoscapeComponent from "react-cytoscapejs"; import popper from "cytoscape-popper"; import { useCurrentQuiz } from "@root/quizes/hooks"; import { updateRootContentId } from "@root/quizes/actions" -import { AnyQuizQuestion } from "@model/questionTypes/shared" +import { AnyTypedQuizQuestion } from "@model/questionTypes/shared" import { useQuestionsStore } from "@root/questions/store"; import { cleardragQuestionContentId, updateQuestion, updateOpenedModalSettingsId, getQuestionByContentId } from "@root/questions/actions"; @@ -135,7 +135,7 @@ export const CsComponent = ({ const cy = cyRef?.current const parentNodeChildren = cy?.$('edge[source = "' + parentNodeContentId + '"]')?.length //если есть инфо о выбранном вопросе из модалки - берём родителя из инфо модалки. Иначе из значения дропа - const targetQuestion = { ...getQuestionByContentId(targetNodeContentId || dragQuestionContentId) } as AnyQuizQuestion + const targetQuestion = { ...getQuestionByContentId(targetNodeContentId || dragQuestionContentId) } as AnyTypedQuizQuestion if (Object.keys(targetQuestion).length !== 0 && Object.keys(targetQuestion).length !== 0 && parentNodeContentId && parentNodeChildren !== undefined) { clearDataAfterAddNode({ parentNodeContentId, targetQuestion, parentNodeChildren }) @@ -160,7 +160,7 @@ export const CsComponent = ({ } } - const clearDataAfterAddNode = ({ parentNodeContentId, targetQuestion, parentNodeChildren }: { parentNodeContentId: string, targetQuestion: AnyQuizQuestion, parentNodeChildren: number }) => { + const clearDataAfterAddNode = ({ parentNodeContentId, targetQuestion, parentNodeChildren }: { parentNodeContentId: string, targetQuestion: AnyTypedQuizQuestion, parentNodeChildren: number }) => { console.log("записываю на бек ид родителя") console.log({ parentNodeContentId, targetQuestion, parentNodeChildren }) //предупреждаем добавленный вопрос о том, кто его родитель diff --git a/src/pages/Questions/BranchingMap/helper.ts b/src/pages/Questions/BranchingMap/helper.ts index 9a335c27..75949def 100644 --- a/src/pages/Questions/BranchingMap/helper.ts +++ b/src/pages/Questions/BranchingMap/helper.ts @@ -1,4 +1,4 @@ -import { AnyQuizQuestion } from "@model/questionTypes/shared" +import { AnyTypedQuizQuestion } from "@model/questionTypes/shared" interface Nodes { data: { @@ -14,7 +14,7 @@ interface Edges { } } -export const storeToNodes = (questions: AnyQuizQuestion[]) => { +export const storeToNodes = (questions: AnyTypedQuizQuestion[]) => { console.log(questions) const nodes: Nodes[] = [] const edges: Edges[] = [] diff --git a/src/pages/Questions/BranchingModal/BranchingQuestionsModal.tsx b/src/pages/Questions/BranchingModal/BranchingQuestionsModal.tsx index 0c140f52..eaed2239 100644 --- a/src/pages/Questions/BranchingModal/BranchingQuestionsModal.tsx +++ b/src/pages/Questions/BranchingModal/BranchingQuestionsModal.tsx @@ -13,7 +13,7 @@ import { useTheme, Checkbox, } from "@mui/material"; -import { AnyQuizQuestion, createBranchingRuleMain } from "../../../model/questionTypes/shared" +import { AnyTypedQuizQuestion, createBranchingRuleMain } from "../../../model/questionTypes/shared" import { Select } from "../Select"; import RadioCheck from "@ui_kit/RadioCheck"; @@ -31,9 +31,9 @@ export default function BranchingQuestions() { const theme = useTheme(); const { openedModalSettingsId } = useQuestionsStore(); - const [targetQuestion, setTargetQuestion] = useState(getQuestionById(openedModalSettingsId) || getQuestionByContentId(openedModalSettingsId)) + const [targetQuestion, setTargetQuestion] = useState(getQuestionById(openedModalSettingsId) || getQuestionByContentId(openedModalSettingsId)) console.log(targetQuestion) - const [parentQuestion, setParentQuestion] = useState(getQuestionByContentId(targetQuestion?.content.rule.parentId)) + const [parentQuestion, setParentQuestion] = useState(getQuestionByContentId(targetQuestion?.content.rule.parentId)) console.log(parentQuestion) useLayoutEffect(() => { diff --git a/src/pages/Questions/BranchingModal/Settings.tsx b/src/pages/Questions/BranchingModal/Settings.tsx index 8322b442..2bd42265 100644 --- a/src/pages/Questions/BranchingModal/Settings.tsx +++ b/src/pages/Questions/BranchingModal/Settings.tsx @@ -6,7 +6,7 @@ import { useState, useRef, useEffect } from "react"; import { useParams } from "react-router-dom"; import { useQuestionsStore } from "@root/questions/store"; import { updateQuestion, getQuestionById } from "@root/questions/actions"; -import { AnyQuizQuestion } from "../../../model/questionTypes/shared" +import { AnyTypedQuizQuestion } from "../../../model/questionTypes/shared" import { SelectChangeEvent } from '@mui/material/Select'; import InfoIcon from "@icons/Info"; @@ -17,10 +17,10 @@ const CONDITIONS = [ "Обязательно хотя бы одно условие", ]; interface Props { - parentQuestion: AnyQuizQuestion; - targetQuestion: AnyQuizQuestion; + parentQuestion: AnyTypedQuizQuestion; + targetQuestion: AnyTypedQuizQuestion; ruleIndex: number; - setParentQuestion: (q:AnyQuizQuestion) => void; + setParentQuestion: (q:AnyTypedQuizQuestion) => void; } @@ -518,4 +518,4 @@ const RatingInputsType = ({ parentQuestion, targetQuestion, ruleIndex, setParent // default: ID string // } // } -// } \ No newline at end of file +// } diff --git a/src/pages/Questions/DraggableList/QuestionPageCard.tsx b/src/pages/Questions/DraggableList/QuestionPageCard.tsx index c57c4416..183852e8 100644 --- a/src/pages/Questions/DraggableList/QuestionPageCard.tsx +++ b/src/pages/Questions/DraggableList/QuestionPageCard.tsx @@ -248,7 +248,7 @@ export default function QuestionsPageCard({ question, draggableProps, isDragging // removeQuestionForce(quizId, removedId); // }, 5000); - // updateQuestionsList(quizId, totalIndex, { + // updateQuestionsList(quizId, totalIndex, { // ...question, // deleteTimeoutId: newTimeoutId, // });