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 SettingPageOptionsProps = { totalIndex: number; }; export default function SettingPageOptions({ totalIndex, }: SettingPageOptionsProps) { const theme = useTheme(); const isMobile = useMediaQuery(theme.breakpoints.down(790)); 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); return ( Настройки вопроса updateQuestionsList(quizId, totalIndex, { content: { ...listQuestions[quizId][totalIndex].content, innerNameCheck: target.checked, innerName: "", }, }) } /> {listQuestions[quizId][totalIndex].content.innerNameCheck && ( debounced(target.value)} /> )} ); }