import { useParams } from "react-router-dom"; import { Box, Typography, useMediaQuery, useTheme, Tooltip } from "@mui/material"; import CustomCheckbox from "@ui_kit/CustomCheckbox"; import CustomTextField from "@ui_kit/CustomTextField"; import { useDebouncedCallback } from "use-debounce"; import { questionStore, updateQuestionsList } from "@root/questions"; import InfoIcon from "../../../assets/icons/InfoIcon"; type SettingsUploadProps = { totalIndex: number; }; export default function SettingsUpload({ totalIndex }: SettingsUploadProps) { const theme = useTheme(); const quizId = Number(useParams().quizId); const { listQuestions } = questionStore(); const debounced = useDebouncedCallback((value) => { let clonContent = listQuestions[quizId][totalIndex].content; clonContent.innerName = value; updateQuestionsList(quizId, totalIndex, { content: clonContent }); }, 1000); const isMobile = useMediaQuery(theme.breakpoints.down(790)); return ( Настройки вопроса { const clonContent = listQuestions[quizId][totalIndex].content; clonContent.autofill = target.checked; updateQuestionsList(quizId, totalIndex, { content: clonContent }); }} /> { updateQuestionsList(quizId, totalIndex, { required: !e.target.checked, }); }} /> { let clonContent = listQuestions[quizId][totalIndex].content; clonContent.innerNameCheck = e.target.checked; if (!e.target.checked) { clonContent.innerName = ""; } updateQuestionsList(quizId, totalIndex, { content: clonContent }); }} /> {listQuestions[quizId][totalIndex].content.innerNameCheck && ( debounced(target.value)} /> )} ); }