import { useState } from "react"; import { Box, Typography, Link, useTheme } 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"; // Импортируем интерфейс Varian interface Props { totalIndex: number; } export default function AnswerOptions({ totalIndex }: Props) { const [switchState, setSwitchState] = useState("setting"); const { listQuestions } = questionStore(); const variants = listQuestions[totalIndex].content.variants; const theme = useTheme(); const SSHC = (data: string) => { setSwitchState(data); }; const addNewAnswer = () => { const answerNew = variants.slice(); // Create a shallow copy of the array answerNew.push({ answer: "", answerLong: "", hints: "" }); updateQuestionsList(totalIndex, { content: { ...listQuestions[totalIndex].content, variants: answerNew }, }); }; return ( <> {variants.length === 0 ? ( Добавьте ответ ) : ( )} Добавьте ответ или нажмите Enter ); }