import React from 'react'; import OauthPopup from 'react-oauth-popup'; import { useGQLClient } from '../../../context/GQLClientContext'; import { Button } from '../../shared/Button'; import { GitIcon, EllipsesIcon, SnowballIcon, GithubIcon, GitTeaIcon, } from '../../shared/CustomIcon'; import { useToast } from '../../shared/Toast'; import { IconWithFrame } from '../../shared/IconWithFrame'; import { Heading } from '../../shared/Heading'; import { MockConnectGitCard } from './MockConnectGitCard'; import { VITE_GITHUB_CLIENT_ID } from 'utils/constants'; const SCOPES = 'repo user'; const GITHUB_OAUTH_URL = `https://github.com/login/oauth/authorize?client_id=${VITE_GITHUB_CLIENT_ID}&scope=${encodeURIComponent(SCOPES)}`; interface ConnectAccountInterface { onAuth: (token: string) => void; } const ConnectAccount: React.FC = ({ onAuth: onToken, }: ConnectAccountInterface) => { const client = useGQLClient(); const { toast, dismiss } = useToast(); const handleCode = async (code: string) => { // Pass code to backend and get access token const { authenticateGitHub: { token }, } = await client.authenticateGitHub(code); onToken(token); toast({ onDismiss: dismiss, id: 'connected-to-github', title: 'The Git account is connected.', variant: 'success', }); }; // TODO: Use correct height return (
{/** Icons */}
} /> } />
{/** Text */}
Connect to your Git account

Once connected, you can import a repository from your account or start with one of our templates.

{/** CTA Buttons */}
{}} title="Snowball" width={1000} height={1000} >
{/* TODO: Add ConnectAccountTabPanel */} {/*
*/}
); }; export default ConnectAccount;