Skip to content

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

fix: vercel deploy button layouts (#17697)

Jonathan Summers-Muir2dae3a036eb1
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 abe2d0b0f63..2e78ab6b83b 100644
--- a/studio/pages/integrations/vercel/[slug]/deploy-button/new-project.tsx
+++ b/studio/pages/integrations/vercel/[slug]/deploy-button/new-project.tsx
@@ -6,7 +6,7 @@ import { ChangeEvent, useRef, useState } from 'react'
import { useParams } from 'common'
import { Markdown } from 'components/interfaces/Markdown'
import { VercelIntegrationLayout } from 'components/layouts'
-import { ScaffoldContainer, ScaffoldDivider } from 'components/layouts/Scaffold'
+import { ScaffoldColumn, ScaffoldContainer, ScaffoldDivider } from 'components/layouts/Scaffold'
import PasswordStrengthBar from 'components/ui/PasswordStrengthBar'
import { useProjectApiQuery } from 'data/config/project-api-query'
import { useIntegrationsQuery } from 'data/integrations/integrations-query'
@@ -21,55 +21,38 @@ import { passwordStrength } from 'lib/helpers'
import { getInitialMigrationSQLFromGitHubRepo } from 'lib/integration-utils'
import { NextPageWithLayout } from 'types'
import { Alert, Button, Checkbox, IconBook, IconLifeBuoy, Input, Listbox, LoadingLine } from 'ui'
+import VercelIntegrationWindowLayout from 'components/layouts/IntegrationsLayout/VercelIntegrationWindowLayout'
+import { useIntegrationInstallationSnapshot } from 'state/integration-installation'
const VercelIntegration: NextPageWithLayout = () => {
- const [loading, setLoading] = useState<boolean>(false)
-
return (
<>
- <main className="overflow-auto flex flex-col h-full">
- <LoadingLine loading={loading} />
-
- <>
- <ScaffoldContainer className="max-w-md flex flex-col gap-6 grow py-8">
- <h1 className="text-xl text-foreground">New project</h1>
- <>
- <Markdown content={`Choose the Supabase organization you wish to install in`} />
- <CreateProject loading={loading} setLoading={setLoading} />
- </>
- </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={`You can remove this integration at any time via Vercel 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-foreground-lighter">
- <IconBook size={16} /> Docs
- </div>
- <div className="flex items-center gap-2 text-xs text-foreground-lighter">
- <IconLifeBuoy size={16} /> Support
- </div>
+ <ScaffoldContainer className="flex flex-col gap-6 grow py-8">
+ <ScaffoldColumn className="mx-auto w-full max-w-md">
+ <header>
+ <h1 className="text-xl text">New project</h1>
+ <Markdown
+ className="text-foreground-light"
+ content={`Choose the Supabase organization you wish to install in`}
+ />
+ </header>
+ <CreateProject />
+ <Alert withIcon variant="info" title="You can uninstall this Integration at any time.">
+ <Markdown
+ content={`You can remove this integration at any time via Vercel or the Supabase dashboard.`}
+ />
+ </Alert>
+ </ScaffoldColumn>
</ScaffoldContainer>
</>
)
}
-VercelIntegration.getLayout = (page) => <VercelIntegrationLayout>{page}</VercelIntegrationLayout>
+VercelIntegration.getLayout = (page) => (
+ <VercelIntegrationWindowLayout>{page}</VercelIntegrationWindowLayout>
+)
-const CreateProject = ({
- loading,
- setLoading,
-}: {
- loading: boolean
- setLoading: (e: boolean) => void
-}) => {
+const CreateProject = () => {
const router = useRouter()
const { ui } = useStore()
const selectedOrganization = useSelectedOrganization()
@@ -80,6 +63,8 @@ const CreateProject = ({
const [shouldRunMigrations, setShouldRunMigrations] = useState(true)
const [dbRegion, setDbRegion] = useState(PROVIDERS.AWS.default_region)
+ const snapshot = useIntegrationInstallationSnapshot()
+
const delayedCheckPasswordStrength = useRef(
debounce((value: string) => checkPasswordStrength(value), 300)
).current
@@ -161,7 +146,7 @@ const CreateProject = ({
},
onError: (error) => {
ui.setNotification({ error, category: 'error', message: error.message })
- setLoading(false)
+ snapshot.setLoading(false)
},
})
@@ -173,7 +158,7 @@ const CreateProject = ({
if (!configurationId) return console.error('No configurationId ID set')
if (!organization) return console.error('No organization ID set')
- setLoading(true)
+ snapshot.setLoading(true)
let dbSql: string | undefined
if (shouldRunMigrations) {
@@ -251,7 +236,7 @@ const CreateProject = ({
return
}
- setLoading(false)
+ snapshot.setLoading(false)
if (next) {
window.location.href = next
@@ -338,8 +323,8 @@ const CreateProject = ({
<Button
size="medium"
className="self-end"
- disabled={loading}
- loading={loading}
+ disabled={snapshot.loading}
+ loading={snapshot.loading}
onClick={onCreateProject}
>
Create Project