From 8c983cb91a8734edc77c3091d41322ae4de71650 Mon Sep 17 00:00:00 2001 From: IlyaDoronin Date: Fri, 13 Oct 2023 14:28:51 +0300 Subject: [PATCH] fix: branchOptions --- src/pages/Questions/ButtonsOptions.tsx | 244 ++++++++--------- src/pages/Questions/ButtonsOptionsAndPict.tsx | 250 +++++++++--------- 2 files changed, 240 insertions(+), 254 deletions(-) diff --git a/src/pages/Questions/ButtonsOptions.tsx b/src/pages/Questions/ButtonsOptions.tsx index 8ea8d21b..fd6c744b 100644 --- a/src/pages/Questions/ButtonsOptions.tsx +++ b/src/pages/Questions/ButtonsOptions.tsx @@ -129,140 +129,130 @@ export default function ButtonsOptions({ {buttonSetting.map(({ icon, title, value, myFunc }) => ( {value === "branching" ? ( - quize.config.type === "quize" && ( - - - Будет показан при условии - - - Название - - - Условие 1, Условие 2 - - - Все условия обязательны - - - } + + + Будет показан при условии + + + Название + + + Условие 1, Условие 2 + + + Все условия обязательны + + + } + > + { + SSHC(value); + myFunc(); + }} + sx={{ + backgroundColor: + switchState === value + ? theme.palette.brightPurple.main + : "transparent", + color: + switchState === value + ? "#ffffff" + : theme.palette.grey3.main, + minWidth: isWrappMiniButtonSetting ? "30px" : "64px", + height: "30px", + "&:hover": { + color: theme.palette.grey3.main, + "& path": { stroke: theme.palette.grey3.main }, + }, + }} > - { - SSHC(value); - myFunc(); - }} - sx={{ - backgroundColor: - switchState === value - ? theme.palette.brightPurple.main - : "transparent", - color: - switchState === value - ? "#ffffff" - : theme.palette.grey3.main, - minWidth: isWrappMiniButtonSetting ? "30px" : "64px", - height: "30px", - "&:hover": { - color: theme.palette.grey3.main, - "& path": { stroke: theme.palette.grey3.main }, - }, - }} - > - {icon} - {isWrappMiniButtonSetting ? null : title} - - - ) + {icon} + {isWrappMiniButtonSetting ? null : title} + + ) : ( <> - {(value !== "setting" || - quize.config.type === "quize" || - (value === "setting" && - quize.config.type === "form" && - question.type)) && ( - { - SSHC(value); - myFunc(); - }} - sx={{ - backgroundColor: - switchState === value - ? theme.palette.brightPurple.main - : "transparent", - color: - switchState === value - ? "#ffffff" - : theme.palette.grey3.main, - minWidth: isWrappMiniButtonSetting ? "30px" : "64px", - height: "30px", - "&:hover": { - color: theme.palette.grey3.main, - "& path": { stroke: theme.palette.grey3.main }, - }, - }} - > - {icon} - {isWrappMiniButtonSetting ? null : title} - - )} + { + SSHC(value); + myFunc(); + }} + sx={{ + backgroundColor: + switchState === value + ? theme.palette.brightPurple.main + : "transparent", + color: + switchState === value + ? "#ffffff" + : theme.palette.grey3.main, + minWidth: isWrappMiniButtonSetting ? "30px" : "64px", + height: "30px", + "&:hover": { + color: theme.palette.grey3.main, + "& path": { stroke: theme.palette.grey3.main }, + }, + }} + > + {icon} + {isWrappMiniButtonSetting ? null : title} + )} ))} - {quize.config.type === "quize" && ( - <> - setOpenedReallyChangingModal(true)} - sx={{ - minWidth: "30px", - height: "30px", - backgroundColor: "#FEDFD0", - }} - > - - - setOpenedReallyChangingModal(true)} - sx={{ - minWidth: "30px", - height: "30px", - backgroundColor: "#FEDFD0", - }} - > - - - setOpenedReallyChangingModal(true)} - sx={{ - minWidth: "30px", - height: "30px", - backgroundColor: "#FEDFD0", - }} - > - - - - )} + <> + setOpenedReallyChangingModal(true)} + sx={{ + minWidth: "30px", + height: "30px", + backgroundColor: "#FEDFD0", + }} + > + + + setOpenedReallyChangingModal(true)} + sx={{ + minWidth: "30px", + height: "30px", + backgroundColor: "#FEDFD0", + }} + > + + + setOpenedReallyChangingModal(true)} + sx={{ + minWidth: "30px", + height: "30px", + backgroundColor: "#FEDFD0", + }} + > + + + {isIconMobile ? null : "Подсказка"} - {quize.config.type === "quize" && ( - <> - + - - Будет показан при условии - - - Название - - - Условие 1, Условие 2 - - - Все условия обязательны - - - } - > - setButtonHover("branching")} - onMouseLeave={() => setButtonHover("")} - onClick={() => { - SSHC("branching"); - openedModal(); - }} - sx={{ - height: "30px", - maxWidth: "103px", - minWidth: isIconMobile ? "30px" : "64px", - backgroundColor: - switchState === "branching" - ? theme.palette.brightPurple.main - : "transparent", - color: - switchState === "branching" - ? "#ffffff" - : theme.palette.grey3.main, - "&:hover": { - color: - switchState === "branching" - ? theme.palette.grey3.main - : null, - }, - }} - > - - {isIconMobile ? null : "Ветвление"} - - + }, + }} + title={ + + + Будет показан при условии + + + Название + + + Условие 1, Условие 2 + + + Все условия обязательны + + + } + > setButtonHover("image")} + onMouseEnter={() => setButtonHover("branching")} onMouseLeave={() => setButtonHover("")} onClick={() => { - SSHC("image"); + SSHC("branching"); + openedModal(); }} sx={{ height: "30px", - maxWidth: "123px", + maxWidth: "103px", minWidth: isIconMobile ? "30px" : "64px", backgroundColor: - switchState === "image" + switchState === "branching" ? theme.palette.brightPurple.main : "transparent", color: - switchState === "image" + switchState === "branching" ? "#ffffff" : theme.palette.grey3.main, "&:hover": { color: - switchState === "image" ? theme.palette.grey3.main : null, + switchState === "branching" + ? theme.palette.grey3.main + : null, }, }} > - - {isIconMobile ? null : "Изображение"} + {isIconMobile ? null : "Ветвление"} - setOpenedReallyChangingModal(true)} - sx={{ - minWidth: "30px", - height: "30px", - backgroundColor: "#FEDFD0", - }} - > - - - setOpenedReallyChangingModal(true)} - sx={{ - minWidth: "30px", - height: "30px", - backgroundColor: "#FEDFD0", - }} - > - - - setOpenedReallyChangingModal(true)} - sx={{ - minWidth: "30px", - height: "30px", - backgroundColor: "#FEDFD0", - }} - > - - - - )} + + setButtonHover("image")} + onMouseLeave={() => setButtonHover("")} + onClick={() => { + SSHC("image"); + }} + sx={{ + height: "30px", + maxWidth: "123px", + minWidth: isIconMobile ? "30px" : "64px", + backgroundColor: + switchState === "image" + ? theme.palette.brightPurple.main + : "transparent", + color: + switchState === "image" ? "#ffffff" : theme.palette.grey3.main, + "&:hover": { + color: + switchState === "image" ? theme.palette.grey3.main : null, + }, + }} + > + + {isIconMobile ? null : "Изображение"} + + setOpenedReallyChangingModal(true)} + sx={{ + minWidth: "30px", + height: "30px", + backgroundColor: "#FEDFD0", + }} + > + + + setOpenedReallyChangingModal(true)} + sx={{ + minWidth: "30px", + height: "30px", + backgroundColor: "#FEDFD0", + }} + > + + + setOpenedReallyChangingModal(true)} + sx={{ + minWidth: "30px", + height: "30px", + backgroundColor: "#FEDFD0", + }} + > + + +