import { Box, FormControl, FormControlLabel, Radio, RadioGroup, 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 CheckedIcon from "@ui_kit/RadioCheck"; import CheckIcon from "@ui_kit/RadioIcon"; import { useDebouncedCallback } from "use-debounce"; import InfoIcon from "../../../assets/icons/InfoIcon"; import type { QuizQuestionText } from "../../../model/questionTypes/text"; type SettingTextFieldProps = { question: QuizQuestionText; }; type Answer = { name: string; value: "single" | "multi"; }; const ANSWER_TYPES: Answer[] = [ { name: "Однострочное", value: "single" }, { name: "Многострочное", value: "multi" }, ]; export default function SettingTextField({ question, }: SettingTextFieldProps) { const theme = useTheme(); const isWrappColumn = useMediaQuery(theme.breakpoints.down(980)); const isMobile = useMediaQuery(theme.breakpoints.down(790)); const isFigmaTablte = useMediaQuery(theme.breakpoints.down(990)); const debounced = useDebouncedCallback((value) => { setQuestionInnerName(question.id, value); }, 200); return ( {/* Настройки ответов question.content.answerType === value )} onChange={({ target }: React.ChangeEvent) => { updateQuestion(question.id, question => { if (question.type !== "text") return; question.content.answerType = ANSWER_TYPES[Number(target.value)].value; }); }} > {ANSWER_TYPES.map(({ name }, index) => ( } checkedIcon={} /> } label={name} /> ))} { updateQuestion(question.id, question => { if (question.type !== "text") return; question.content.onlyNumbers = target.checked; }); }} /> */} Настройки вопросов {/* { updateQuestion(question.id, question => { question.content.autofill = target.checked; }); }} /> */} { updateQuestion(question.id, question => { question.content.required = !e.target.checked; }); }} /> {/**/} {/* {*/} {/* updateQuestion(question.id, question => {*/} {/* question.content.innerNameCheck = target.checked;*/} {/* question.content.innerName = target.checked*/} {/* ? question.content.innerName*/} {/* : "";*/} {/* });*/} {/* }}*/} {/* />*/} {/* */} {/* */} {/* */} {/* */} {/* */} {/**/} {/*{question.content.innerNameCheck && (*/} {/* debounced(target.value)}*/} {/* />*/} {/*)}*/} ); }