diff --git a/src/pages/createQuize/FirstQuiz.tsx b/src/pages/createQuize/FirstQuiz.tsx index 6a78c7cb..59f979e5 100755 --- a/src/pages/createQuize/FirstQuiz.tsx +++ b/src/pages/createQuize/FirstQuiz.tsx @@ -1,8 +1,17 @@ import {Button, Typography, useTheme} from "@mui/material"; import ComplexNavText from "./ComplexNavText"; import SectionWrapper from "@ui_kit/SectionWrapper"; +import {quizStore} from "@root/quizes"; + +function getRandom(min: number, max:number) { + min = Math.ceil(min); + max = Math.floor(max); + return Math.floor(Math.random() * (max - min)) + min; +} export default function FirstQuiz() { + const {listQuizes, updateQuizesList, removeQuiz} = quizStore() + return ( diff --git a/src/pages/createQuize/MyQuizzesFull.tsx b/src/pages/createQuize/MyQuizzesFull.tsx index 1466635e..631b3a54 100644 --- a/src/pages/createQuize/MyQuizzesFull.tsx +++ b/src/pages/createQuize/MyQuizzesFull.tsx @@ -4,90 +4,102 @@ import QuizCard from "./QuizCard"; import SectionWrapper from "@ui_kit/SectionWrapper"; import React from "react"; import {quizStore} from "@root/quizes"; +import FirstQuiz from "./FirstQuiz"; interface Props { outerContainerSx?: SxProps; children?: React.ReactNode; } +function getRandom(min: number, max:number) { + min = Math.ceil(min); + max = Math.floor(max); + return Math.floor(Math.random() * (max - min)) + min; +} + + + export default function MyQuizzesFull({outerContainerSx: sx, children}: Props) { const {listQuizes, updateQuizesList, removeQuiz} = quizStore() - return ( - - - - - - - Мои квизы - - - - {Object.values(listQuizes).map((e, i) =>( - - ) - )} + <> + {Object.keys(listQuizes).length === 0 ? + : - - {children} - + + + + + Мои квизы + + + + {Object.values(listQuizes).map((e, i) =>( + { + removeQuiz(e.id) + }}/> + ) + )} + + + {children} + + + } + ) -} \ No newline at end of file +} diff --git a/src/pages/createQuize/QuizCard.tsx b/src/pages/createQuize/QuizCard.tsx index a2305f43..0a9e7796 100755 --- a/src/pages/createQuize/QuizCard.tsx +++ b/src/pages/createQuize/QuizCard.tsx @@ -10,9 +10,10 @@ interface Props { openCount?: number; applicationCount?: number; conversionPercent?: number; + onClickDelete?: () => void; } -export default function QuizCard({ name, openCount = 0, applicationCount = 0, conversionPercent = 0 }: Props) { +export default function QuizCard({ name, openCount = 0, applicationCount = 0, conversionPercent = 0, onClickDelete }: Props) { const theme = useTheme(); return ( @@ -25,6 +26,7 @@ export default function QuizCard({ name, openCount = 0, applicationCount = 0, co height: "280px", p: "20px", borderRadius: "12px", + boxSizing: "border-box", boxShadow: `0px 100px 309px rgba(210, 208, 225, 0.24), 0px 41.7776px 129.093px rgba(210, 208, 225, 0.172525), 0px 22.3363px 69.0192px rgba(210, 208, 225, 0.143066), @@ -75,7 +77,7 @@ export default function QuizCard({ name, openCount = 0, applicationCount = 0, co