fix: add props

This commit is contained in:
nafees nazik
2023-09-30 17:12:52 +05:30
parent 59c861c695
commit 9546916aad
2 changed files with 12 additions and 9 deletions
@@ -202,6 +202,8 @@ export const IntegrationsPage = withProjectPermission(
integrations={integrations} integrations={integrations}
environments={environments} environments={environments}
onIntegrationDelete={({ _id: id }, cb) => handleIntegrationDelete(id, cb)} onIntegrationDelete={({ _id: id }, cb) => handleIntegrationDelete(id, cb)}
isBotActive={bot?.isActive}
workspaceId={workspaceId}
/> />
<CloudIntegrationSection <CloudIntegrationSection
isLoading={isCloudIntegrationsLoading || isIntegrationAuthLoading} isLoading={isCloudIntegrationsLoading || isIntegrationAuthLoading}
@@ -17,9 +17,8 @@ import {
Skeleton, Skeleton,
Tooltip Tooltip
} from "@app/components/v2"; } from "@app/components/v2";
import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context"; import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context";
import { usePopUp } from "@app/hooks"; import { usePopUp } from "@app/hooks";
import { useGetWorkspaceBot } from "@app/hooks/api";
import { TIntegration } from "@app/hooks/api/types"; import { TIntegration } from "@app/hooks/api/types";
type Props = { type Props = {
@@ -27,20 +26,22 @@ type Props = {
integrations?: TIntegration[]; integrations?: TIntegration[];
isLoading?: boolean; isLoading?: boolean;
onIntegrationDelete: (integration: TIntegration, cb: () => void) => void; onIntegrationDelete: (integration: TIntegration, cb: () => void) => void;
isBotActive: boolean | undefined;
workspaceId: string;
}; };
export const IntegrationsSection = ({ export const IntegrationsSection = ({
integrations = [], integrations = [],
environments = [], environments = [],
isLoading, isLoading,
onIntegrationDelete onIntegrationDelete,
isBotActive,
workspaceId
}: Props) => { }: Props) => {
const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([ const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
"deleteConfirmation" "deleteConfirmation"
] as const); ] as const);
const { currentWorkspace } = useWorkspace();
const { data: bot } = useGetWorkspaceBot(currentWorkspace?._id ?? "");
return ( return (
<div className="mb-8"> <div className="mb-8">
<div className="mx-4 mb-4 mt-6 flex flex-col items-start justify-between px-2 text-xl"> <div className="mx-4 mb-4 mt-6 flex flex-col items-start justify-between px-2 text-xl">
@@ -53,12 +54,12 @@ export const IntegrationsSection = ({
</div> </div>
)} )}
{!bot?.isActive && ( {!isBotActive && (
<div className="px-6 py-4"> <div className="px-6 py-4">
<Alert hideTitle variant="warning"> <Alert hideTitle variant="warning">
<AlertDescription> <AlertDescription>
All the active integrations will be disabled. Disable End-to-End Encryption in{" "} All the active integrations will be disabled. Disable End-to-End Encryption in{" "}
<Link href={`/project/${currentWorkspace?._id}/settings`} passHref> <Link href={`/project/${workspaceId}/settings`} passHref>
<a className="underline underline-offset-2">project settings </a> <a className="underline underline-offset-2">project settings </a>
</Link> </Link>
to re-enable it . to re-enable it .
@@ -67,7 +68,7 @@ export const IntegrationsSection = ({
</div> </div>
)} )}
{!isLoading && !integrations.length && bot?.isActive && ( {!isLoading && !integrations.length && isBotActive && (
<div className="mx-6"> <div className="mx-6">
<EmptyState <EmptyState
className="rounded-md border border-mineshaft-700 pt-8 pb-4" className="rounded-md border border-mineshaft-700 pt-8 pb-4"
@@ -75,7 +76,7 @@ export const IntegrationsSection = ({
/> />
</div> </div>
)} )}
{!isLoading && bot?.isActive && ( {!isLoading && isBotActive && (
<div className="flex flex-col space-y-4 p-6 pt-0"> <div className="flex flex-col space-y-4 p-6 pt-0">
{integrations?.map((integration) => ( {integrations?.map((integration) => (
<div <div