2023-02-22 14:10:57 +00:00
|
|
|
import React from "react";
|
|
|
|
|
|
|
|
import { useRouter } from "next/router";
|
2023-02-23 12:42:07 +00:00
|
|
|
|
2023-02-22 14:10:57 +00:00
|
|
|
import useSWR from "swr";
|
|
|
|
|
|
|
|
// services
|
|
|
|
import workspaceService from "services/workspace.service";
|
2023-04-05 19:21:15 +00:00
|
|
|
import IntegrationService from "services/integration";
|
2023-02-22 14:10:57 +00:00
|
|
|
// layouts
|
2023-04-08 08:16:46 +00:00
|
|
|
import { WorkspaceAuthorizationLayout } from "layouts/auth-layout";
|
2023-05-05 11:37:29 +00:00
|
|
|
import { SettingsHeader } from "components/workspace";
|
2023-04-08 08:16:46 +00:00
|
|
|
// components
|
2023-04-18 05:24:45 +00:00
|
|
|
import { SingleIntegrationCard } from "components/integration";
|
2023-02-22 14:10:57 +00:00
|
|
|
// ui
|
2023-05-18 13:37:01 +00:00
|
|
|
import { IntegrationAndImportExportBanner, Loader } from "components/ui";
|
2023-02-22 14:10:57 +00:00
|
|
|
import { BreadcrumbItem, Breadcrumbs } from "components/breadcrumbs";
|
2023-02-23 12:42:07 +00:00
|
|
|
// types
|
2023-04-08 08:16:46 +00:00
|
|
|
import type { NextPage } from "next";
|
2023-02-23 12:42:07 +00:00
|
|
|
// fetch-keys
|
2023-02-22 14:10:57 +00:00
|
|
|
import { WORKSPACE_DETAILS, APP_INTEGRATIONS } from "constants/fetch-keys";
|
|
|
|
|
2023-04-08 08:16:46 +00:00
|
|
|
const WorkspaceIntegrations: NextPage = () => {
|
2023-02-23 12:42:07 +00:00
|
|
|
const router = useRouter();
|
|
|
|
const { workspaceSlug } = router.query;
|
2023-02-22 14:10:57 +00:00
|
|
|
|
|
|
|
const { data: activeWorkspace } = useSWR(
|
|
|
|
workspaceSlug ? WORKSPACE_DETAILS(workspaceSlug as string) : null,
|
|
|
|
() => (workspaceSlug ? workspaceService.getWorkspace(workspaceSlug as string) : null)
|
|
|
|
);
|
|
|
|
|
2023-04-05 19:21:15 +00:00
|
|
|
const { data: appIntegrations } = useSWR(workspaceSlug ? APP_INTEGRATIONS : null, () =>
|
|
|
|
workspaceSlug ? IntegrationService.getAppIntegrationsList() : null
|
2023-02-22 14:10:57 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
return (
|
2023-04-08 08:16:46 +00:00
|
|
|
<WorkspaceAuthorizationLayout
|
|
|
|
breadcrumbs={
|
|
|
|
<Breadcrumbs>
|
|
|
|
<BreadcrumbItem
|
|
|
|
title={`${activeWorkspace?.name ?? "Workspace"}`}
|
|
|
|
link={`/${workspaceSlug}`}
|
|
|
|
/>
|
|
|
|
<BreadcrumbItem title="Integrations" />
|
|
|
|
</Breadcrumbs>
|
|
|
|
}
|
|
|
|
>
|
2023-05-17 09:27:58 +00:00
|
|
|
<div className="p-8">
|
2023-05-05 11:37:29 +00:00
|
|
|
<SettingsHeader />
|
2023-05-17 09:27:58 +00:00
|
|
|
<section className="space-y-5">
|
2023-05-18 13:37:01 +00:00
|
|
|
<IntegrationAndImportExportBanner bannerName="Integrations" />
|
2023-05-05 11:37:29 +00:00
|
|
|
<div className="space-y-5">
|
|
|
|
{appIntegrations ? (
|
|
|
|
appIntegrations.map((integration) => (
|
|
|
|
<SingleIntegrationCard key={integration.id} integration={integration} />
|
|
|
|
))
|
|
|
|
) : (
|
|
|
|
<Loader className="space-y-5">
|
|
|
|
<Loader.Item height="60px" />
|
|
|
|
<Loader.Item height="60px" />
|
|
|
|
</Loader>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</div>
|
2023-04-08 08:16:46 +00:00
|
|
|
</WorkspaceAuthorizationLayout>
|
2023-02-22 14:10:57 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default WorkspaceIntegrations;
|