2024-07-13 20:51:53 +00:00
|
|
|
|
import { Link, useNavigate } from "react-router-dom";
|
|
|
|
|
|
import { Box, Button, Typography, useMediaQuery, useTheme } from "@mui/material";
|
|
|
|
|
|
import { ReactComponent as TemplateIcon } from "@/assets/quiz-templates/template.svg";
|
|
|
|
|
|
import { createQuiz, resetEditConfig } from "@root/quizes/actions";
|
2024-05-28 20:39:21 +00:00
|
|
|
|
import React from "react";
|
2024-07-13 20:51:53 +00:00
|
|
|
|
import { useUserStore } from "@/stores/user";
|
2024-05-28 20:39:21 +00:00
|
|
|
|
|
2024-07-13 20:51:53 +00:00
|
|
|
|
export default function CreateButtons({ mt }: string) {
|
2024-05-28 20:39:21 +00:00
|
|
|
|
const navigate = useNavigate();
|
|
|
|
|
|
const theme = useTheme();
|
2024-07-13 20:51:53 +00:00
|
|
|
|
const user = useUserStore();
|
2024-05-28 20:39:21 +00:00
|
|
|
|
const isMobile = useMediaQuery(theme.breakpoints.down(500));
|
|
|
|
|
|
|
2024-07-13 20:51:53 +00:00
|
|
|
|
return (
|
2024-05-28 20:39:21 +00:00
|
|
|
|
<Box
|
|
|
|
|
|
sx={{
|
|
|
|
|
|
display: "flex",
|
|
|
|
|
|
gap: "20px",
|
|
|
|
|
|
flexWrap: "wrap",
|
|
|
|
|
|
marginTop: mt,
|
|
|
|
|
|
}}
|
|
|
|
|
|
>
|
2024-07-13 20:51:53 +00:00
|
|
|
|
{
|
2024-08-11 04:42:49 +00:00
|
|
|
|
user?.user?._id === "6692e068983ee77f8e1e682e" &&
|
2024-07-13 20:51:53 +00:00
|
|
|
|
<Link to="/gallery" style={{ textDecoration: "none" }}>
|
|
|
|
|
|
<Button
|
|
|
|
|
|
sx={{
|
|
|
|
|
|
display: "flex",
|
|
|
|
|
|
gap: "10px",
|
|
|
|
|
|
padding: "13px",
|
|
|
|
|
|
borderRadius: "8px",
|
|
|
|
|
|
background: "#9A9AAF17",
|
|
|
|
|
|
color: theme.palette.brightPurple.main,
|
|
|
|
|
|
transition: ".2s",
|
|
|
|
|
|
"&:hover": {
|
|
|
|
|
|
color: theme.palette.background.paper,
|
|
|
|
|
|
background: theme.palette.brightPurple.main,
|
|
|
|
|
|
"& svg path": { stroke: theme.palette.background.paper },
|
|
|
|
|
|
},
|
|
|
|
|
|
}}
|
|
|
|
|
|
>
|
|
|
|
|
|
<TemplateIcon />
|
|
|
|
|
|
{!isMobile && <Typography>Посмотреть шаблоны</Typography>}
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
</Link>
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2024-05-28 20:39:21 +00:00
|
|
|
|
<Button
|
|
|
|
|
|
variant="contained"
|
|
|
|
|
|
sx={{
|
|
|
|
|
|
padding: isMobile ? "10px" : "10px 47px",
|
|
|
|
|
|
minWidth: "44px",
|
|
|
|
|
|
}}
|
|
|
|
|
|
onClick={() => {
|
|
|
|
|
|
resetEditConfig();
|
|
|
|
|
|
createQuiz(navigate);
|
|
|
|
|
|
}}
|
|
|
|
|
|
data-cy="create-quiz"
|
|
|
|
|
|
>
|
|
|
|
|
|
{isMobile ? "+" : "Создать +"}
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
</Box>
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|