diff --git a/src/pages/createQuize/AvailablePrivilege.tsx b/src/pages/createQuize/AvailablePrivilege.tsx new file mode 100644 index 00000000..7eeff3dc --- /dev/null +++ b/src/pages/createQuize/AvailablePrivilege.tsx @@ -0,0 +1,62 @@ +import { Box, Typography } from "@mui/material"; +import { useUserStore } from "@root/user"; + +export default function AvailablePrivilege() { + const user = useUserStore(); + const userPrivileges = user.userAccount?.privileges; + console.log("это доступные привелегии", userPrivileges); + const DayForm = ["день", "дня", "дней"]; + function declOfNum(n: number, text_forms: string[]) { + n = Math.abs(n) % 100; + var n1 = n % 10; + if (n > 10 && n < 20) { + return text_forms[2]; + } + if (n1 > 1 && n1 < 5) { + return text_forms[1]; + } + if (n1 == 1) { + return text_forms[0]; + } + return text_forms[2]; + } + const quizUnlimTime = userPrivileges?.["Безлимит Опросов"]?.amount || 0; + const quizCnt = userPrivileges?.["Количество Заявок"]?.amount || 0; + const squizHideBadge = userPrivileges?.squizHideBadge?.amount || 0; + return ( + + + Вам доступно: + + + Безлимитные заявки:{" "} + + {quizUnlimTime} {declOfNum(quizUnlimTime, DayForm)} + + + {quizCnt !== 0 && ( + + Заявки: {quizCnt} шт. + + )} + {squizHideBadge !== 0 && ( + + Скрытие логотипа PenaQuiz:{" "} + + {squizHideBadge} {declOfNum(squizHideBadge, DayForm)} + + + )} + + ); +} diff --git a/src/pages/createQuize/FirstQuiz.tsx b/src/pages/createQuize/FirstQuiz.tsx index 7740bd1d..afa9ee46 100755 --- a/src/pages/createQuize/FirstQuiz.tsx +++ b/src/pages/createQuize/FirstQuiz.tsx @@ -4,6 +4,8 @@ import ComplexNavText from "./ComplexNavText"; import { createQuiz } from "@root/quizes/actions"; import { useNavigate } from "react-router-dom"; import { resetEditConfig } from "@root/quizes/actions"; +import AvailablePrivilege from "./AvailablePrivilege"; +import React from "react"; export default function FirstQuiz() { const navigate = useNavigate(); @@ -13,7 +15,7 @@ export default function FirstQuiz() { maxWidth="lg" sx={{ mt: "25px", - mb: "70px", + mb: "40px", padding: "10px", }} > @@ -26,9 +28,11 @@ export default function FirstQuiz() { > Создайте свой первый quiz +