2023-04-17 02:27:22 +00:00
|
|
|
|
import {Box, Typography, Link, useTheme} from "@mui/material";
|
2023-03-15 22:56:53 +00:00
|
|
|
|
import React from "react";
|
2023-05-03 19:21:00 +00:00
|
|
|
|
import EnterIcon from "../../../assets/icons/questionsPage/enterIcon";
|
2023-03-15 22:56:53 +00:00
|
|
|
|
import SwitchAnswerOptions from "./switchAnswerOptions";
|
2023-03-30 18:39:59 +00:00
|
|
|
|
import ButtonsOptionsAndPict from "../ButtonsOptionsAndPict";
|
2023-07-06 15:54:12 +00:00
|
|
|
|
import QuestionsPageCard from "../QuestionPageCard";
|
|
|
|
|
import {useParams} from "react-router-dom";
|
|
|
|
|
import {questionStore} from "@root/questions";
|
|
|
|
|
import {answerStore} from "@root/answer";
|
|
|
|
|
import CustomTextField from "@ui_kit/CustomTextField";
|
2023-03-15 22:56:53 +00:00
|
|
|
|
|
2023-04-17 02:27:22 +00:00
|
|
|
|
|
2023-06-30 14:39:07 +00:00
|
|
|
|
interface Props {
|
|
|
|
|
totalIndex: number,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default function AnswerOptions({totalIndex}: Props) {
|
2023-07-06 15:54:12 +00:00
|
|
|
|
const params = Number(useParams().quizId);
|
|
|
|
|
const {listQuestions, updateQuestionsList, createQuestion, removeQuestion} = questionStore()
|
|
|
|
|
const {listAnswer, updateAnswerList, createAnswer, removeAnswer} = answerStore()
|
2023-04-17 02:27:22 +00:00
|
|
|
|
const theme = useTheme();
|
|
|
|
|
const [switchState, setSwitchState] = React.useState('setting');
|
|
|
|
|
const SSHC = (data: string) => {
|
|
|
|
|
setSwitchState(data)
|
|
|
|
|
}
|
2023-03-22 22:19:15 +00:00
|
|
|
|
|
2023-04-17 02:27:22 +00:00
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<Box sx={{ padding: '20px'}}>
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
padding: '0 0 33px 80px',
|
|
|
|
|
fontWeight: 400,
|
|
|
|
|
fontSize: '18px',
|
|
|
|
|
lineHeight: '21.33px',
|
|
|
|
|
color: theme.palette.grey2.main
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Добавьте ответ
|
|
|
|
|
</Typography>
|
|
|
|
|
<Box sx={{ display: 'flex', alignItems: 'center', gap: '10px'}}>
|
|
|
|
|
<Link
|
|
|
|
|
component="button"
|
|
|
|
|
variant="body2"
|
|
|
|
|
sx={{color: theme.palette.brightPurple.main}}
|
2023-07-06 15:54:12 +00:00
|
|
|
|
onClick={() => {
|
|
|
|
|
createAnswer(params, totalIndex)
|
|
|
|
|
}}
|
2023-04-17 02:27:22 +00:00
|
|
|
|
>
|
|
|
|
|
Добавьте ответ
|
|
|
|
|
</Link>
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
fontWeight: 400,
|
|
|
|
|
fontSize: '18px',
|
|
|
|
|
lineHeight: '21.33px',
|
|
|
|
|
color: theme.palette.grey2.main
|
|
|
|
|
}}
|
|
|
|
|
>или нажмите Enter</Typography>
|
|
|
|
|
<EnterIcon/>
|
|
|
|
|
</Box>
|
2023-07-06 18:48:39 +00:00
|
|
|
|
{listAnswer.length === 0 && listAnswer[params] !== undefined &&
|
|
|
|
|
<Box>
|
|
|
|
|
{Object.values(listAnswer[params][totalIndex]).map((e, index) => (
|
|
|
|
|
<CustomTextField key={index} placeholder={'Добавьте ответ'} />
|
|
|
|
|
)
|
|
|
|
|
)}
|
|
|
|
|
</Box>
|
2023-07-06 15:54:12 +00:00
|
|
|
|
|
2023-07-06 18:48:39 +00:00
|
|
|
|
}
|
2023-07-06 15:54:12 +00:00
|
|
|
|
|
2023-04-17 02:27:22 +00:00
|
|
|
|
</Box>
|
2023-06-30 14:39:07 +00:00
|
|
|
|
<ButtonsOptionsAndPict switchState={switchState} SSHC={SSHC} totalIndex={totalIndex}/>
|
2023-04-17 02:27:22 +00:00
|
|
|
|
<SwitchAnswerOptions switchState={switchState}/>
|
|
|
|
|
</>
|
|
|
|
|
)
|
|
|
|
|
}
|