plane/apps/app/components/integration/github/auth.tsx
2023-04-18 10:54:45 +05:30

28 lines
794 B
TypeScript

// hooks
import useIntegrationPopup from "hooks/use-integration-popup";
// ui
import { PrimaryButton } from "components/ui";
// types
import { IWorkspaceIntegration } from "types";
type Props = {
workspaceIntegration: false | IWorkspaceIntegration | undefined;
provider: string | undefined;
};
export const GithubAuth: React.FC<Props> = ({ workspaceIntegration, provider }) => {
const { startAuth, isConnecting } = useIntegrationPopup(provider);
return (
<div>
{workspaceIntegration && workspaceIntegration?.id ? (
<PrimaryButton disabled>Successfully Connected</PrimaryButton>
) : (
<PrimaryButton onClick={startAuth} loading={isConnecting}>
{isConnecting ? "Connecting..." : "Connect"}
</PrimaryButton>
)}
</div>
);
};