The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
add coming up state to new project home DESIGN-300 (#39680)
Jordi Enricc44220c09648
diff --git a/apps/studio/components/interfaces/HomeNew/AdvisorSection.tsx b/apps/studio/components/interfaces/HomeNew/AdvisorSection.tsxindex 8d2e466e4b0..d5d302a7cdc 100644--- a/apps/studio/components/interfaces/HomeNew/AdvisorSection.tsx+++ b/apps/studio/components/interfaces/HomeNew/AdvisorSection.tsx@@ -30,9 +30,16 @@ import {import { Row } from 'ui-patterns'import ShimmeringLoader from 'ui-patterns/ShimmeringLoader'-export const AdvisorSection = () => {+export const AdvisorSection = ({ showEmptyState = false }: { showEmptyState?: boolean }) => {const { ref: projectRef } = useParams()- const { data: lints, isLoading: isLoadingLints } = useProjectLintsQuery({ projectRef })+ const { data: lints, isLoading: isLoadingLints } = useProjectLintsQuery(+ {+ projectRef,+ },+ {+ enabled: !showEmptyState,+ }+ )const snap = useAiAssistantStateSnapshot()const { mutate: sendEvent } = useSendEventMutation()const { data: organization } = useSelectedOrganizationQuery()@@ -93,6 +100,10 @@ export const AdvisorSection = () => {[sendEvent, projectRef, organization])+ if (showEmptyState) {+ return <EmptyState />+ }+return (<div>{isLoadingLints ? (@@ -199,15 +210,21 @@ export const AdvisorSection = () => {</Sheet></>) : (- <Card className="bg-transparent">- <CardContent className="flex flex-col items-center justify-center gap-2 p-16">- <Shield size={20} strokeWidth={1.5} className="text-foreground-muted" />- <p className="text-sm text-foreground-light text-center">- No security or performance errors found- </p>- </CardContent>- </Card>+ <EmptyState />)}</div>)}++function EmptyState() {+ return (+ <Card className="bg-transparent">+ <CardContent className="flex flex-col items-center justify-center gap-2 p-16">+ <Shield size={20} strokeWidth={1.5} className="text-foreground-muted" />+ <p className="text-sm text-foreground-light text-center">+ No security or performance errors found+ </p>+ </CardContent>+ </Card>+ )+}diff --git a/apps/studio/components/interfaces/HomeNew/Home.tsx b/apps/studio/components/interfaces/HomeNew/Home.tsxindex ffb9b1de5c8..49d80d5c36a 100644--- a/apps/studio/components/interfaces/HomeNew/Home.tsx+++ b/apps/studio/components/interfaces/HomeNew/Home.tsx@@ -31,6 +31,7 @@ export const HomeV2 = () => {const hasShownEnableBranchingModalRef = useRef(false)const isPaused = project?.status === PROJECT_STATUS.INACTIVE+ const isComingUp = project?.status === PROJECT_STATUS.COMING_UPconst [sectionOrder, setSectionOrder] = useLocalStorage<string[]>(`home-section-order-${project?.ref || 'default'}`,@@ -101,9 +102,11 @@ export const HomeV2 = () => {{sectionOrder.map((id) => {if (IS_PLATFORM && id === 'usage') {return (- <SortableSection key={id} id={id}>- <ProjectUsageSection />- </SortableSection>+ <div key={id} className={cn(isComingUp && 'opacity-60 pointer-events-none')}>+ <SortableSection id={id}>+ <ProjectUsageSection />+ </SortableSection>+ </div>)}if (@@ -123,16 +126,20 @@ export const HomeV2 = () => {}if (id === 'advisor') {return (- <SortableSection key={id} id={id}>- <AdvisorSection />- </SortableSection>+ <div key={id} className={cn(isComingUp && 'opacity-60 pointer-events-none')}>+ <SortableSection id={id}>+ <AdvisorSection showEmptyState={isComingUp} />+ </SortableSection>+ </div>)}if (id === 'custom-report') {return (- <SortableSection key={id} id={id}>- <CustomReportSection />- </SortableSection>+ <div key={id} className={cn(isComingUp && 'opacity-60 pointer-events-none')}>+ <SortableSection id={id}>+ <CustomReportSection />+ </SortableSection>+ </div>)}})}diff --git a/apps/studio/components/interfaces/HomeNew/ServiceStatus.tsx b/apps/studio/components/interfaces/HomeNew/ServiceStatus.tsxindex d5ed3f78d2b..23d77e00f57 100644--- a/apps/studio/components/interfaces/HomeNew/ServiceStatus.tsx+++ b/apps/studio/components/interfaces/HomeNew/ServiceStatus.tsx@@ -254,36 +254,44 @@ export const ServiceStatus = () => {(service) => !service.isHealthy && service.status !== 'COMING_UP')const anyComingUp = services.some((service) => service.status === 'COMING_UP')- const overallStatusLabel = isLoadingChecks- ? 'Checking...'- : anyUnhealthy && !isProjectNew- ? 'Unhealthy'- : anyComingUp || isMigrationLoading || (isProjectNew && !allServicesOperational)- ? 'Coming up...'- : 'Healthy'+ // Spinner only while the overall project is in COMING_UP; otherwise show 6-dot grid+ const showSpinnerIcon = project?.status === 'COMING_UP'++ const getOverallStatusLabel = (): string => {+ if (isLoadingChecks) return 'Checking...'+ if (anyComingUp) return 'Coming up...'+ if (anyUnhealthy) return 'Unhealthy'+ return 'Healthy'+ }++ const overallStatusLabel = getOverallStatusLabel()return (<Popover_Shadcn_><PopoverTrigger_Shadcn_><SingleStaticon={- <div className="grid grid-cols-3 gap-1">- {services.map((service, index) => (- <div- key={`${service.name}-${index}`}- className={cn(- 'w-1.5 h-1.5 rounded-full',- service.isLoading ||- service.status === 'COMING_UP' ||- (isProjectNew && !service.isHealthy)- ? 'bg-foreground-lighter animate-pulse'- : service.isHealthy- ? 'bg-brand'- : 'bg-selection'- )}- />- ))}- </div>+ showSpinnerIcon ? (+ <Loader2 className="animate-spin" size={18} />+ ) : (+ <div className="grid grid-cols-3 gap-1">+ {services.map((service, index) => (+ <div+ key={`${service.name}-${index}`}+ className={cn(+ 'w-1.5 h-1.5 rounded-full',+ service.isLoading ||+ service.status === 'COMING_UP' ||+ (isProjectNew && !service.isHealthy)+ ? 'bg-foreground-lighter animate-pulse'+ : service.isHealthy+ ? 'bg-brand'+ : 'bg-selection'+ )}+ />+ ))}+ </div>+ )}label={<span>Status</span>}value={<span>{overallStatusLabel}</span>}diff --git a/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx b/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsxindex 8752cde1a01..98b53f5f2f2 100644--- a/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx+++ b/apps/studio/components/layouts/ProjectLayout/ProjectLayout.tsx@@ -3,7 +3,7 @@ import Head from 'next/head'import { useRouter } from 'next/router'import { forwardRef, Fragment, PropsWithChildren, ReactNode, useEffect, useState } from 'react'-import { LOCAL_STORAGE_KEYS, useParams } from 'common'+import { LOCAL_STORAGE_KEYS, useParams, useFlag } from 'common'import { CreateBranchModal } from 'components/interfaces/BranchManagement/CreateBranchModal'import ProjectAPIDocs from 'components/interfaces/ProjectAPIDocs/ProjectAPIDocs'import { AIAssistant } from 'components/ui/AIAssistantPanel/AIAssistant'@@ -318,11 +318,13 @@ const ContentWrapper = ({ isLoading, isBlocking = true, children }: ContentWrappconst { ref } = useParams()const state = useDatabaseSelectorStateSnapshot()const { data: selectedProject } = useSelectedProjectQuery()+ const isHomeNewFlag = useFlag('homeNew')const isBranchesPage = router.pathname.includes('/project/[ref]/branches')const isSettingsPages = router.pathname.includes('/project/[ref]/settings')const isVaultPage = router.pathname === '/project/[ref]/settings/vault'const isBackupsPage = router.pathname.includes('/project/[ref]/database/backups')+ const isHomePage = router.pathname === '/project/[ref]'const requiresDbConnection: boolean =(!isSettingsPages && !routesToIgnoreDBConnection.includes(router.pathname)) || isVaultPage@@ -343,6 +345,20 @@ const ContentWrapper = ({ isLoading, isBlocking = true, children }: ContentWrappconst isProjectPauseFailed = selectedProject?.status === PROJECT_STATUS.PAUSE_FAILEDconst isProjectOffline = selectedProject?.postgrestStatus === 'OFFLINE'+ // handle redirect to home for building state+ const shouldRedirectToHomeForBuilding =+ isHomeNewFlag && requiresDbConnection && isProjectBuilding && !isBranchesPage && !isHomePage++ // We won't be showing the building state with the new home page+ const shouldShowBuildingState =+ requiresDbConnection && isProjectBuilding && !isBranchesPage && !(isHomeNewFlag && isHomePage)++ useEffect(() => {+ if (shouldRedirectToHomeForBuilding && ref) {+ router.replace(`/project/${ref}`)+ }+ }, [shouldRedirectToHomeForBuilding, ref, router])+useEffect(() => {if (ref) state.setSelectedDatabaseId(ref)}, [ref])@@ -383,7 +399,11 @@ const ContentWrapper = ({ isLoading, isBlocking = true, children }: ContentWrappreturn <RestoreFailedState />}- if (requiresDbConnection && isProjectBuilding && !isBranchesPage) {+ if (shouldRedirectToHomeForBuilding) {+ return <Loading />+ }++ if (shouldShowBuildingState) {return <BuildingState />}diff --git a/apps/studio/pages/new/[slug].tsx b/apps/studio/pages/new/[slug].tsxindex ccfdc593341..f1da887ef0a 100644--- a/apps/studio/pages/new/[slug].tsx+++ b/apps/studio/pages/new/[slug].tsx@@ -146,6 +146,7 @@ const Wizard: NextPageWithLayout = () => {const projectCreationDisabled = useFlag('disableProjectCreationAndUpdate')const showPostgresVersionSelector = useFlag('showPostgresVersionSelector')const cloudProviderEnabled = useFlag('enableFlyCloudProvider')+ const isHomeNew = useFlag('homeNew')const showAdvancedConfig = useIsFeatureEnabled('project_creation:show_advanced_config')const { infraCloudProviders: validCloudProviders } = useCustomContent(['infra:cloud_providers'])@@ -254,7 +255,7 @@ const Wizard: NextPageWithLayout = () => {organization: res.organization_slug,},})- router.push(`/project/${res.ref}/building`)+ router.push(isHomeNew ? `/project/${res.ref}` : `/project/${res.ref}/building`)},})