import { useState } from "react"; import { useParams } from "react-router-dom"; import { Box, Typography, Link, useTheme, useMediaQuery } from "@mui/material"; import EnterIcon from "../../../assets/icons/questionsPage/enterIcon"; import SwitchAnswerOptions from "./switchAnswerOptions"; import { AnswerDraggableList } from "../AnswerDraggableList"; import ButtonsOptionsAndPict from "../ButtonsOptionsAndPict"; import { questionStore, updateQuestionsList } from "@root/questions"; interface Props { totalIndex: number; } export default function AnswerOptions({ totalIndex }: Props) { const [switchState, setSwitchState] = useState("setting"); const quizId = Number(useParams().quizId); const { listQuestions } = questionStore(); const variants = listQuestions[quizId][totalIndex].content.variants; const theme = useTheme(); const isMobile = useMediaQuery(theme.breakpoints.down(790)); const SSHC = (data: string) => { setSwitchState(data); }; const addNewAnswer = () => { const answerNew = variants.slice(); answerNew.push({ answer: "", hints: "" }); updateQuestionsList(quizId, totalIndex, { content: { ...listQuestions[quizId][totalIndex].content, variants: answerNew, }, }); }; return ( <> {variants.length === 0 ? ( Добавьте ответ ) : ( )} Добавьте ответ {isMobile ? null : ( <> или нажмите Enter )} ); }