From 3ac8720904a3b487cb76b079b240296a5b72868c Mon Sep 17 00:00:00 2001 From: IlyaDoronin Date: Wed, 4 Oct 2023 16:40:22 +0300 Subject: [PATCH] fix: info icons tooltip --- .../Questions/DropDown/settingDropDown.tsx | 49 ++- src/pages/Questions/UploadFile/UploadFile.tsx | 7 +- src/pages/Questions/branchingQuestions.tsx | 303 +++++++++++------- 3 files changed, 229 insertions(+), 130 deletions(-) diff --git a/src/pages/Questions/DropDown/settingDropDown.tsx b/src/pages/Questions/DropDown/settingDropDown.tsx index 83062b31..cdc28e09 100644 --- a/src/pages/Questions/DropDown/settingDropDown.tsx +++ b/src/pages/Questions/DropDown/settingDropDown.tsx @@ -1,5 +1,11 @@ import { useParams } from "react-router-dom"; -import { Box, Typography, useMediaQuery, useTheme } from "@mui/material"; +import { + Box, + Typography, + Tooltip, + useMediaQuery, + useTheme, +} from "@mui/material"; import CustomCheckbox from "@ui_kit/CustomCheckbox"; import CustomTextField from "@ui_kit/CustomTextField"; import { useDebouncedCallback } from "use-debounce"; @@ -38,6 +44,7 @@ export default function SettingDropDown({ totalIndex }: SettingDropDownProps) { sx={{ position: "relative", display: "flex", + gap: "20px", width: "100%", justifyContent: "space-between", flexDirection: isMobile ? "column" : null, @@ -56,7 +63,12 @@ export default function SettingDropDown({ totalIndex }: SettingDropDownProps) { }} > Настройки ответов @@ -72,7 +84,12 @@ export default function SettingDropDown({ totalIndex }: SettingDropDownProps) { }) } /> - + Настройки вопросов @@ -117,7 +139,9 @@ export default function SettingDropDown({ totalIndex }: SettingDropDownProps) { }); }} /> - + - + + + + + Пользователь может загрузить любой собственный файл - + + + + + diff --git a/src/pages/Questions/branchingQuestions.tsx b/src/pages/Questions/branchingQuestions.tsx index 7db88e1c..380d1cf0 100644 --- a/src/pages/Questions/branchingQuestions.tsx +++ b/src/pages/Questions/branchingQuestions.tsx @@ -11,10 +11,15 @@ import { Modal, Radio, RadioGroup, + Tooltip, Typography, useTheme, } from "@mui/material"; -import { questionStore, resetSomeField, updateQuestionsList } from "@root/questions"; +import { + questionStore, + resetSomeField, + updateQuestionsList, +} from "@root/questions"; import { Select } from "./Select"; import RadioCheck from "@ui_kit/RadioCheck"; @@ -29,15 +34,22 @@ type BranchingQuestionsProps = { const ACTIONS = ["Показать", "Скрыть"]; const STIPULATIONS = ["Условие 1", "Условие 2", "Условие 3"]; const ANSWERS = ["Ответ 1", "Ответ 2", "Ответ 3"]; -const CONDITIONS = ["Все условия обязательны", "Обязательно хотя бы одно условие"]; +const CONDITIONS = [ + "Все условия обязательны", + "Обязательно хотя бы одно условие", +]; -export default function BranchingQuestions({ totalIndex }: BranchingQuestionsProps) { +export default function BranchingQuestions({ + totalIndex, +}: BranchingQuestionsProps) { const theme = useTheme(); const [titleInputWidth, setTitleInputWidth] = useState(0); const quizId = Number(useParams().quizId); const { openedModalSettings, listQuestions } = questionStore(); const titleRef = useRef(null); - const [title, setTitle] = useState(listQuestions[quizId][totalIndex].title) + const [title, setTitle] = useState( + listQuestions[quizId][totalIndex].title + ); useEffect(() => { setTitleInputWidth(titleRef.current?.offsetWidth || 0); @@ -74,9 +86,10 @@ export default function BranchingQuestions({ totalIndex }: BranchingQuestionsPro sx={{ boxSizing: "border-box", background: "#F2F3F7", - padding: "25px", height: "70px", + padding: "0 25px", display: "flex", + alignItems: "center", }} > @@ -113,7 +126,14 @@ export default function BranchingQuestions({ totalIndex }: BranchingQuestionsPro ) - + + + + + { - const clonContent = listQuestions[quizId][totalIndex].content; - - clonContent.rule.reqs[index] = { - id: String(STIPULATIONS.findIndex((item) => item.includes(stipulation))), - vars: request.vars, - }; - - updateQuestionsList(quizId, totalIndex, { - content: clonContent, - }); - }} - sx={{ marginBottom: "15px" }} - /> - {request.id && ( - <> - - Дан ответ - - (Укажите один или несколько вариантов) - - - { + const clonContent = + listQuestions[quizId][totalIndex].content; - clonContent.rule.reqs[index].vars.splice(removedItemIndex, 1); + clonContent.rule.reqs[index] = { + id: String( + STIPULATIONS.findIndex((item) => + item.includes(stipulation) + ) + ), + vars: request.vars, + }; - updateQuestionsList(quizId, totalIndex, { - content: clonContent, - }); - }} - /> - ))} - - - )} - - ))} + updateQuestionsList(quizId, totalIndex, { + content: clonContent, + }); + }} + sx={{ marginBottom: "15px" }} + /> + {request.id && ( + <> + + + Дан ответ + + + (Укажите один или несколько вариантов) + + +