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 "./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(930)); const openedModal = () => { resetSomeField({ openedModalSettings: "open" }); }; return ( setButtonHover("setting")} onMouseLeave={() => setButtonHover("")} onClick={() => { SSHC("setting"); }} sx={{ 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", 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", 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", 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 : "Изображение"} copyQuestion(quizId, totalIndex)} > removeQuestion(quizId, totalIndex)} > ); }