import { ReactElement } from "react"; import { useRouter } from "next/router"; import useSWR from "swr"; // layouts import { AppLayout } from "layouts/app-layout"; import { ProjectSettingLayout } from "layouts/settings-layout"; // services import { IntegrationService } from "services/integrations"; import { ProjectService } from "services/project"; // components import { IntegrationCard } from "components/project"; import { ProjectSettingHeader } from "components/headers"; // ui import { EmptyState } from "components/common"; import { Loader } from "@plane/ui"; // images import emptyIntegration from "public/empty-state/integration.svg"; // types import { IProject } from "@plane/types"; import { NextPageWithLayout } from "lib/types"; // fetch-keys import { PROJECT_DETAILS, WORKSPACE_INTEGRATIONS } from "constants/fetch-keys"; // services const integrationService = new IntegrationService(); const projectService = new ProjectService(); const ProjectIntegrationsPage: NextPageWithLayout = () => { const router = useRouter(); const { workspaceSlug, projectId } = router.query; const { data: projectDetails } = useSWR( workspaceSlug && projectId ? PROJECT_DETAILS(projectId as string) : null, workspaceSlug && projectId ? () => projectService.getProject(workspaceSlug as string, projectId as string) : null ); const { data: workspaceIntegrations } = useSWR( workspaceSlug ? WORKSPACE_INTEGRATIONS(workspaceSlug as string) : null, () => (workspaceSlug ? integrationService.getWorkspaceIntegrationsList(workspaceSlug as string) : null) ); const isAdmin = projectDetails?.member_role === 20; return (

Integrations

{workspaceIntegrations ? ( workspaceIntegrations.length > 0 ? (
{workspaceIntegrations.map((integration) => ( ))}
) : ( router.push(`/${workspaceSlug}/settings/integrations`), }} disabled={!isAdmin} /> ) ) : ( )}
); }; ProjectIntegrationsPage.getLayout = function getLayout(page: ReactElement) { return ( }> {page} ); }; export default ProjectIntegrationsPage;