import { useParams } from "react-router-dom"; import { Box, Typography, Tooltip, useMediaQuery, useTheme, } from "@mui/material"; import { useDebouncedCallback } from "use-debounce"; import CustomCheckbox from "@ui_kit/CustomCheckbox"; import CustomTextField from "@ui_kit/CustomTextField"; import InfoIcon from "../../../assets/icons/InfoIcon"; import { questionStore, updateQuestionsList } from "@root/questions"; type SettingSliderProps = { totalIndex: number; }; export default function SettingSlider({ totalIndex }: SettingSliderProps) { const quizId = Number(useParams().quizId); const { listQuestions } = questionStore(); const theme = useTheme(); const isWrappColumn = useMediaQuery(theme.breakpoints.down(980)); const isMobile = useMediaQuery(theme.breakpoints.down(790)); const debounced = useDebouncedCallback((value) => { let clonContent = listQuestions[quizId][totalIndex].content; clonContent.innerName = value; updateQuestionsList(quizId, totalIndex, { content: clonContent }); }, 1000); return ( Настройки ползунка { let clonContent = listQuestions[quizId][totalIndex].content; clonContent.chooseRange = e.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)} /> )} ); }