Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

initial github integration changes

Alaister Young6e5a3db24b62
diff --git a/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx b/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx
index b80cd93b40a..b19821e45d0 100644
--- a/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx
+++ b/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx
@@ -13,7 +13,7 @@ const IntegrationSettings = () => {
const vercelIntegrations = data
?.filter((integration) => integration.integration.name === 'Vercel')
.map((integration) => {
- if (integration.metadata) {
+ if (integration.metadata && integration.integration.name === 'Vercel') {
const avatarSrc =
!integration.metadata.account.avatar && integration.metadata.account.type === 'Team'
? `https://vercel.com/api/www/avatar?teamId=${integration.metadata.account.team_id}&s=48`
diff --git a/studio/components/layouts/IntegrationsLayout/GitHubIntegrationWindowLayout.tsx b/studio/components/layouts/IntegrationsLayout/GitHubIntegrationWindowLayout.tsx
new file mode 100644
index 00000000000..f2de6a343e0
--- /dev/null
+++ b/studio/components/layouts/IntegrationsLayout/GitHubIntegrationWindowLayout.tsx
@@ -0,0 +1,25 @@
+import { PropsWithChildren } from 'react'
+import IntegrationWindowLayout from './IntegrationWindowLayout'
+
+const GITHUB_ICON = (
+ <div className="bg-black shadow rounded p-1 w-8 h-8 flex justify-center items-center">
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 98 96" className="w-[18px]">
+ <path
+ fill="#ffffff"
+ fillRule="evenodd"
+ d="M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z"
+ clipRule="evenodd"
+ />
+ </svg>
+ </div>
+)
+
+const GitHubIntegrationWindowLayout = ({ children }: PropsWithChildren<{}>) => {
+ return (
+ <IntegrationWindowLayout title="Supabase + GitHub Integration" integrationIcon={GITHUB_ICON}>
+ {children}
+ </IntegrationWindowLayout>
+ )
+}
+
+export default GitHubIntegrationWindowLayout
diff --git a/studio/components/layouts/IntegrationWindowLayout.tsx b/studio/components/layouts/IntegrationsLayout/IntegrationWindowLayout.tsx
similarity index 54%
rename from studio/components/layouts/IntegrationWindowLayout.tsx
rename to studio/components/layouts/IntegrationsLayout/IntegrationWindowLayout.tsx
index 123e42f205c..e04d8df5d83 100644
--- a/studio/components/layouts/IntegrationWindowLayout.tsx
+++ b/studio/components/layouts/IntegrationsLayout/IntegrationWindowLayout.tsx
@@ -1,20 +1,27 @@
-import { FC } from 'react'
-import Link from 'next/link'
-import { IconChevronRight, IconX, cn } from 'ui'
-import { withAuth, useFlag } from 'hooks'
-import { observer } from 'mobx-react-lite'
-import { BASE_PATH } from 'lib/constants'
-import React from 'react'
-import { ScaffoldContainer } from './Scaffold'
import { useParams } from 'common'
+import { useFlag, withAuth } from 'hooks'
+import { BASE_PATH } from 'lib/constants'
+import { PropsWithChildren, ReactNode, forwardRef } from 'react'
+import { IconX, cn } from 'ui'
+import { ScaffoldContainer } from '../Scaffold'
+
+export type IntegrationWindowLayoutProps = {
+ title: string
+ integrationIcon: ReactNode
+}
-const IntegrationWindowLayout: FC<any> = ({ organization, project, children }) => {
+const IntegrationWindowLayout = ({
+ title,
+ integrationIcon,
+ children,
+}: PropsWithChildren<IntegrationWindowLayoutProps>) => {
const ongoingIncident = useFlag('ongoingIncident')
const maxHeight = ongoingIncident ? 'calc(100vh - 44px)' : '100vh'
return (
<div className="flex w-full flex-col" style={{ height: maxHeight, maxHeight }}>
- <Header organization={organization} project={project} />
+ <Header title={title} integrationIcon={integrationIcon} />
+
{children}
</div>
)
@@ -22,18 +29,16 @@ const IntegrationWindowLayout: FC<any> = ({ organization, project, children }) =
const INTEGRATION_LAYOUT_MAX_WIDTH = '' // 'max-w-[720px]'
-export default withAuth(observer(IntegrationWindowLayout))
-
-export const IntegrationWindowLayoutWithoutAuth = observer(IntegrationWindowLayout)
+export default withAuth(IntegrationWindowLayout)
-const Header: FC<any> = ({ organization, project }) => {
- let stepNumber = organization ? 1 : project ? 2 : 0
- const { externalId } = useParams()
+export const IntegrationWindowLayoutWithoutAuth = IntegrationWindowLayout
- const title = externalId
- ? 'Supabase + Vercel Deploy Button'
- : 'Supabase + Vercel Integration Marketplace Connector'
+export type HeaderProps = {
+ title: string
+ integrationIcon: ReactNode
+}
+const Header = ({ title, integrationIcon }: HeaderProps) => {
return (
<div className="bg">
<ScaffoldContainer className={cn('py-3 border-b', INTEGRATION_LAYOUT_MAX_WIDTH)}>
@@ -43,16 +48,7 @@ const Header: FC<any> = ({ organization, project }) => {
<img src={`${BASE_PATH}/img/supabase-logo.svg`} alt="Supabase" className="w-4" />
</div>
<IconX className="text-scale-800" strokeWidth={2} size={16} />
- <div className="bg-black shadow rounded p-1 w-8 h-8 flex justify-center items-center">
- <svg
- xmlns="http://www.w3.org/2000/svg"
- fill="white"
- viewBox="0 0 512 512"
- className="w-4"
- >
- <path fill-rule="evenodd" d="M256,48,496,464H16Z" />
- </svg>
- </div>
+ {integrationIcon}
</div>
<span className="text-sm" title={title}>
{title}
@@ -66,7 +62,7 @@ const Header: FC<any> = ({ organization, project }) => {
const maxWidthClasses = 'mx-auto w-full max-w-[1600px]'
const paddingClasses = 'px-6 lg:px-14 xl:px-28 2xl:px-32'
-const IntegrationScaffoldContainer = React.forwardRef<
+const IntegrationScaffoldContainer = forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => {
diff --git a/studio/components/layouts/IntegrationsLayout/VercelIntegrationWindowLayout.tsx b/studio/components/layouts/IntegrationsLayout/VercelIntegrationWindowLayout.tsx
new file mode 100644
index 00000000000..bcc7ef55adb
--- /dev/null
+++ b/studio/components/layouts/IntegrationsLayout/VercelIntegrationWindowLayout.tsx
@@ -0,0 +1,27 @@
+import { useParams } from 'common'
+import { PropsWithChildren } from 'react'
+import IntegrationWindowLayout from './IntegrationWindowLayout'
+
+const VERCEL_ICON = (
+ <div className="bg-black shadow rounded p-1 w-8 h-8 flex justify-center items-center">
+ <svg xmlns="http://www.w3.org/2000/svg" fill="white" viewBox="0 0 512 512" className="w-4">
+ <path fill-rule="evenodd" d="M256,48,496,464H16Z" />
+ </svg>
+ </div>
+)
+
+const VercelIntegrationWindowLayout = ({ children }: PropsWithChildren<{}>) => {
+ const { externalId } = useParams()
+
+ const title = externalId
+ ? 'Supabase + Vercel Deploy Button'
+ : 'Supabase + Vercel Integration Marketplace Connector'
+
+ return (
+ <IntegrationWindowLayout title={title} integrationIcon={VERCEL_ICON}>
+ {children}
+ </IntegrationWindowLayout>
+ )
+}
+
+export default VercelIntegrationWindowLayout
diff --git a/studio/data/integrations/github-integration-create-mutation.ts b/studio/data/integrations/github-integration-create-mutation.ts
new file mode 100644
index 00000000000..73ce49b48b4
--- /dev/null
+++ b/studio/data/integrations/github-integration-create-mutation.ts
@@ -0,0 +1,56 @@
+import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query'
+import { post } from 'lib/common/fetch'
+import { API_URL } from 'lib/constants'
+import { integrationKeys } from './keys'
+
+export type GitHubIntegrationCreateVariables = {
+ code: string
+ installationId: string
+ orgSlug: string
+ metadata: { [key: string]: string }
+}
+
+export async function createGitHubIntegration({
+ code,
+ installationId,
+ orgSlug,
+ metadata,
+}: GitHubIntegrationCreateVariables) {
+ const response = await post(`${API_URL}/integrations/github`, {
+ code,
+ installation_id: installationId,
+ organization_slug: orgSlug,
+ metadata,
+ })
+ if (response.error) {
+ throw response.error
+ }
+
+ return response
+}
+
+type GitHubIntegrationCreateData = Awaited<ReturnType<typeof createGitHubIntegration>>
+
+export const useGitHubIntegrationCreateMutation = ({
+ onSuccess,
+ ...options
+}: Omit<
+ UseMutationOptions<GitHubIntegrationCreateData, unknown, GitHubIntegrationCreateVariables>,
+ 'mutationFn'
+> = {}) => {
+ const queryClient = useQueryClient()
+ return useMutation<GitHubIntegrationCreateData, unknown, GitHubIntegrationCreateVariables>(
+ (vars) => createGitHubIntegration(vars),
+ {
+ async onSuccess(data, variables, context) {
+ await Promise.all([
+ queryClient.invalidateQueries(integrationKeys.integrationsList()),
+ queryClient.invalidateQueries(integrationKeys.integrationsListWithOrg(variables.orgSlug)),
+ // queryClient.invalidateQueries(integrationKeys.githubProjectList(data.id)),
+ ])
+ await onSuccess?.(data, variables, context)
+ },
+ ...options,
+ }
+ )
+}
diff --git a/studio/data/integrations/vercel-integration-create-mutation.ts b/studio/data/integrations/vercel-integration-create-mutation.ts
index ae99a6e5785..53f1666e05d 100644
--- a/studio/data/integrations/vercel-integration-create-mutation.ts
+++ b/studio/data/integrations/vercel-integration-create-mutation.ts
@@ -47,7 +47,6 @@ export const useVercelIntegrationCreateMutation = ({
'mutationFn'
> = {}) => {
const queryClient = useQueryClient()
- console.log('mutating')
return useMutation<VercelIntegrationCreateData, unknown, VercelIntegrationCreateVariables>(
(vars) => createVercelIntegration(vars),
{
diff --git a/studio/pages/integrations/github/[slug]/choose-project.tsx b/studio/pages/integrations/github/[slug]/choose-project.tsx
new file mode 100644
index 00000000000..056571b9458
--- /dev/null
+++ b/studio/pages/integrations/github/[slug]/choose-project.tsx
@@ -0,0 +1,12 @@
+import GitHubIntegrationWindowLayout from 'components/layouts/IntegrationsLayout/GitHubIntegrationWindowLayout'
+import { NextPageWithLayout } from 'types'
+
+const ChooseProjectGitHubPage: NextPageWithLayout = () => {
+ return <div></div>
+}
+
+ChooseProjectGitHubPage.getLayout = (page) => (
+ <GitHubIntegrationWindowLayout>{page}</GitHubIntegrationWindowLayout>
+)
+
+export default ChooseProjectGitHubPage
diff --git a/studio/pages/integrations/github/install.tsx b/studio/pages/integrations/github/install.tsx
new file mode 100644
index 00000000000..c0da8558089
--- /dev/null
+++ b/studio/pages/integrations/github/install.tsx
@@ -0,0 +1,290 @@
+import { useParams } from 'common'
+import { Markdown } from 'components/interfaces/Markdown'
+import GitHubIntegrationWindowLayout from 'components/layouts/IntegrationsLayout/GitHubIntegrationWindowLayout'
+import IntegrationWindowLayout from 'components/layouts/IntegrationsLayout/IntegrationWindowLayout'
+import { ScaffoldContainer, ScaffoldDivider } from 'components/layouts/Scaffold'
+import { useGitHubIntegrationCreateMutation } from 'data/integrations/github-integration-create-mutation'
+import { useIntegrationsQuery } from 'data/integrations/integrations-query'
+import { IntegrationName } from 'data/integrations/integrations.types'
+import { useOrganizationsQuery } from 'data/organizations/organizations-query'
+import { useStore } from 'hooks'
+import { useRouter } from 'next/router'
+import { useState } from 'react'
+import { useGitHubIntegrationInstallationState } from 'state/github-integration-installation'
+import { NextPageWithLayout, Organization } from 'types'
+import { Alert, Badge, Button, IconBook, IconHexagon, IconLifeBuoy, Listbox, LoadingLine } from 'ui'
+
+/**
+ * Organization type with `installationInstalled` added
+ */
+interface OrganizationsResponseWithInstalledData extends Organization {
+ installationInstalled?: boolean
+}
+
+/**
+ * Variations of the GitHub integration flow.
+ * They require different UI and logic.
+ *
+ * Deploy Button - the flow that starts from the Deploy Button - https://github.com/docs/integrations#deploy-button
+ * Marketplace - the flow that starts from the Marketplace - https://github.com/integrations
+ *
+ */
+export type GitHubIntegrationFlow = 'deploy-button' | 'marketing'
+
+const GitHubIntegration: NextPageWithLayout = () => {
+ const router = useRouter()
+ const { ui } = useStore()
+ const { code, installation_id: installationId } = useParams()
+ const [selectedOrg, setSelectedOrg] = useState<Organization | null>(null)
+ const [organizationIntegrationId, setOrganizationIntegrationId] = useState<string | null>(null)
+
+ const snapshot = useGitHubIntegrationInstallationState()
+
+ /**
+ * Fetch the list of organization based integration installations for GitHub.
+ *
+ * Array of integrations installed on all
+ */
+ const { data: integrationData, isLoading: integrationDataLoading } = useIntegrationsQuery()
+
+ const { data: organizationsData, isLoading: isLoadingOrganizationsQuery } = useOrganizationsQuery(
+ {
+ onSuccess(organizations) {
+ const firstOrg = organizations?.[0]
+ if (firstOrg && selectedOrg === null) {
+ setSelectedOrg(firstOrg)
+ snapshot.setSelectedOrganizationSlug(firstOrg.slug)
+ router.query.organizationSlug = firstOrg.slug
+ }
+ },
+ }
+ )
+
+ /**
+ * Flat array of org slugs that have integration installed
+ *
+ */
+ const flatInstalledConnectionsIds: string[] | [] =
+ integrationData && integrationData.length > 0
+ ? integrationData?.map((x) => x.organization.slug)
+ : []
+
+ /**
+ * Organizations with extra `installationInstalled` attribute
+ *
+ * Used to show label/badge and allow/disallow installing
+ *
+ */
+ const organizationsWithInstalledData: OrganizationsResponseWithInstalledData[] = organizationsData
+ ? organizationsData.map((org) => {
+ return {
+ ...org,
+ installationInstalled: flatInstalledConnectionsIds.includes(org.slug) ? true : false,
+ }
+ })
+ : []
+
+ /**
+ * Handle the correct route change based on wether the github integration
+ * is following the 'marketplace' flow or 'deploy button' flow.
+ *
+ */
+ function handleRouteChange() {
+ const orgSlug = selectedOrg?.slug
+
+ router.push({
+ pathname: `/integrations/github/${orgSlug}/choose-project`,
+ query: router.query,
+ })
+ }
+
+ const { mutate, isLoading: isLoadingGitHubIntegrationCreateMutation } =
+ useGitHubIntegrationCreateMutation({
+ onSuccess({ id }) {
+ const orgSlug = selectedOrg?.slug
+
+ setOrganizationIntegrationId(id)
+
+ handleRouteChange()
+ },
+ onError(error: any) {
+ ui.setNotification({
+ category: 'error',
+ message: `Creating GitHub integration failed: ${error.message}`,
+ })
+ },
+ })
+
+ function onInstall() {
+ const orgSlug = selectedOrg?.slug
+
+ const isIntegrationInstalled = organizationsWithInstalledData.some(
+ (x) => x.slug === orgSlug && x.installationInstalled
+ )
+
+ if (!orgSlug) {
+ return ui.setNotification({ category: 'error', message: 'Please select an organization' })
+ }
+
+ if (!code) {
+ return ui.setNotification({ category: 'error', message: 'GitHub code missing' })
+ }
+
+ if (!installationId) {
+ return ui.setNotification({ category: 'error', message: 'GitHub Installation ID is missing' })
+ }
+
+ /**
+ * Only install if instgration hasn't already been installed
+ */
+ if (!isIntegrationInstalled) {
+ mutate({
+ code,
+ installationId,
+ orgSlug,
+ metadata: {},
+ })
+ } else {
+ handleRouteChange()
+ }
+ }
+
+ const dataLoading = isLoadingGitHubIntegrationCreateMutation || isLoadingOrganizationsQuery
+
+ return (
+ <>
+ <main className="overflow-auto flex flex-col h-full">
+ <LoadingLine loading={isLoadingGitHubIntegrationCreateMutation} />
+ {organizationIntegrationId === null && (
+ <>
+ <ScaffoldContainer className="max-w-md flex flex-col gap-6 grow py-8">
+ <h1 className="text-xl text-scale-1200">Choose organization</h1>
+ <>
+ <Markdown content={`Choose the Supabase organization you wish to install in`} />
+ <OrganizationPicker
+ integrationName="GitHub"
+ organizationsWithInstalledData={organizationsWithInstalledData}
+ onSelectedOrgChange={(e) => {
+ router.query.organizationSlug = e.slug
+ setSelectedOrg(e)
+ }}
+ dataLoading={dataLoading}
+ />
+ <div className="flex flex-row w-full justify-end">
+ <Button
+ size="medium"
+ className="self-end"
+ disabled={isLoadingGitHubIntegrationCreateMutation}
+ loading={isLoadingGitHubIntegrationCreateMutation}
+ onClick={onInstall}
+ >
+ Install integration
+ </Button>
+ </div>
+ </>
+ </ScaffoldContainer>
+ <ScaffoldContainer className="flex flex-col gap-6 py-3">
+ <Alert
+ withIcon
+ variant="info"
+ title="You can uninstall this Integration at any time."
+ >
+ <Markdown
+ content={`Remove this integration at any time via GitHub or the Supabase dashboard.`}
+ />
+ </Alert>
+ </ScaffoldContainer>
+ </>
+ )}
+
+ <ScaffoldDivider />
+ </main>
+ <ScaffoldContainer className="bg-body flex flex-row gap-6 py-6 border-t">
+ <div className="flex items-center gap-2 text-xs text-scale-900">
+ <IconBook size={16} /> Docs
+ </div>
+ <div className="flex items-center gap-2 text-xs text-scale-900">
+ <IconLifeBuoy size={16} /> Support
+ </div>
+ </ScaffoldContainer>
+ </>
+ )
+}
+
+GitHubIntegration.getLayout = (page) => (
+ <GitHubIntegrationWindowLayout>{page}</GitHubIntegrationWindowLayout>
+)
+
+export interface OrganizationPickerProps {
+ label?: string
+ onSelectedOrgChange?: (org: Organization) => void
+ integrationName: IntegrationName
+ dataLoading: boolean
+ organizationsWithInstalledData: OrganizationsResponseWithInstalledData[]
+}
+
+const OrganizationPicker = ({
+ label = 'Choose an organization',
+ onSelectedOrgChange,
+ integrationName,
+ dataLoading,
+ organizationsWithInstalledData,
+}: OrganizationPickerProps) => {
+ const { ui } = useStore()
+ const [selectedOrg, setSelectedOrg] = useState<Organization | null>(null)
+
+ const { data, isLoading } = useOrganizationsQuery({
+ onSuccess(organizations) {
+ const firstOrg = organizations?.[0]
+ if (firstOrg && selectedOrg === null) {
+ setSelectedOrg(firstOrg)
+ onSelectedOrgChange?.(firstOrg)
+ }
+ },
+ })
+
+ function _onSelectedOrgChange(slug: string) {
+ const org = data?.find((org) => org.slug === slug)
+
+ if (org) {
+ setSelectedOrg(org)
+ onSelectedOrgChange?.(org)
+ }
+ }
+
+ if (dataLoading) {
+ return (
+ <Listbox label={label} value="loading" disabled>
+ <Listbox.Option key="loading" value="loading" label="Loading...">
+ Loading...
+ </Listbox.Option>
+ </Listbox>
+ )
+ }
+
+ return (
+ <Listbox label={label} value={selectedOrg?.slug} onChange={_onSelectedOrgChange}>
+ {organizationsWithInstalledData?.map((org) => {
+ const label = (
+ <div className="flex gap-3 items-center">
+ {org.name}
+ {org.installationInstalled && <Badge color="scale">Integration Installed</Badge>}
+ </div>
+ )
+ return (
+ <Listbox.Option
+ key={org.id}
+ value={org.slug}
+ // @ts-expect-error
+ label={label}
+ addOnBefore={({ active, selected }: any) => <IconHexagon />}
+ >
+ {label}
+ </Listbox.Option>
+ )
+ })}
+ </Listbox>
+ )
+}
+
+export default GitHubIntegration
diff --git a/studio/pages/integrations/vercel.tsx b/studio/pages/integrations/vercel.tsx
index 9b2a5ac0c5a..29c927001cf 100644
--- a/studio/pages/integrations/vercel.tsx
+++ b/studio/pages/integrations/vercel.tsx
@@ -1,6 +1,6 @@
import { useEffect } from 'react'
-import IntegrationWindowLayout from 'components/layouts/IntegrationWindowLayout'
+import IntegrationWindowLayout from 'components/layouts/IntegrationsLayout/IntegrationWindowLayout'
import { useRouter } from 'next/router'
import { NextPageWithLayout } from 'types'
diff --git a/studio/pages/integrations/vercel/[slug]/deploy-button/new-project.tsx b/studio/pages/integrations/vercel/[slug]/deploy-button/new-project.tsx
index 7736f118c58..4465635cb5c 100644
--- a/studio/pages/integrations/vercel/[slug]/deploy-button/new-project.tsx
+++ b/studio/pages/integrations/vercel/[slug]/deploy-button/new-project.tsx
@@ -4,7 +4,7 @@ import { ChangeEvent, useRef, useState } from 'react'
import { useParams } from 'common'
import { Markdown } from 'components/interfaces/Markdown'
-import IntegrationWindowLayout from 'components/layouts/IntegrationWindowLayout'
+import { VercelIntegrationLayout } from 'components/layouts'
import { ScaffoldContainer, ScaffoldDivider } from 'components/layouts/Scaffold'
import PasswordStrengthBar from 'components/ui/PasswordStrengthBar'
import { useProjectApiQuery } from 'data/config/project-api-query'
@@ -61,7 +61,7 @@ const VercelIntegration: NextPageWithLayout = () => {
)
}
-VercelIntegration.getLayout = (page) => <IntegrationWindowLayout>{page}</IntegrationWindowLayout>
+VercelIntegration.getLayout = (page) => <VercelIntegrationLayout>{page}</VercelIntegrationLayout>
const CreateProject = ({
loading,
diff --git a/studio/pages/integrations/vercel/[slug]/marketplace/choose-project.tsx b/studio/pages/integrations/vercel/[slug]/marketplace/choose-project.tsx
index 75a9ae1bece..defe66f8310 100644
--- a/studio/pages/integrations/vercel/[slug]/marketplace/choose-project.tsx
+++ b/studio/pages/integrations/vercel/[slug]/marketplace/choose-project.tsx
@@ -3,7 +3,7 @@ import { useMemo, useState } from 'react'
import { useParams } from 'common'
import ProjectLinker from 'components/interfaces/Integrations/ProjectLinker'
import { Markdown } from 'components/interfaces/Markdown'
-import IntegrationWindowLayout from 'components/layouts/IntegrationWindowLayout'
+import { VercelIntegrationLayout } from 'components/layouts'
import { ScaffoldContainer, ScaffoldDivider } from 'components/layouts/Scaffold'
import { useOrgIntegrationsQuery } from 'data/integrations/integrations-query-org-only'
import { useVercelProjectsQuery } from 'data/integrations/integrations-vercel-projects-query'
@@ -103,6 +103,6 @@ This Supabase integration manages your envioemnt variables automatically to prov
)
}
-VercelIntegration.getLayout = (page) => <IntegrationWindowLayout>{page}</IntegrationWindowLayout>
+VercelIntegration.getLayout = (page) => <VercelIntegrationLayout>{page}</VercelIntegrationLayout>
export default VercelIntegration
diff --git a/studio/pages/integrations/vercel/install.tsx b/studio/pages/integrations/vercel/install.tsx
index 67e8ef2f022..dd629aed8b5 100644
--- a/studio/pages/integrations/vercel/install.tsx
+++ b/studio/pages/integrations/vercel/install.tsx
@@ -1,6 +1,6 @@
import { useParams } from 'common'
import { Markdown } from 'components/interfaces/Markdown'
-import IntegrationWindowLayout from 'components/layouts/IntegrationWindowLayout'
+import VercelIntegrationWindowLayout from 'components/layouts/IntegrationsLayout/VercelIntegrationWindowLayout'
import { ScaffoldContainer, ScaffoldDivider } from 'components/layouts/Scaffold'
import { useIntegrationsQuery } from 'data/integrations/integrations-query'
import { IntegrationName } from 'data/integrations/integrations.types'
@@ -150,7 +150,7 @@ const VercelIntegration: NextPageWithLayout = () => {
}
/**
- * Only install if instgration hasn't already been installed
+ * Only install if integration hasn't already been installed
*/
if (!isIntegrationInstalled) {
mutate({
@@ -228,7 +228,9 @@ const VercelIntegration: NextPageWithLayout = () => {
)
}
-VercelIntegration.getLayout = (page) => <IntegrationWindowLayout>{page}</IntegrationWindowLayout>
+VercelIntegration.getLayout = (page) => (
+ <VercelIntegrationWindowLayout>{page}</VercelIntegrationWindowLayout>
+)
export interface OrganizationPickerProps {
label?: string
diff --git a/studio/state/github-integration-installation.ts b/studio/state/github-integration-installation.ts
new file mode 100644
index 00000000000..8d134d2b168
--- /dev/null
+++ b/studio/state/github-integration-installation.ts
@@ -0,0 +1,15 @@
+import { proxy, snapshot, useSnapshot } from 'valtio'
+
+export const githubIntegrationInstallationState = proxy({
+ selectedOrganizationSlug: '' as string,
+ setSelectedOrganizationSlug: (selectedOrganizationSlug: string) => {
+ githubIntegrationInstallationState.selectedOrganizationSlug = selectedOrganizationSlug
+ },
+})
+
+export const getGitHubIntegrationInstallationState = () =>
+ snapshot(githubIntegrationInstallationState)
+
+export const useGitHubIntegrationInstallationState = (
+ options?: Parameters<typeof useSnapshot>[1]
+) => useSnapshot(githubIntegrationInstallationState, options)