2023-03-15 22:56:53 +00:00
|
|
|
import MiniButtonSetting from "@ui_kit/MiniButtonSetting";
|
|
|
|
import React from "react";
|
2023-05-03 19:21:00 +00:00
|
|
|
import SettingIcon from "../../assets/icons/questionsPage/settingIcon";
|
|
|
|
import Clue from "../../assets/icons/questionsPage/clue";
|
|
|
|
import Branching from "../../assets/icons/questionsPage/branching";
|
2023-04-15 09:10:59 +00:00
|
|
|
import { Box, IconButton, useTheme } from "@mui/material";
|
2023-05-03 19:21:00 +00:00
|
|
|
import HideIcon from "../../assets/icons/questionsPage/hideIcon";
|
|
|
|
import CopyIcon from "../../assets/icons/questionsPage/CopyIcon";
|
|
|
|
import DeleteIcon from "../../assets/icons/questionsPage/deleteIcon";
|
2023-06-30 14:39:07 +00:00
|
|
|
import {useParams} from "react-router-dom";
|
|
|
|
import {questionStore} from "@root/questions";
|
2023-03-15 22:56:53 +00:00
|
|
|
|
2023-03-18 21:35:09 +00:00
|
|
|
interface Props {
|
2023-04-15 09:10:59 +00:00
|
|
|
switchState: string;
|
|
|
|
SSHC: (data: string) => void;
|
2023-06-30 14:39:07 +00:00
|
|
|
totalIndex: number
|
2023-03-18 21:35:09 +00:00
|
|
|
}
|
2023-03-15 22:56:53 +00:00
|
|
|
|
2023-06-30 14:39:07 +00:00
|
|
|
export default function ButtonsOptions({ SSHC, switchState, totalIndex }: Props) {
|
|
|
|
const params = Number(useParams().quizId);
|
|
|
|
const {listQuestions, updateQuestionsList, createQuestion, removeQuestion} = questionStore()
|
2023-04-15 09:10:59 +00:00
|
|
|
const theme = useTheme();
|
|
|
|
const buttonSetting: { icon: JSX.Element; title: string; value: string }[] = [
|
|
|
|
{
|
|
|
|
icon: <SettingIcon color={switchState === "setting" ? "#ffffff" : theme.palette.grey3.main} />,
|
|
|
|
title: "Настройки",
|
|
|
|
value: "setting",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: <Clue color={switchState === "help" ? "#ffffff" : theme.palette.grey3.main} />,
|
|
|
|
title: "Подсказка",
|
|
|
|
value: "help",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: <Branching color={switchState === "branching" ? "#ffffff" : theme.palette.grey3.main} />,
|
|
|
|
title: "Ветвление",
|
|
|
|
value: "branching",
|
|
|
|
},
|
|
|
|
];
|
2023-03-30 18:39:59 +00:00
|
|
|
|
2023-04-15 09:10:59 +00:00
|
|
|
return (
|
|
|
|
<Box
|
|
|
|
sx={{
|
|
|
|
display: "flex",
|
|
|
|
justifyContent: "space-between",
|
|
|
|
width: "100%",
|
|
|
|
background: "#F2F3F7",
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<Box
|
|
|
|
sx={{
|
|
|
|
padding: "20px",
|
|
|
|
display: "flex",
|
|
|
|
gap: "10px",
|
|
|
|
}}
|
|
|
|
>
|
2023-04-23 08:39:34 +00:00
|
|
|
{buttonSetting.map(({ icon, title, value }) => (
|
2023-04-15 09:10:59 +00:00
|
|
|
<MiniButtonSetting
|
2023-04-23 08:39:34 +00:00
|
|
|
key={title}
|
2023-04-15 09:10:59 +00:00
|
|
|
onClick={() => {
|
2023-04-23 08:39:34 +00:00
|
|
|
SSHC(value);
|
2023-04-15 09:10:59 +00:00
|
|
|
}}
|
|
|
|
sx={{
|
2023-04-23 08:39:34 +00:00
|
|
|
backgroundColor: switchState === value ? theme.palette.brightPurple.main : "transparent",
|
|
|
|
color: switchState === value ? "#ffffff" : theme.palette.grey3.main,
|
2023-04-15 09:10:59 +00:00
|
|
|
}}
|
|
|
|
>
|
2023-04-23 08:39:34 +00:00
|
|
|
{icon}
|
|
|
|
{title}
|
2023-04-15 09:10:59 +00:00
|
|
|
</MiniButtonSetting>
|
|
|
|
))}
|
|
|
|
</Box>
|
|
|
|
<Box
|
|
|
|
sx={{
|
|
|
|
padding: "20px",
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<IconButton sx={{ borderRadius: "6px", padding: "2px" }}>
|
|
|
|
<HideIcon />
|
|
|
|
</IconButton>
|
|
|
|
<IconButton sx={{ borderRadius: "6px", padding: "2px" }}>
|
|
|
|
<CopyIcon />
|
|
|
|
</IconButton>
|
2023-06-30 14:39:07 +00:00
|
|
|
<IconButton sx={{ borderRadius: "6px", padding: "2px" }} onClick={() => removeQuestion(params, totalIndex)}>
|
2023-04-15 09:10:59 +00:00
|
|
|
<DeleteIcon />
|
|
|
|
</IconButton>
|
|
|
|
</Box>
|
|
|
|
</Box>
|
|
|
|
);
|
|
|
|
}
|