import Link from 'next/link' import { FC, useEffect, useRef } from 'react' import { observer } from 'mobx-react-lite' import { Badge, IconArrowRight, IconLoader, Button } from 'ui' import ExampleProject from 'components/interfaces/Home/ExampleProject' import ClientLibrary from 'components/interfaces/Home/ClientLibrary' import { CLIENT_LIBRARIES, EXAMPLE_PROJECTS } from 'components/interfaces/Home/Home.constants' import { API_URL, PROJECT_STATUS } from 'lib/constants' import { useStore } from 'hooks' import { getWithTimeout } from 'lib/common/fetch' import { Project } from 'types' import { DisplayApiSettings, DisplayConfigSettings } from 'components/ui/ProjectSettings' interface Props { project: Project } const BuildingState: FC = ({ project }) => { const { ui, app } = useStore() const checkServerInterval = useRef() async function checkServer() { if (!project) return const projectStatus = await getWithTimeout(`${API_URL}/projects/${project.ref}/status`, { timeout: 2000, }) if (projectStatus && !projectStatus.error) { const { status } = projectStatus if (status === PROJECT_STATUS.ACTIVE_HEALTHY) { clearInterval(checkServerInterval.current) // re-fetch project detail. // This will also trigger UI state change to show project building completed await app.projects.fetchDetail(project.ref) } } } useEffect(() => { // check server status every 4s checkServerInterval.current = window.setInterval(checkServer, 4000) return () => { clearInterval(checkServerInterval.current) } }, []) return (

{project?.name}

{project.status === PROJECT_STATUS.RESTORING ? 'Restoring project' : '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
{CLIENT_LIBRARIES.map((library) => ( ))}
Example projects
{EXAMPLE_PROJECTS.map((project) => ( ))}
)}
) } export default observer(BuildingState) const ChecklistItem = ({ description }: any) => { return (
  • {description}
  • ) }