import MiniButtonSetting from "@ui_kit/MiniButtonSetting"; import { useParams } from "react-router-dom"; import React from "react"; import SettingIcon from "../../assets/icons/questionsPage/settingIcon"; import Clue from "../../assets/icons/questionsPage/clue"; import Branching from "../../assets/icons/questionsPage/branching"; import { Box, Typography, Tooltip, IconButton, 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 { questionStore, resetSomeField, copyQuestion, removeQuestion, } from "@root/questions"; interface Props { switchState: string; SSHC: (data: string) => void; totalIndex: number; } export default function ButtonsOptions({ SSHC, switchState, totalIndex, }: Props) { const quizId = Number(useParams().quizId); const { openedModalSettings } = questionStore(); const openedModal = () => { resetSomeField({ openedModalSettings: "open" }); console.log(openedModalSettings); }; const theme = useTheme(); const buttonSetting: { icon: JSX.Element; title: string; value: string; myFunc?: any; }[] = [ { icon: ( ), title: "Настройки", value: "setting", }, { icon: ( ), title: "Подсказка", value: "help", }, { icon: ( ), title: "Ветвление", value: "branching", myFunc: openedModal, }, ]; return ( {buttonSetting.map(({ icon, title, value, myFunc }) => ( <> {value === "branching" ? ( Будет показан при условии Название Условие 1, Условие 2 Все условия обязательны } > { SSHC(value); myFunc(); }} sx={{ backgroundColor: switchState === value ? theme.palette.brightPurple.main : "transparent", color: switchState === value ? "#ffffff" : theme.palette.grey3.main, }} > {icon} {title} ) : ( { SSHC(value); myFunc(); }} sx={{ backgroundColor: switchState === value ? theme.palette.brightPurple.main : "transparent", color: switchState === value ? "#ffffff" : theme.palette.grey3.main, }} > {icon} {title} )} ))} copyQuestion(quizId, totalIndex)} > removeQuestion(quizId, totalIndex)} > ); }