import React from "react"; import { useRouter } from "next/router"; import useSWR from "swr"; // layouts import { ProjectAuthorizationWrapper } from "layouts/auth-layout-legacy"; // services import { IntegrationService } from "services/integrations"; import { ProjectService } from "services/project"; // components import { SettingsSidebar, SingleIntegration } from "components/project"; // ui import { EmptyState } from "components/common"; import { BreadcrumbItem, Breadcrumbs } from "components/breadcrumbs"; import { Loader } from "@plane/ui"; // images import emptyIntegration from "public/empty-state/integration.svg"; // types import { IProject } from "types"; import type { NextPage } from "next"; // fetch-keys import { PROJECT_DETAILS, USER_PROJECT_VIEW, WORKSPACE_INTEGRATIONS } from "constants/fetch-keys"; // helper import { truncateText } from "helpers/string.helper"; // services const integrationService = new IntegrationService(); const projectService = new ProjectService(); const ProjectIntegrations: NextPage = () => { 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 { data: memberDetails } = useSWR( workspaceSlug && projectId ? USER_PROJECT_VIEW(projectId.toString()) : null, workspaceSlug && projectId ? () => projectService.projectMemberMe(workspaceSlug.toString(), projectId.toString()) : null ); const isAdmin = memberDetails?.role === 20; return ( } >

Integrations

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