The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat(studio): page titles for new flows and docs (#43537)
Danny White98088c0aa619
diff --git a/apps/design-system/content/docs/ui-patterns/navigation.mdx b/apps/design-system/content/docs/ui-patterns/navigation.mdxindex a0fc17e816f..8a7a94e7a70 100644--- a/apps/design-system/content/docs/ui-patterns/navigation.mdx+++ b/apps/design-system/content/docs/ui-patterns/navigation.mdx@@ -12,3 +12,24 @@ Supabase has a necessarily complex navigation system to handle multiple productsA horizontal list of related views within a consistent PageLayout context, allowing for clearer page-level organisation. Activating a NavMenu item should trigger a URL change.[NavMenu component guidelines](../components/nav-menu)++## Page titles++Browser page titles should follow a consistent most-specific-first structure so tabs and browser history are easier to scan:++`Entity | Section | Surface | Project | Org | Supabase`++Examples:++- `users | Table Editor | My Project | My Org | Supabase`+- `Backups | Database | My Project | My Org | Supabase`++Implementation notes (Studio):++- Use the shared title formatter in `apps/studio/lib/page-title.ts`+- Prefer `ProjectLayout` for project-scoped pages+- Prefer a layout's explicit `title` prop when a wrapper layout exposes one+- Use `browserTitle` for additional segments such as `entity` or `surface`, or when rendering `ProjectLayout` directly+- Use `browserTitle.entity` for the most specific resource (table/function/query) when available+- `ProjectLayout.title` remains supported as legacy/deprecated compatibility when using `ProjectLayout` directly+- Avoid assembling `document.title` ad hoc in individual pages/layoutsdiff --git a/apps/studio/pages/new/[slug].tsx b/apps/studio/pages/new/[slug].tsxindex 54ba1e101ff..ea2086166f9 100644--- a/apps/studio/pages/new/[slug].tsx+++ b/apps/studio/pages/new/[slug].tsx@@ -41,15 +41,18 @@ import {useProjectCreateMutation,} from 'data/projects/project-create-mutation'import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions'+import { useCustomContent } from 'hooks/custom-content/useCustomContent'import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'import { useLocalStorageQuery } from 'hooks/misc/useLocalStorage'import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'import { withAuth } from 'hooks/misc/withAuth'import { usePHFlag } from 'hooks/ui/useFlag'import { DOCS_URL, PROJECT_STATUS, PROVIDERS, useDefaultProvider } from 'lib/constants'+import { buildStudioPageTitle } from 'lib/page-title'import { useProfile } from 'lib/profile'import { useTrack } from 'lib/telemetry/track'import Link from 'next/link'+import Head from 'next/head'import { useRouter } from 'next/router'import { PropsWithChildren, useEffect, useMemo, useState } from 'react'import { useForm } from 'react-hook-form'@@ -67,8 +70,13 @@ const Wizard: NextPageWithLayout = () => {const track = useTrack()const router = useRouter()const { slug, projectName } = useParams()+ const { appTitle } = useCustomContent(['app:title'])const defaultProvider = useDefaultProvider()const { profile } = useProfile()+ const pageTitle = buildStudioPageTitle({+ section: 'New Project',+ brand: appTitle || 'Supabase',+ })const { data: currentOrg } = useSelectedOrganizationQuery()const isFreePlan = currentOrg?.plan?.id === 'free'@@ -381,162 +389,169 @@ const Wizard: NextPageWithLayout = () => {}, [instanceSize, watchedInstanceSize, form])return (- <Form_Shadcn_ {...form}>- <form onSubmit={form.handleSubmit(onSubmitWithComputeCostsConfirmation)}>- <Panel- loading={!isOrganizationsSuccess}- title={- <div key="panel-title">- <h3>Create a new project</h3>- <p className="text-sm text-foreground-lighter text-balance">- Your project will have its own dedicated instance and full Postgres database. An API- will be set up so you can easily interact with your new database.- </p>- </div>- }- footer={- <ProjectCreationFooter- form={form}- canCreateProject={canCreateProject}- instanceSize={instanceSize}- organizationProjects={organizationProjects}- isCreatingNewProject={isCreatingNewProject}- isSuccessNewProject={isSuccessNewProject}- />- }- >- <>- {projectCreationDisabled ? (- <DisabledWarningDueToIncident title="Project creation is currently disabled" />- ) : (- <div className="divide-y divide-border-muted">- <OrganizationSelector form={form} />-- {canCreateProject && (- <>- <ProjectNameInput form={form} />-- {cloudProviderEnabled && showNonProdFields && (- <CloudProviderSelector form={form} />- )}-- {canChooseInstanceSize && <ComputeSizeSelector form={form} />}-- <DatabasePasswordInput form={form} />-- <RegionSelector- form={form}- instanceSize={instanceSize as DesiredInstanceSize}- />-- {showPostgresVersionSelector && (- <Panel.Content>- <FormField_Shadcn_- control={form.control}- name="postgresVersionSelection"- render={({ field }) => (- <PostgresVersionSelector- field={field}- form={form}- cloudProvider={form.getValues('cloudProvider') as CloudProvider}- organizationSlug={slug}- dbRegion={form.getValues('dbRegion')}- />- )}- />- </Panel.Content>- )}-- {showNonProdFields && <CustomPostgresVersionInput form={form} />}-- <SecurityOptions form={form} />- {showAdvancedConfig && !!availableOrioleVersion && (- <AdvancedConfiguration form={form} />- )}+ <>+ {/* Wizard layouts set the visual header but not the browser tab title. */}+ <Head>+ <title>{pageTitle}</title>+ <meta name="description" content="Supabase Studio" />+ </Head>+ <Form_Shadcn_ {...form}>+ <form onSubmit={form.handleSubmit(onSubmitWithComputeCostsConfirmation)}>+ <Panel+ loading={!isOrganizationsSuccess}+ title={+ <div key="panel-title">+ <h3>Create a new project</h3>+ <p className="text-sm text-foreground-lighter text-balance">+ Your project will have its own dedicated instance and full Postgres database. An+ API will be set up so you can easily interact with your new database.+ </p>+ </div>+ }+ footer={+ <ProjectCreationFooter+ form={form}+ canCreateProject={canCreateProject}+ instanceSize={instanceSize}+ organizationProjects={organizationProjects}+ isCreatingNewProject={isCreatingNewProject}+ isSuccessNewProject={isSuccessNewProject}+ />+ }+ >+ <>+ {projectCreationDisabled ? (+ <DisabledWarningDueToIncident title="Project creation is currently disabled" />+ ) : (+ <div className="divide-y divide-border-muted">+ <OrganizationSelector form={form} />++ {canCreateProject && (+ <>+ <ProjectNameInput form={form} />++ {cloudProviderEnabled && showNonProdFields && (+ <CloudProviderSelector form={form} />+ )}++ {canChooseInstanceSize && <ComputeSizeSelector form={form} />}++ <DatabasePasswordInput form={form} />++ <RegionSelector+ form={form}+ instanceSize={instanceSize as DesiredInstanceSize}+ />- {shouldShowFreeProjectInfo ? (+ {showPostgresVersionSelector && (+ <Panel.Content>+ <FormField_Shadcn_+ control={form.control}+ name="postgresVersionSelection"+ render={({ field }) => (+ <PostgresVersionSelector+ field={field}+ form={form}+ cloudProvider={form.getValues('cloudProvider') as CloudProvider}+ organizationSlug={slug}+ dbRegion={form.getValues('dbRegion')}+ />+ )}+ />+ </Panel.Content>+ )}++ {showNonProdFields && <CustomPostgresVersionInput form={form} />}++ <SecurityOptions form={form} />+ {showAdvancedConfig && !!availableOrioleVersion && (+ <AdvancedConfiguration form={form} />+ )}++ {shouldShowFreeProjectInfo ? (+ <Admonition+ className="rounded-none border-0 border-t"+ type="note"+ title="Need a free project?"+ description={+ <p>+ You can have up to 2 free projects across all organizations.{' '}+ <Link className="underline text-foreground" href="/new">+ Create a free organization+ </Link>{' '}+ to use them.+ </p>+ }+ />+ ) : null}+ </>+ )}++ {freePlanWithExceedingLimits ? (+ isAdmin &&+ slug && (+ <FreeProjectLimitWarning membersExceededLimit={membersExceededLimit || []} />+ )+ ) : hasOutstandingInvoices ? (+ <Panel.Content><Admonition- className="rounded-none border-0 border-t"- type="note"- title="Need a free project?"+ type="default"+ title="Your organization has overdue invoices"description={- <p>- You can have up to 2 free projects across all organizations.{' '}- <Link className="underline text-foreground" href="/new">- Create a free organization- </Link>{' '}- to use them.- </p>+ <div className="space-y-3">+ <p className="text-sm leading-normal">+ Please resolve all outstanding invoices first before creating a new+ project+ </p>++ <div>+ <Button asChild type="default">+ <Link href={`/org/${slug}/billing#invoices`}>View invoices</Link>+ </Button>+ </div>+ </div>}/>- ) : null}- </>- )}-- {freePlanWithExceedingLimits ? (- isAdmin &&- slug && (- <FreeProjectLimitWarning membersExceededLimit={membersExceededLimit || []} />- )- ) : hasOutstandingInvoices ? (- <Panel.Content>- <Admonition- type="default"- title="Your organization has overdue invoices"- description={- <div className="space-y-3">- <p className="text-sm leading-normal">- Please resolve all outstanding invoices first before creating a new- project- </p>-- <div>- <Button asChild type="default">- <Link href={`/org/${slug}/billing#invoices`}>View invoices</Link>- </Button>- </div>- </div>- }- />- </Panel.Content>- ) : null}- </div>- )}- </>- </Panel>-- <ConfirmationModal- size="large"- loading={false}- visible={isComputeCostsConfirmationModalVisible}- title="Confirm compute costs"- confirmLabel="I understand"- onCancel={() => setIsComputeCostsConfirmationModalVisible(false)}- onConfirm={async () => {- const values = form.getValues()- await onSubmit(values)- setIsComputeCostsConfirmationModalVisible(false)- }}- variant={'warning'}- >- <div className="text-sm text-foreground-light space-y-1">- <p>- Launching a project on compute size "{instanceLabel(instanceSize)}" increases your- monthly costs by ${additionalMonthlySpend}, independent of how actively you use it. By- clicking "I understand", you agree to the additional costs.{' '}- <Link- href={`${DOCS_URL}/guides/platform/manage-your-usage/compute`}- target="_blank"- className="underline"- >- Compute Costs- </Link>{' '}- are non-refundable.- </p>- </div>- </ConfirmationModal>- </form>- </Form_Shadcn_>+ </Panel.Content>+ ) : null}+ </div>+ )}+ </>+ </Panel>++ <ConfirmationModal+ size="large"+ loading={false}+ visible={isComputeCostsConfirmationModalVisible}+ title="Confirm compute costs"+ confirmLabel="I understand"+ onCancel={() => setIsComputeCostsConfirmationModalVisible(false)}+ onConfirm={async () => {+ const values = form.getValues()+ await onSubmit(values)+ setIsComputeCostsConfirmationModalVisible(false)+ }}+ variant={'warning'}+ >+ <div className="text-sm text-foreground-light space-y-1">+ <p>+ Launching a project on compute size "{instanceLabel(instanceSize)}" increases your+ monthly costs by ${additionalMonthlySpend}, independent of how actively you use it.+ By clicking "I understand", you agree to the additional costs.{' '}+ <Link+ href={`${DOCS_URL}/guides/platform/manage-your-usage/compute`}+ target="_blank"+ className="underline"+ >+ Compute Costs+ </Link>{' '}+ are non-refundable.+ </p>+ </div>+ </ConfirmationModal>+ </form>+ </Form_Shadcn_>+ </>)}diff --git a/apps/studio/pages/new/index.tsx b/apps/studio/pages/new/index.tsxindex 51ee8372f0f..db880de3bdb 100644--- a/apps/studio/pages/new/index.tsx+++ b/apps/studio/pages/new/index.tsx@@ -1,10 +1,13 @@import HCaptcha from '@hcaptcha/react-hcaptcha'+import Head from 'next/head'+import { useCallback, useEffect, useState } from 'react'import { NewOrgForm } from 'components/interfaces/Organization/NewOrg/NewOrgForm'import { AppLayout } from 'components/layouts/AppLayout/AppLayout'import { DefaultLayout } from 'components/layouts/DefaultLayout'import WizardLayout from 'components/layouts/WizardLayout'import { SetupIntentResponse, useSetupIntent } from 'data/stripe/setup-intent-mutation'-import { useCallback, useEffect, useState } from 'react'+import { useCustomContent } from 'hooks/custom-content/useCustomContent'+import { buildStudioPageTitle } from 'lib/page-title'import type { NextPageWithLayout } from 'types'/**@@ -12,6 +15,11 @@ import type { NextPageWithLayout } from 'types'*/const Wizard: NextPageWithLayout = () => {const [intent, setIntent] = useState<SetupIntentResponse>()+ const { appTitle } = useCustomContent(['app:title'])+ const pageTitle = buildStudioPageTitle({+ section: 'New Organization',+ brand: appTitle || 'Supabase',+ })const [captchaToken, setCaptchaToken] = useState<string | null>(null)const [captchaRef, setCaptchaRef] = useState<HCaptcha | null>(null)@@ -74,6 +82,11 @@ const Wizard: NextPageWithLayout = () => {return (<>+ {/* Wizard layouts set the visual header but not the browser tab title. */}+ <Head>+ <title>{pageTitle}</title>+ <meta name="description" content="Supabase Studio" />+ </Head><HCaptcharef={captchaRefCallback}sitekey={process.env.NEXT_PUBLIC_HCAPTCHA_SITE_KEY!}