import {Box, Typography, Link, useTheme, TextField, FormControl, InputAdornment, IconButton} from "@mui/material"; import React from "react"; import EnterIcon from "../../../assets/icons/questionsPage/enterIcon"; import SwitchAnswerOptions from "./switchAnswerOptions"; import ButtonsOptionsAndPict from "../ButtonsOptionsAndPict"; import QuestionsPageCard from "../QuestionPageCard"; import {useParams} from "react-router-dom"; import {questionStore} from "@root/questions"; import PointsIcon from "@icons/questionsPage/PointsIcon"; import DeleteIcon from "@icons/questionsPage/deleteIcon"; import MessageIcon from "@icons/messagIcon"; import Popover from '@mui/material/Popover'; import TextareaAutosize from '@mui/base/TextareaAutosize'; interface Props { totalIndex: number, } export default function AnswerOptions({totalIndex}: Props) { const params = Number(useParams().quizId); const {listQuestions, updateQuestionsList, createQuestion, removeQuestion} = questionStore() const Answer = listQuestions[params][totalIndex].content.variants console.log(Answer) const theme = useTheme(); const [switchState, setSwitchState] = React.useState('setting'); const SSHC = (data: string) => { setSwitchState(data) } const [anchorEl, setAnchorEl] = React.useState(null); const handleClick = (event: React.MouseEvent) => { setAnchorEl(event.currentTarget); }; const handleClose = () => { setAnchorEl(null); }; const open = Boolean(anchorEl); const id = open ? 'simple-popover' : undefined; return ( <> {Answer.length === 0 ? Добавьте ответ : {Answer.map((answer:string, index:number) => ( { const answerNew = Answer answerNew[index] = e.target.value let clonContent = listQuestions[params][totalIndex].content clonContent.variant = answerNew updateQuestionsList(params, totalIndex, {content: clonContent})}} InputProps={{ startAdornment: ( ), endAdornment: ( { const answerNew = Answer answerNew.splice(index, 1) let clonContent = listQuestions[params][totalIndex].content clonContent.variant = answerNew updateQuestionsList(params, totalIndex, {content: clonContent}) }} > ) }} sx={{ "& .MuiInputBase-root": { height: "48px", borderRadius: "10px", }, }} inputProps={{ sx: { borderRadius: "10px", fontSize: "18px", lineHeight: "21px", py: 0, } }} /> ) )} } { const answerNew = Answer answerNew.push("") let clonContent = listQuestions[params][totalIndex].content clonContent.variant = answerNew updateQuestionsList(params, totalIndex, {content: clonContent}) }} > Добавьте ответ или нажмите Enter ) }