import { Box, Tooltip, Typography, useMediaQuery, useTheme, } from "@mui/material"; import { setQuestionInnerName, updateQuestion } from "@root/questions/actions"; import CustomCheckbox from "@ui_kit/CustomCheckbox"; import CustomTextField from "@ui_kit/CustomTextField"; import { useDebouncedCallback } from "use-debounce"; import InfoIcon from "../../../assets/icons/InfoIcon"; import type { QuizQuestionSelect } from "../../../model/questionTypes/select"; type SettingDropDownProps = { question: QuizQuestionSelect; }; export default function SettingDropDown({ question }: SettingDropDownProps) { const theme = useTheme(); const isFigmaTablte = useMediaQuery(theme.breakpoints.down(990)); const isMobile = useMediaQuery(theme.breakpoints.down(790)); const debounced = useDebouncedCallback((value) => { setQuestionInnerName(question.id, value); }, 200); const debounceAnswer = useDebouncedCallback((value) => { updateQuestion(question.id, question => { if (question.type !== "select") return; question.content.default = value; }); }, 200); return ( <> Настройки ответов updateQuestion(question.id, question => { if (question.type !== "select") return; question.content.multi = target.checked; }) } /> Текст в выпадающем списке debounceAnswer(target.value)} /> Настройки вопросов { updateQuestion(question.id, question => { question.required = !e.target.checked; }); }} /> { updateQuestion(question.id, question => { question.content.innerNameCheck = target.checked; question.content.innerName = target.checked ? question.content.innerName : ""; }); }} /> Текст в выпадающем списке debounceAnswer(target.value)} /> {question.content.innerNameCheck && ( debounced(target.value)} /> )} ); }