diff --git a/src/constants/date.ts b/src/constants/date.ts index 648c9d78..d97bd30c 100644 --- a/src/constants/date.ts +++ b/src/constants/date.ts @@ -10,7 +10,6 @@ export const QUIZ_QUESTION_DATE: Omit = { required: false, innerNameCheck: false, innerName: "", - type: "calendar", dateRange: false, time: false, }, diff --git a/src/model/questionTypes/date.ts b/src/model/questionTypes/date.ts index 18a7df45..ea1c8dd4 100644 --- a/src/model/questionTypes/date.ts +++ b/src/model/questionTypes/date.ts @@ -13,7 +13,6 @@ export interface QuizQuestionDate extends QuizQuestionBase { innerNameCheck: boolean; /** Поле "Внутреннее название вопроса" */ innerName: string; - type: "calendar" | "mask"; dateRange: boolean; time: boolean; hint: QuestionHint; diff --git a/src/pages/Questions/DataOptions/DataOptions.tsx b/src/pages/Questions/DataOptions/DataOptions.tsx index 10c1f1ef..2830d34d 100644 --- a/src/pages/Questions/DataOptions/DataOptions.tsx +++ b/src/pages/Questions/DataOptions/DataOptions.tsx @@ -1,12 +1,9 @@ -import { useParams } from "react-router-dom"; -import { Box, Typography, Tooltip, useMediaQuery, useTheme } from "@mui/material"; +import { Box, Tooltip, Typography, useMediaQuery, useTheme } from "@mui/material"; +import { useState } from "react"; +import InfoIcon from "../../../assets/icons/InfoIcon"; import ButtonsOptions from "../ButtonsOptions"; import SwitchData from "./switchData"; -import { useState, useEffect } from "react"; -import InfoIcon from "../../../assets/icons/InfoIcon"; -import { questionStore, updateQuestionsList } from "@root/questions"; -import type { QuizQuestionDate } from "../../../model/questionTypes/date"; interface Props { totalIndex: number; @@ -14,24 +11,13 @@ interface Props { export default function DataOptions({ totalIndex }: Props) { const [switchState, setSwitchState] = useState("setting"); - const quizId = Number(useParams().quizId); - const { listQuestions } = questionStore(); const theme = useTheme(); const isMobile = useMediaQuery(theme.breakpoints.down(790)); - const question = listQuestions[quizId][totalIndex] as QuizQuestionDate; const SSHC = (data: string) => { setSwitchState(data); }; - useEffect(() => { - if (question.content.type !== "mask") { - updateQuestionsList(quizId, totalIndex, { - content: { ...question.content, type: "calendar" }, - }); - } - }, []); - return ( <> { - updateQuestionsList(quizId, totalIndex, { title }); + updateQuestionsList(quizId, totalIndex, { title }); }, 200); useEffect(() => { @@ -261,7 +261,7 @@ export default function QuestionsPageCard({ sx={{ padding: "0", margin: "5px" }} disableRipple onClick={() => - updateQuestionsList(quizId, totalIndex, { + updateQuestionsList(quizId, totalIndex, { expanded: !question.expanded, }) } @@ -350,7 +350,7 @@ export default function QuestionsPageCard({ removeQuestionForce(quizId, removedId); }, 5000); - updateQuestionsList(quizId, totalIndex, { + updateQuestionsList(quizId, totalIndex, { ...question, deleteTimeoutId: newTimeoutId, }); @@ -395,7 +395,7 @@ export default function QuestionsPageCard({ borderRadius: "12px", }} > - {question.type.length === 0 ? ( + {question.type === "nonselected" ? ( ) : (