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