2023-12-20 22:59:28 +00:00
|
|
|
|
import { Box, Modal, Typography, Divider } from "@mui/material";
|
2023-12-19 13:42:43 +00:00
|
|
|
|
|
|
|
|
|
import { useUiTools } from "@root/uiTools/store";
|
|
|
|
|
import { updateModalInfoWhyCantCreate } from "@root/uiTools/actions";
|
2023-12-19 19:55:59 +00:00
|
|
|
|
import { useLayoutEffect } from "react";
|
2023-12-19 13:42:43 +00:00
|
|
|
|
|
|
|
|
|
export const ModalInfoWhyCantCreate = () => {
|
2023-12-20 22:59:28 +00:00
|
|
|
|
const { whyCantCreatePublic, openModalInfoWhyCantCreate } = useUiTools();
|
2023-12-19 13:42:43 +00:00
|
|
|
|
|
2023-12-28 20:08:41 +00:00
|
|
|
|
useLayoutEffect(() => {
|
|
|
|
|
console.log(whyCantCreatePublic)
|
|
|
|
|
if (Object.values(whyCantCreatePublic).length===0) {
|
|
|
|
|
console.log("нет проблем")
|
|
|
|
|
updateModalInfoWhyCantCreate(false)
|
|
|
|
|
}
|
|
|
|
|
}, [openModalInfoWhyCantCreate])
|
|
|
|
|
|
2023-12-20 22:59:28 +00:00
|
|
|
|
return (
|
|
|
|
|
<Modal open={openModalInfoWhyCantCreate} onClose={() => updateModalInfoWhyCantCreate(false)}>
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
position: "absolute" as "absolute",
|
|
|
|
|
top: "50%",
|
|
|
|
|
left: "50%",
|
|
|
|
|
transform: "translate(-50%, -50%)",
|
|
|
|
|
maxWidth: "620px",
|
|
|
|
|
width: "100%",
|
|
|
|
|
bgcolor: "background.paper",
|
|
|
|
|
borderRadius: "12px",
|
2023-12-19 13:42:43 +00:00
|
|
|
|
|
2023-12-20 22:59:28 +00:00
|
|
|
|
boxShadow: 24,
|
|
|
|
|
p: "25px",
|
|
|
|
|
minHeight: "60vh",
|
|
|
|
|
maxHeight: "90vh",
|
|
|
|
|
overflow: "auto",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{Object.values(whyCantCreatePublic).map((data) => {
|
|
|
|
|
return (
|
|
|
|
|
<Box>
|
2023-12-27 23:28:44 +00:00
|
|
|
|
<Typography color="#7e2aea">{data.name === "quiz" ? "У квиза" : `У вопроса "${data.name}"`}</Typography>
|
2023-12-20 22:59:28 +00:00
|
|
|
|
{data.problems.map((problem) => (
|
|
|
|
|
<Typography p="5px 0">{problem}</Typography>
|
|
|
|
|
))}
|
|
|
|
|
<Divider />
|
2023-12-19 13:42:43 +00:00
|
|
|
|
</Box>
|
2023-12-20 22:59:28 +00:00
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</Box>
|
|
|
|
|
</Modal>
|
|
|
|
|
);
|
|
|
|
|
};
|