Files
supabase/studio/components/layouts/ProjectLayout/BuildingState.tsx
T
8057309e51 chore: upgrade next 13 + react 18 (#17839)
* update deps + image codemod (studio)

* update next links (studio)

* update deps

* update links (ui)

* remove next-transpile-modules

* move next-themes dependency

* chore: update ConfirmDialog

* chore: remove old ConfirmModal js file. migrated to TS

* dependency wrangling

* remove empty page

* update next links (www)

* First run bump react-data-grid-v7 beta 4

* fix package-lock.json

* more deps wrangling

* update recharts

* update sentry options

* fix some broken things in www

* studio fixes

* fix graphiql

* fix studio build

* fix menu hydration

* small build error

* update turbo

* fix www typescript errors

* docs image codemod

* links codemod docs

* fix docs typescript errors

* move useConsent to ui to prevent circular deps

* Fix links

* Fix homepage

* Fix links

* move studio/ to apps/

* Revert "move studio/ to apps/"

This reverts commit 1b0a985fcb.

* disable outputFileTracingRoot

* remove outputFileTracingRoot

* fix homepage product cards

* fix PrivacySettings links

* Fix links

* Fix the build for www.

* Minor fixes for JWTGenerator.

* Fix the docs and ui tests.

* Revert codehike back to 0.8.3

* remove ConfirmAlert()

* reenable babel because mobx hates me

* fix blog image and comparison page avatar

* Fix svg errors

* update image synthax

* Fix code hike

* Move the button in a div so that it doesn't inherit its parent height and make the button look weird.

* When components are defined in a component, they get recreated on each render. This makes them unstable in certain cases and causes infinite rerenders.

* Replace the next/head usage with next/script.

* Chore/upgrade next 13 fix table editor (#18431)

* fix table editor styling and fix row deletion logic

* Fix deleting selected rows from header, and fix checkboxes not clearing up

* Fix deleting all rows when filter applied, and fix deleting all rows

* Fix grid size styling issue

* Fix TS error

* Hydration errors

* studio org pages fixes

* fix more studio links

* audit logs fixes

* dropdown icon styling fixes

* fix some images in www

* upgrade to next 14

* try new sentry wrapper for api

* see if this is even invoked

* Revert "see if this is even invoked"

This reverts commit 86c3973ffa.

* Revert "try new sentry wrapper for api"

This reverts commit f67623ebad.

* Revert "upgrade to next 14"

This reverts commit a24dd6131e.

* chore: allow node version 19/20

* Try to fix the LogTable so that it renders with the newer "react-data-grid" version.

* Fix type errors in the log renderer code.

* Fix the replication screen.

* Add the CSS for the GraphiQL.

* Fix SQL editor results rendering

* Lint

* Fix SQL editor results height issue

* Fix auth RLS not invalidating RQ when toggling RLS

* Fix database tables new/edit column regressed

* Fix migrations page empty state if migrations schema not yet created

* Fix API side panel docs temp remove postgrest text for column description PK and FK

* Fix + improve timeout handling in SQL editor

---------

Co-authored-by: Jonathan Summers-Muir <MildTomato@users.noreply.github.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Co-authored-by: Francesco Sansalvadore <f.sansalvadore@gmail.com>
Co-authored-by: Terry Sutton <saltcod@gmail.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
Co-authored-by: Kevin Grüneberg <k.grueneberg1994@gmail.com>
2023-10-31 05:51:46 +00:00

170 lines
6.1 KiB
TypeScript

import { useQueryClient } from '@tanstack/react-query'
import ClientLibrary from 'components/interfaces/Home/ClientLibrary'
import ExampleProject from 'components/interfaces/Home/ExampleProject'
import { CLIENT_LIBRARIES, EXAMPLE_PROJECTS } from 'components/interfaces/Home/Home.constants'
import Link from 'next/link'
import { useEffect, useRef } from 'react'
import { Badge, Button, IconArrowRight, IconLoader } from 'ui'
import { useParams } from 'common'
import { DisplayApiSettings, DisplayConfigSettings } from 'components/ui/ProjectSettings'
import { invalidateProjectDetailsQuery } from 'data/projects/project-detail-query'
import { invalidateProjectsQuery } from 'data/projects/projects-query'
import { useSelectedProject } from 'hooks'
import { getWithTimeout } from 'lib/common/fetch'
import { API_URL, PROJECT_STATUS } from 'lib/constants'
const BuildingState = () => {
const { ref } = useParams()
const project = useSelectedProject()
const queryClient = useQueryClient()
const checkServerInterval = useRef<number>()
// TODO: move to react-query
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)
if (ref) await invalidateProjectDetailsQuery(queryClient, ref)
await invalidateProjectsQuery(queryClient)
}
}
}
useEffect(() => {
// check server status every 4s
checkServerInterval.current = window.setInterval(checkServer, 4000)
return () => {
clearInterval(checkServerInterval.current)
}
}, [])
if (project === undefined) return null
return (
<div className="mx-auto my-16 w-full max-w-7xl items-center justify-center">
<div className="mx-6 flex flex-col space-y-16">
<div className=" flex flex-col gap-4">
<div className="flex items-center space-x-3">
<h1 className="text-3xl text-foreground">{project?.name}</h1>
<Badge color="brand">
<div className="flex items-center gap-2">
<IconLoader className="animate-spin" size={12} />
<span>
{project.status === PROJECT_STATUS.UNKNOWN
? 'Initiating project set up'
: 'Setting up project'}
</span>
</div>
</Badge>
</div>
<div>
<p className="text-sm text-foreground-light">
{' '}
We are provisioning your database and API endpoints
</p>
<p className="text-sm text-foreground-light"> This may take a few minutes</p>
</div>
</div>
<div>
<div className=" grid grid-cols-12 gap-12">
<div className="col-span-12 space-y-12 lg:col-span-4">
<div>
<h4 className="text-base text-foreground">While you wait</h4>
<ChecklistItem
description={
<p className="text-sm text-foreground-light">
Browse the Supabase{' '}
<Link
href="https://supabase.com/docs"
className="mb-0 text-brand transition-colors hover:text-brand-600"
target="_blank"
rel="noreferrer"
>
documentation
</Link>
.
</p>
}
/>
</div>
<div>
<h4 className="text-base text-foreground">Not working?</h4>
<ChecklistItem
description={
<p className="text-sm text-foreground-light">
Try refreshing after a couple of minutes.
</p>
}
/>
<ul>
<ChecklistItem
description={
<>
<p className="mb-4 text-sm text-foreground-light">
If your dashboard hasn't connected within 2 minutes, you can open a
support ticket.
</p>
<Button asChild type="default">
<Link href="/support/new">Contact support team</Link>
</Button>
</>
}
/>
</ul>
</div>
</div>
<div className="col-span-12 lg:col-span-8">
<DisplayApiSettings />
<DisplayConfigSettings />
</div>
</div>
</div>
</div>
{project.status === PROJECT_STATUS.COMING_UP && (
<div className="mx-auto my-16 w-full max-w-7xl space-y-16">
<div className="space-y-8">
<div className="mx-6">
<h5>Client libraries</h5>
</div>
<div className="mx-6 mb-12 grid gap-12 md:grid-cols-3">
{CLIENT_LIBRARIES.map((library) => (
<ClientLibrary key={library.language} {...library} />
))}
</div>
</div>
<div className="space-y-8">
<div className="mx-6">
<h5>Example projects</h5>
</div>
<div className="mx-6 grid gap-8 md:grid-cols-2 lg:grid-cols-3">
{EXAMPLE_PROJECTS.map((project) => (
<ExampleProject key={project.url} {...project} />
))}
</div>
</div>
</div>
)}
</div>
)
}
export default BuildingState
const ChecklistItem = ({ description }: any) => {
return (
<li className="my-3 flex flex-wrap space-x-3">
<div className="mt-0.5">
<IconArrowRight className="text-foreground-lighter" size="tiny" />
</div>
<div className="flex-1">{description}</div>
</li>
)
}