import { useParams } from 'common' import { ArrowRight, Loader2 } from 'lucide-react' import Link from 'next/link' import { useEffect } from 'react' import { Badge, Button } from 'ui' import { ClientLibrary } from '@/components/interfaces/Home/ClientLibrary' import { ExampleProject } from '@/components/interfaces/Home/ExampleProject' import { EXAMPLE_PROJECTS } from '@/components/interfaces/Home/Home.constants' import { APIKeys } from '@/components/interfaces/Home/NewProjectPanel/APIKeys' import { SupportLink } from '@/components/interfaces/Support/SupportLink' import { useInvalidateProjectsInfiniteQuery } from '@/data/projects/org-projects-infinite-query' import { useInvalidateProjectDetailsQuery } from '@/data/projects/project-detail-query' import { useProjectStatusQuery } from '@/data/projects/project-status-query' import { useCustomContent } from '@/hooks/custom-content/useCustomContent' import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled' import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject' import { DOCS_URL, PROJECT_STATUS } from '@/lib/constants' const BuildingState = () => { const { ref } = useParams() const { data: project } = useSelectedProjectQuery() const { invalidateProjectsQuery } = useInvalidateProjectsInfiniteQuery() const { invalidateProjectDetailsQuery } = useInvalidateProjectDetailsQuery() const showExamples = useIsFeatureEnabled('project_homepage:show_examples') const { projectHomepageClientLibraries: clientLibraries } = useCustomContent([ 'project_homepage:client_libraries', ]) const { data: projectStatusData, isSuccess: isProjectStatusSuccess } = useProjectStatusQuery( { projectRef: ref }, { enabled: project?.status !== PROJECT_STATUS.ACTIVE_HEALTHY, refetchInterval: (query) => { const data = query.state.data return data?.status === PROJECT_STATUS.ACTIVE_HEALTHY ? false : 4000 }, } ) useEffect(() => { if (!isProjectStatusSuccess) return if (projectStatusData?.status === PROJECT_STATUS.ACTIVE_HEALTHY) { if (ref) { invalidateProjectDetailsQuery(ref) } invalidateProjectsQuery() } }, [ isProjectStatusSuccess, projectStatusData, ref, invalidateProjectDetailsQuery, invalidateProjectsQuery, ]) if (project === undefined) return null return (

{project?.name}

{project.status === PROJECT_STATUS.UNKNOWN ? 'Initiating project set up' : 'Setting up project'}

{' '} We are provisioning your database and API endpoints

This may take a few minutes

While you wait

Browse the Supabase{' '} documentation .

} />

Not working?

Try refreshing after a couple of minutes.

} />

    If your dashboard hasn't connected within 2 minutes, you can open a support ticket.

    } />
{project.status === PROJECT_STATUS.COMING_UP && (

Client libraries

{clientLibraries!.map((library) => ( ))}
{showExamples && (
Example projects
{EXAMPLE_PROJECTS.map((project) => ( ))}
)}
)}
) } export default BuildingState const ChecklistItem = ({ description }: any) => { return (
  • {description}
  • ) }