import clsx from 'clsx' import { useParams } from 'common' import Link from 'next/link' import { Badge, Button, FormControl_Shadcn_, FormField_Shadcn_, FormItem_Shadcn_, FormMessage_Shadcn_, IconCheck, IconLoader, Input_Shadcn_, Modal, } from 'ui' import { EmptyIntegrationConnection, IntegrationConnection, } from 'components/interfaces/Integrations/IntegrationPanels' import { Integration } from 'data/integrations/integrations.types' import { useSelectedOrganization } from 'hooks' import { useSidePanelsStateSnapshot } from 'state/side-panels' interface GithubRepositorySelectionProps { form: any isChecking: boolean isValid: boolean integration?: Integration hasGithubIntegrationInstalled: boolean } const GithubRepositorySelection = ({ form, isChecking, isValid, integration, hasGithubIntegrationInstalled, }: GithubRepositorySelectionProps) => { const { ref } = useParams() const org = useSelectedOrganization() const githubConnection = integration?.connections.find( (connection) => connection.supabase_project_ref === ref ) const sidePanels = useSidePanelsStateSnapshot() const githubIntegrationAppUrl = process.env.NEXT_PUBLIC_ENVIRONMENT === 'prod' ? `https://github.com/apps/supabase/installations/new?state=${ref}` : process.env.NEXT_PUBLIC_ENVIRONMENT === 'staging' ? `https://github.com/apps/supabase-staging/installations/new?state=${ref}` : `https://github.com/apps/supabase-local-testing/installations/new?state=${ref}` function onSelectConnectRepo() { if (integration) { sidePanels.setGithubConnectionsOpen(true) sidePanels.setGithubConnectionsIntegrationId(integration.id) } } return (

Git Connection

Required

{githubConnection !== undefined ? 'Your database preview branches will be based on the branches in the following repository that your project is connected with:' : 'Your database preview branches will be based on the branches in the Git repository that your project is connected with.'}

{!hasGithubIntegrationInstalled && ( )} {hasGithubIntegrationInstalled && !githubConnection && ( onSelectConnectRepo()} orgSlug={org?.slug} /> )} {integration && githubConnection && ( <>
    onSelectConnectRepo()}> Configure connection } orientation="vertical" />
(
{isChecking ? ( ) : isValid ? ( ) : null}
)} /> )}
) } export default GithubRepositorySelection