diff --git a/src/App.tsx b/src/App.tsx index 5045ad9e..f6890e2e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -46,11 +46,15 @@ import OutdatedLink from "./pages/auth/OutdatedLink"; import { useAfterpay } from "@utils/hooks/useAfterpay"; const MyQuizzesFull = lazy(() => import("./pages/createQuize/MyQuizzesFull")); + const ViewPage = lazy(() => import("./pages/ViewPublicationPage")); const Analytics = lazy(() => import("./pages/Analytics/Analytics")); const EditPage = lazy(() => import("./pages/startPage/EditPage")); const { Tariffs } = lazily(() => import("./pages/Tariffs/Tariffs")); const { DesignPage } = lazily(() => import("./pages/DesignPage/DesignPage")); +const { IntegrationsPage } = lazily( + () => import("./pages/IntegrationsPage/IntegrationsPage"), +); const { QuizAnswersPage } = lazily( () => import("./pages/QuizAnswersPage/QuizAnswersPage"), ); @@ -75,6 +79,13 @@ const routeslink = [ sidebar: true, footer: true, }, + { + path: "/integrations", + page: IntegrationsPage, + header: true, + sidebar: true, + footer: true, + }, ] as const; const LazyLoading = ({ children, fallback }: SuspenseProps) => ( diff --git a/src/pages/IntegrationsPage/IntegrationsModal/IntegrationsModal.tsx b/src/pages/IntegrationsPage/IntegrationsModal/IntegrationsModal.tsx new file mode 100644 index 00000000..6a4f656f --- /dev/null +++ b/src/pages/IntegrationsPage/IntegrationsModal/IntegrationsModal.tsx @@ -0,0 +1,56 @@ +import { Dialog, IconButton, useTheme } from "@mui/material"; +import { FC } from "react"; +import Box from "@mui/material/Box"; +import CloseIcon from "@mui/icons-material/Close"; + +type IntegrationsModalProps = { + isModalOpen: boolean; + setIsModalOpen: (value: boolean) => void; +}; + +export const IntegrationsModal: FC = ({ + isModalOpen, + setIsModalOpen, +}) => { + const theme = useTheme(); + + function handleClose() { + setIsModalOpen(false); + } + + return ( + + + + + + + ); +}; diff --git a/src/pages/IntegrationsPage/IntegrationsPage.tsx b/src/pages/IntegrationsPage/IntegrationsPage.tsx new file mode 100644 index 00000000..a4c2ac4a --- /dev/null +++ b/src/pages/IntegrationsPage/IntegrationsPage.tsx @@ -0,0 +1,80 @@ +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 amoCrmLogo from "./mocks/amoCrmLogo.png"; +import { IntegrationsModal } from "./IntegrationsModal/IntegrationsModal"; + +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 [step, setStep] = useState(0); + const [isModalOpen, setIsModalOpen] = useState(false); + + useEffect(() => { + if (editQuizId === null) navigate("/list"); + }, [navigate, editQuizId]); + + const heightBar = heightSidebar + 51 + 88 + 36 + 25; + + const partnersMock = [ + { category: "CRM", name: "amoCRM", logo: amoCrmLogo }, + { category: "CRM", name: "bitrix" }, + { category: "CRM", name: "RetailCRM." }, + { category: "CRM", name: "SugarCRM." }, + { category: "SocialMedia", name: "Telegram" }, + { category: "SocialMedia", name: "VKontakte" }, + { category: "SocialMedia", name: "X.com" }, + { category: "Сервисы рассылок", name: "Mailchimp" }, + { category: "Сервисы рассылок", name: "GetResponse" }, + { category: "Сервисы рассылок", name: "SendPulse" }, + ]; + if (quiz === undefined) + return ( + + ); + return ( + <> + + + Интеграции + + + + + + ); +}; diff --git a/src/pages/IntegrationsPage/PartnersBoard/PartnerItem/PartnerItem.tsx b/src/pages/IntegrationsPage/PartnersBoard/PartnerItem/PartnerItem.tsx new file mode 100644 index 00000000..495d9924 --- /dev/null +++ b/src/pages/IntegrationsPage/PartnersBoard/PartnerItem/PartnerItem.tsx @@ -0,0 +1,47 @@ +import { Box, Typography, useTheme } from "@mui/material"; +import { FC } from "react"; +import { Partner } from "../PartnersBoard"; + +type PartnerItemProps = { + partner: Partner; + setIsModalOpen: (value: boolean) => void; +}; + +export const PartnerItem: FC = ({ + partner, + setIsModalOpen, +}) => { + const theme = useTheme(); + + const handleClick = () => { + setIsModalOpen(true); + }; + + return ( + <> + {partner && ( + + {partner.logo ? ( + {partner.name} + ) : ( + {partner.name} + )} + + )} + + ); +}; diff --git a/src/pages/IntegrationsPage/PartnersBoard/PartnersBoard.tsx b/src/pages/IntegrationsPage/PartnersBoard/PartnersBoard.tsx new file mode 100644 index 00000000..b0df1552 --- /dev/null +++ b/src/pages/IntegrationsPage/PartnersBoard/PartnersBoard.tsx @@ -0,0 +1,70 @@ +import { Box, Typography, useTheme } from "@mui/material"; +import { FC } from "react"; +import { PartnerItem } from "./PartnerItem/PartnerItem"; + +export type Partner = { + name: string; + logo?: string; + category: string; +}; + +type PartnersBoardProps = { + partners: Partner[]; + setIsModalOpen: (value: boolean) => void; +}; + +export const PartnersBoard: FC = ({ + partners, + setIsModalOpen, +}) => { + const theme = useTheme(); + + const partnersByCategory = partners.reduce( + (acc, partner) => { + (acc[partner.category] = acc[partner.category] || []).push(partner); + return acc; + }, + {} as Record, + ); + + return ( + + {Object.entries(partnersByCategory).map(([category, partners]) => ( + + + {category} + + + {partners.map((partner) => ( + + ))} + + + ))} + + ); +}; diff --git a/src/pages/IntegrationsPage/mocks/amoCrmLogo.png b/src/pages/IntegrationsPage/mocks/amoCrmLogo.png new file mode 100644 index 00000000..07d03d78 Binary files /dev/null and b/src/pages/IntegrationsPage/mocks/amoCrmLogo.png differ diff --git a/src/ui_kit/Sidebar/Sidebar.tsx b/src/ui_kit/Sidebar/Sidebar.tsx index 6f179b66..eee51b68 100755 --- a/src/ui_kit/Sidebar/Sidebar.tsx +++ b/src/ui_kit/Sidebar/Sidebar.tsx @@ -178,6 +178,35 @@ export default function Sidebar({ changePage, disableCollapse }: SidebarProps) { /> } /> + { + navigate("/integrations"); + setCurrentStep(16); + }} + text={"Интеграции"} + isCollapsed={isMenuCollapsed} + isActive={pathname.startsWith("/integrations")} + disabled={ + pathname.startsWith("/integrations") + ? false + : quiz === undefined + ? true + : quiz?.config.type === null + } + icon={ + + } + /> {/* {quizSettingsMenuItems.map((menuItem, index) => { const Icon = menuItem[0];