diff --git a/src/pages/Questions/AnswerDraggableList/AnswerItem.tsx b/src/pages/Questions/AnswerDraggableList/AnswerItem.tsx index a7debc03..d0dfc028 100644 --- a/src/pages/Questions/AnswerDraggableList/AnswerItem.tsx +++ b/src/pages/Questions/AnswerDraggableList/AnswerItem.tsx @@ -109,7 +109,7 @@ export const AnswerItem = ({ key={index} fullWidth variant="standard" - sx={{ p: "0 0 20px 0" }} + sx={{ padding: "0 0 20px 0" }} > Настройки календаря { const clonContent = listQuestions[quizId][totalIndex].content; @@ -35,10 +36,45 @@ export default function SettingsData({ totalIndex }: SettingsDataProps) { }} /> - + Настройки вопросов - - + { + 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 && ( + { + let clonContent = listQuestions[quizId][totalIndex].content; + clonContent.innerName = target.value; + updateQuestionsList(quizId, totalIndex, { content: clonContent }); + }} + /> + )} ); diff --git a/src/pages/Questions/DropDown/settingDropDown.tsx b/src/pages/Questions/DropDown/settingDropDown.tsx index a6d5dc4b..69e72b85 100644 --- a/src/pages/Questions/DropDown/settingDropDown.tsx +++ b/src/pages/Questions/DropDown/settingDropDown.tsx @@ -38,12 +38,51 @@ export default function SettingDropDown({ totalIndex }: SettingDropDownProps) { }} /> - + Настройки вопросов - - + { + 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 && ( + { + let clonContent = listQuestions[quizId][totalIndex].content; + clonContent.innerName = target.value; + updateQuestionsList(quizId, totalIndex, { + content: clonContent, + }); + }} + /> + )} diff --git a/src/pages/Questions/Emoji/settingEmoji.tsx b/src/pages/Questions/Emoji/settingEmoji.tsx index 06c77635..847931ed 100644 --- a/src/pages/Questions/Emoji/settingEmoji.tsx +++ b/src/pages/Questions/Emoji/settingEmoji.tsx @@ -1,6 +1,7 @@ import { useParams } from "react-router-dom"; import { Box, Typography } from "@mui/material"; import CustomCheckbox from "@ui_kit/CustomCheckbox"; +import CustomTextField from "@ui_kit/CustomTextField"; import InfoIcon from "../../../assets/icons/InfoIcon"; import { questionStore, updateQuestionsList } from "@root/questions"; @@ -13,7 +14,7 @@ export default function SettingEmoji({ totalIndex }: SettingEmojiProps) { const { listQuestions } = questionStore(); return ( - + Настройки ответов - + Настройки вопросов - - + { + 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 && ( + { + let clonContent = listQuestions[quizId][totalIndex].content; + clonContent.innerName = target.value; + updateQuestionsList(quizId, totalIndex, { content: clonContent }); + }} + /> + )} ); diff --git a/src/pages/Questions/OptionsPicture/settingOpytionsPict.tsx b/src/pages/Questions/OptionsPicture/settingOpytionsPict.tsx index b0f35e86..b843daf2 100644 --- a/src/pages/Questions/OptionsPicture/settingOpytionsPict.tsx +++ b/src/pages/Questions/OptionsPicture/settingOpytionsPict.tsx @@ -89,7 +89,13 @@ export default function SettingOpytionsPict({ return ( <> - + Пропорции - + Форма - + + Настройки ответов @@ -71,11 +78,54 @@ export default function SettingTextField({ - + Настройки вопросов - - - + { + 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 && ( + { + let clonContent = listQuestions[quizId][totalIndex].content; + clonContent.innerName = target.value; + updateQuestionsList(quizId, totalIndex, { content: clonContent }); + }} + /> + )} ); diff --git a/src/pages/Questions/PageOptions/SettingPageOptions.tsx b/src/pages/Questions/PageOptions/SettingPageOptions.tsx index 763617cf..034a00ee 100644 --- a/src/pages/Questions/PageOptions/SettingPageOptions.tsx +++ b/src/pages/Questions/PageOptions/SettingPageOptions.tsx @@ -1,15 +1,54 @@ +import { useParams } from "react-router-dom"; import { Box, Typography } from "@mui/material"; import CustomCheckbox from "@ui_kit/CustomCheckbox"; +import CustomTextField from "@ui_kit/CustomTextField"; + +import { questionStore, updateQuestionsList } from "@root/questions"; + import InfoIcon from "../../../assets/icons/InfoIcon"; -export default function SettingPageOptions() { +type SettingPageOptionsProps = { + totalIndex: number; +}; + +export default function SettingPageOptions({ + totalIndex, +}: SettingPageOptionsProps) { + const quizId = Number(useParams().quizId); + const { listQuestions } = questionStore(); + return ( Настройки вопроса - + + updateQuestionsList(quizId, totalIndex, { + content: { + ...listQuestions[quizId][totalIndex].content, + innerNameCheck: target.checked, + innerName: "", + }, + }) + } + /> + {listQuestions[quizId][totalIndex].content.innerNameCheck && ( + { + let clonContent = listQuestions[quizId][totalIndex].content; + clonContent.innerName = target.value; + updateQuestionsList(quizId, totalIndex, { + content: clonContent, + }); + }} + /> + )} ); } diff --git a/src/pages/Questions/PageOptions/switchPageOptions.tsx b/src/pages/Questions/PageOptions/switchPageOptions.tsx index 52f3c9a0..5eba5a89 100644 --- a/src/pages/Questions/PageOptions/switchPageOptions.tsx +++ b/src/pages/Questions/PageOptions/switchPageOptions.tsx @@ -13,13 +13,13 @@ export default function SwitchPageOptions({ }: Props) { switch (switchState) { case "setting": - return ; + return ; break; case "help": return ; break; case "branching": - return ; + return ; break; default: return <>; diff --git a/src/pages/Questions/RatingOptions/settingRating.tsx b/src/pages/Questions/RatingOptions/settingRating.tsx index 0b89c92d..7c400ea5 100644 --- a/src/pages/Questions/RatingOptions/settingRating.tsx +++ b/src/pages/Questions/RatingOptions/settingRating.tsx @@ -2,6 +2,7 @@ import { useParams } from "react-router-dom"; import { Box, ButtonBase, Slider, Typography, useTheme } from "@mui/material"; import CustomCheckbox from "@ui_kit/CustomCheckbox"; +import CustomTextField from "@ui_kit/CustomTextField"; import { questionStore, updateQuestionsList } from "@root/questions"; import InfoIcon from "../../../assets/icons/InfoIcon"; @@ -109,8 +110,43 @@ export default function SettingSlider({ totalIndex }: SettingSliderProps) { Настройки вопросов - - + { + 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 && ( + { + let clonContent = listQuestions[quizId][totalIndex].content; + clonContent.innerName = target.value; + updateQuestionsList(quizId, totalIndex, { content: clonContent }); + }} + /> + )} ); diff --git a/src/pages/Questions/SliderOptions/settingSlider.tsx b/src/pages/Questions/SliderOptions/settingSlider.tsx index 4047816c..eec96052 100644 --- a/src/pages/Questions/SliderOptions/settingSlider.tsx +++ b/src/pages/Questions/SliderOptions/settingSlider.tsx @@ -1,6 +1,7 @@ import { useParams } from "react-router-dom"; import { Box, Typography } from "@mui/material"; import CustomCheckbox from "@ui_kit/CustomCheckbox"; +import CustomTextField from "@ui_kit/CustomTextField"; import InfoIcon from "../../../assets/icons/InfoIcon"; import { questionStore, updateQuestionsList } from "@root/questions"; @@ -28,8 +29,43 @@ export default function SettingSlider({ totalIndex }: SettingSliderProps) { Настройки вопросов - - + { + 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 && ( + { + let clonContent = listQuestions[quizId][totalIndex].content; + clonContent.innerName = target.value; + updateQuestionsList(quizId, totalIndex, { content: clonContent }); + }} + /> + )} ); diff --git a/src/pages/Questions/UploadFile/settingUpload.tsx b/src/pages/Questions/UploadFile/settingUpload.tsx index 9f94c89c..58bf0820 100644 --- a/src/pages/Questions/UploadFile/settingUpload.tsx +++ b/src/pages/Questions/UploadFile/settingUpload.tsx @@ -1,6 +1,7 @@ import { useParams } from "react-router-dom"; import { Box, Typography } from "@mui/material"; import CustomCheckbox from "@ui_kit/CustomCheckbox"; +import CustomTextField from "@ui_kit/CustomTextField"; import { questionStore, updateQuestionsList } from "@root/questions"; @@ -26,8 +27,43 @@ export default function SettingsUpload({ totalIndex }: SettingsUploadProps) { 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 && ( + { + let clonContent = listQuestions[quizId][totalIndex].content; + clonContent.innerName = target.value; + updateQuestionsList(quizId, totalIndex, { content: clonContent }); + }} + /> + )} ); } diff --git a/src/pages/Questions/answerOptions/responseSettings.tsx b/src/pages/Questions/answerOptions/responseSettings.tsx index ead6d60f..e2084b6b 100644 --- a/src/pages/Questions/answerOptions/responseSettings.tsx +++ b/src/pages/Questions/answerOptions/responseSettings.tsx @@ -14,7 +14,13 @@ export default function ResponseSettings({ totalIndex }: Props) { const { listQuestions } = questionStore(); return ( - + Настройки ответов - +