2024-04-04 13:48:45 +00:00
|
|
|
|
import { Skeleton, Typography, useMediaQuery, useTheme } from "@mui/material";
|
|
|
|
|
import React, { useEffect, useState } from "react";
|
|
|
|
|
import Box from "@mui/material/Box";
|
|
|
|
|
import { useCurrentQuiz } from "@root/quizes/hooks";
|
|
|
|
|
import { useQuizStore } from "@root/quizes/store";
|
|
|
|
|
import { useNavigate } from "react-router-dom";
|
|
|
|
|
import { PartnersBoard } from "./PartnersBoard/PartnersBoard";
|
|
|
|
|
import { IntegrationsModal } from "./IntegrationsModal/IntegrationsModal";
|
2024-04-09 13:07:42 +00:00
|
|
|
|
import { partnersMock } from "./mocks/MockData";
|
2024-04-04 13:48:45 +00:00
|
|
|
|
|
|
|
|
|
interface IntegrationsPageProps {
|
|
|
|
|
heightSidebar: number;
|
|
|
|
|
mobileSidebar: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const IntegrationsPage = ({
|
|
|
|
|
heightSidebar,
|
|
|
|
|
mobileSidebar,
|
|
|
|
|
}: IntegrationsPageProps) => {
|
|
|
|
|
const quiz = useCurrentQuiz();
|
|
|
|
|
const { editQuizId } = useQuizStore();
|
|
|
|
|
const theme = useTheme();
|
|
|
|
|
const navigate = useNavigate();
|
|
|
|
|
const isMobile = useMediaQuery(theme.breakpoints.down(660));
|
|
|
|
|
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
|
2024-04-05 10:48:10 +00:00
|
|
|
|
const [companyName, setCompanyName] = useState<string | null>(null);
|
2024-04-04 13:48:45 +00:00
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (editQuizId === null) navigate("/list");
|
|
|
|
|
}, [navigate, editQuizId]);
|
|
|
|
|
|
|
|
|
|
const heightBar = heightSidebar + 51 + 88 + 36 + 25;
|
|
|
|
|
|
|
|
|
|
if (quiz === undefined)
|
|
|
|
|
return (
|
|
|
|
|
<Skeleton sx={{ width: "100vw", height: "100vh", transform: "none" }} />
|
|
|
|
|
);
|
2024-04-05 10:48:10 +00:00
|
|
|
|
|
|
|
|
|
const handleCloseModal = () => {
|
|
|
|
|
setIsModalOpen(false);
|
2024-04-18 01:32:39 +00:00
|
|
|
|
// setTimeout(() => {
|
|
|
|
|
// setCompanyName(null);
|
|
|
|
|
// }, 300);
|
2024-04-05 10:48:10 +00:00
|
|
|
|
};
|
|
|
|
|
|
2024-04-04 13:48:45 +00:00
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
width: "100%",
|
|
|
|
|
padding: isMobile
|
|
|
|
|
? mobileSidebar
|
|
|
|
|
? `calc(${heightBar}px - 92px) 16px 70px 16px`
|
|
|
|
|
: "67px 16px 70px 16px"
|
|
|
|
|
: "25px",
|
|
|
|
|
height: isMobile ? "100vh" : "calc(100vh - 80px)",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Typography
|
|
|
|
|
variant="h5"
|
|
|
|
|
sx={{ marginBottom: "40px", color: "#333647" }}
|
|
|
|
|
>
|
|
|
|
|
Интеграции
|
|
|
|
|
</Typography>
|
|
|
|
|
<PartnersBoard
|
|
|
|
|
partners={partnersMock}
|
|
|
|
|
setIsModalOpen={setIsModalOpen}
|
2024-04-05 10:48:10 +00:00
|
|
|
|
setCompanyName={setCompanyName}
|
2024-04-04 13:48:45 +00:00
|
|
|
|
isModalOpen={isModalOpen}
|
2024-04-05 10:48:10 +00:00
|
|
|
|
handleCloseModal={handleCloseModal}
|
2024-04-04 13:48:45 +00:00
|
|
|
|
/>
|
2024-04-18 01:32:39 +00:00
|
|
|
|
{/*<IntegrationsModal*/}
|
|
|
|
|
{/* isModalOpen={isModalOpen}*/}
|
|
|
|
|
{/* handleCloseModal={handleCloseModal}*/}
|
|
|
|
|
{/* companyName={companyName}*/}
|
|
|
|
|
{/*/>*/}
|
2024-04-04 13:48:45 +00:00
|
|
|
|
</Box>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
};
|