import { useState } from "react"; import MiniButtonSetting from "@ui_kit/MiniButtonSetting"; import SettingIcon from "../../assets/icons/questionsPage/settingIcon"; import Clue from "../../assets/icons/questionsPage/clue"; import Branching from "../../assets/icons/questionsPage/branching"; import { Box, IconButton, Tooltip, Typography, useMediaQuery, useTheme } from "@mui/material"; import { HideIcon } from "../../assets/icons/questionsPage/hideIcon"; import { CopyIcon } from "../../assets/icons/questionsPage/CopyIcon"; import { DeleteIcon } from "../../assets/icons/questionsPage/deleteIcon"; import ImgIcon from "../../assets/icons/questionsPage/imgIcon"; import { useParams } from "react-router-dom"; import { questionStore, copyQuestion, removeQuestion, resetSomeField } from "@root/questions"; import { DoubleArrowRight } from "@icons/questionsPage/DoubleArrowRight"; import { DoubleTick } from "@icons/questionsPage/DoubleTick"; import { VectorQuestions } from "@icons/questionsPage/VectorQuestions"; import { ReallyChangingModal } from "@ui_kit/Modal/ReallyChangingModal/ReallyChangingModal"; import "./ButtonsOptionsAndPict.css"; interface Props { switchState: string; SSHC: (data: string) => void; totalIndex: number; } export default function ButtonsOptionsAndPict({ SSHC, switchState, totalIndex }: Props) { const [buttonHover, setButtonHover] = useState(""); const quizId = Number(useParams().quizId); const { openedModalSettings } = questionStore(); const theme = useTheme(); const isMobile = useMediaQuery(theme.breakpoints.down(790)); const isIconMobile = useMediaQuery(theme.breakpoints.down(1050)); const [openedReallyChangingModal, setOpenedReallyChangingModal] = useState(false); const openedModal = () => { resetSomeField({ openedModalSettings: "open" }); }; return ( setButtonHover("setting")} onMouseLeave={() => setButtonHover("")} onClick={() => { SSHC("setting"); }} sx={{ maxWidth: "104px", minWidth: isIconMobile ? "30px" : "64px", height: "30px", backgroundColor: switchState === "setting" ? theme.palette.brightPurple.main : "transparent", color: switchState === "setting" ? "#ffffff" : theme.palette.grey3.main, "&:hover": { color: switchState === "setting" ? theme.palette.grey3.main : null, }, }} > {isIconMobile ? null : "Настройки"} setButtonHover("help")} onMouseLeave={() => setButtonHover("")} onClick={() => { SSHC("help"); }} sx={{ minWidth: isIconMobile ? "30px" : "64px", maxWidth: "102px", height: "30px", backgroundColor: switchState === "help" ? theme.palette.brightPurple.main : "transparent", color: switchState === "help" ? "#ffffff" : theme.palette.grey3.main, "&:hover": { color: switchState === "help" ? theme.palette.grey3.main : null, }, }} > {isIconMobile ? null : "Подсказка"} Будет показан при условии Название Условие 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 : "Ветвление"} 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", }} > copyQuestion(quizId, totalIndex)}> removeQuestion(quizId, totalIndex)} > setOpenedReallyChangingModal(false)} /> ); }