2023-05-14 11:00:37 +00:00
|
|
|
|
import {Typography, Box, Button, SxProps, Theme} from "@mui/material";
|
2023-05-10 17:35:30 +00:00
|
|
|
|
import ComplexNavText from "./ComplexNavText";
|
|
|
|
|
import QuizCard from "./QuizCard";
|
2023-05-10 11:40:39 +00:00
|
|
|
|
import SectionWrapper from "@ui_kit/SectionWrapper";
|
|
|
|
|
import React from "react";
|
2023-05-14 11:00:37 +00:00
|
|
|
|
import {quizStore} from "@root/quizes";
|
2023-05-20 20:36:33 +00:00
|
|
|
|
import FirstQuiz from "./FirstQuiz";
|
2023-05-26 18:27:33 +00:00
|
|
|
|
import {useNavigate} from "react-router-dom";
|
2023-05-10 11:40:39 +00:00
|
|
|
|
interface Props {
|
|
|
|
|
outerContainerSx?: SxProps<Theme>;
|
|
|
|
|
children?: React.ReactNode;
|
|
|
|
|
}
|
2022-12-09 11:48:15 +00:00
|
|
|
|
|
2023-05-20 20:36:33 +00:00
|
|
|
|
|
2023-05-10 11:40:39 +00:00
|
|
|
|
export default function MyQuizzesFull({outerContainerSx: sx, children}: Props) {
|
2023-05-26 18:27:33 +00:00
|
|
|
|
const {listQuizes, updateQuizesList, removeQuiz, createBlank} = quizStore()
|
|
|
|
|
const navigate = useNavigate()
|
|
|
|
|
|
2022-12-09 11:48:15 +00:00
|
|
|
|
return (
|
2023-05-20 20:36:33 +00:00
|
|
|
|
<>
|
|
|
|
|
{Object.keys(listQuizes).length === 0 ?
|
|
|
|
|
<FirstQuiz/> :
|
2023-05-14 11:00:37 +00:00
|
|
|
|
|
2023-05-20 20:36:33 +00:00
|
|
|
|
|
|
|
|
|
<SectionWrapper
|
|
|
|
|
maxWidth="lg"
|
|
|
|
|
>
|
|
|
|
|
<ComplexNavText text1="Кабинет квизов"/>
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
justifyContent: "space-between",
|
|
|
|
|
alignItems: "center",
|
|
|
|
|
mt: "20px",
|
|
|
|
|
mb: "30px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Typography variant="h4">Мои квизы</Typography>
|
|
|
|
|
<Button
|
|
|
|
|
variant="contained"
|
|
|
|
|
sx={{padding: "10px 47px"}}
|
|
|
|
|
onClick={() => {
|
2023-10-10 13:33:21 +00:00
|
|
|
|
navigate(`/setting/${createBlank()}`);
|
2023-05-20 20:36:33 +00:00
|
|
|
|
}}
|
|
|
|
|
>Создать +</Button>
|
|
|
|
|
</Box>
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
py: "10px",
|
|
|
|
|
display: "flex",
|
|
|
|
|
flexWrap: "wrap",
|
|
|
|
|
gap: "40px",
|
|
|
|
|
mb: "60px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{Object.values(listQuizes).map((e, i) =>(
|
|
|
|
|
<QuizCard name={e.name}
|
|
|
|
|
openCount={0}
|
|
|
|
|
applicationCount={0}
|
|
|
|
|
conversionPercent={0}
|
|
|
|
|
onClickDelete={() => {
|
|
|
|
|
removeQuiz(e.id)
|
2023-05-26 19:06:39 +00:00
|
|
|
|
}}
|
|
|
|
|
onClickEdit={() =>
|
2023-10-10 13:33:21 +00:00
|
|
|
|
navigate(`/setting/${e.id}`)
|
2023-05-26 19:06:39 +00:00
|
|
|
|
}
|
|
|
|
|
/>
|
2023-05-20 20:36:33 +00:00
|
|
|
|
)
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
</Box>
|
|
|
|
|
{children}
|
|
|
|
|
</SectionWrapper>
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
</>
|
2023-05-10 11:40:39 +00:00
|
|
|
|
)
|
2023-05-20 20:36:33 +00:00
|
|
|
|
}
|