Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Improve connecting state CTAs

Joshen Lime491439dbe28
diff --git a/studio/components/layouts/ProjectLayout/ConnectingState.tsx b/studio/components/layouts/ProjectLayout/ConnectingState.tsx
index f9da7b84d57..4068150d9e6 100644
--- a/studio/components/layouts/ProjectLayout/ConnectingState.tsx
+++ b/studio/components/layouts/ProjectLayout/ConnectingState.tsx
@@ -1,7 +1,8 @@
import { useQueryClient } from '@tanstack/react-query'
+import { useParams } from 'common'
import Link from 'next/link'
-import { useEffect, useRef, useState } from 'react'
-import { Badge, Button, IconLoader, IconMonitor, IconServer, Modal } from 'ui'
+import { useEffect, useRef } from 'react'
+import { Badge, Button, IconExternalLink, IconLoader, IconMonitor, IconServer } from 'ui'
import ShimmerLine from 'components/ui/ShimmerLine'
import { setProjectPostgrestStatus } from 'data/projects/projects-query'
@@ -13,18 +14,10 @@ export interface ConnectingStateProps {
}
const ConnectingState = ({ project }: ConnectingStateProps) => {
+ const { ref } = useParams()
const queryClient = useQueryClient()
const checkProjectConnectionIntervalRef = useRef<number>()
- const [showHelperButton, setShowHelperButton] = useState(false)
- const [showModal, setShowModal] = useState(false)
-
- // Show helper button if still connecting after 30 seconds
- useEffect(() => {
- const timer = setTimeout(() => setShowHelperButton(true), 30000)
- return () => clearTimeout(timer)
- }, [])
-
useEffect(() => {
if (!project.restUrl) return
@@ -60,86 +53,51 @@ const ConnectingState = ({ project }: ConnectingStateProps) => {
</div>
</div>
<div className="flex h-[500px] items-center justify-center rounded border border-scale-400 bg-scale-300 p-8">
- <div className="w-[420px] space-y-4">
- <div className="mx-auto flex max-w-[300px] items-center justify-center space-x-4 lg:space-x-8">
- <IconMonitor className="text-scale-1100" size={50} strokeWidth={1.5} />
+ <div className="w-[440px] space-y-4">
+ <div className="mx-auto flex max-w-[300px] items-center justify-center">
+ <div>
+ <div className="flex items-center justify-center w-12 h-12 rounded-md border">
+ <IconMonitor className="text-scale-1100" size={30} strokeWidth={1.5} />
+ </div>
+ </div>
<ShimmerLine active />
- <IconServer className="text-scale-1100" size={50} strokeWidth={1.5} />
+ <div>
+ <div className="flex items-center justify-center w-12 h-12 rounded-md border">
+ <IconServer className="text-scale-1100" size={30} strokeWidth={1.5} />
+ </div>
+ </div>
</div>
<div className="space-y-1">
<p className="text-center">Connecting to {project.name}</p>
- <p
- className="cursor-pointer text-center text-sm text-scale-1100 opacity-60 transition hover:opacity-100"
- onClick={() => setShowModal(true)}
- >
- This may take a few minutes
+ <p className="text-center text-sm text-light">
+ If you are unable to connect after a few minutes, check your project's health to
+ verify if it's running into any resource constraints.
</p>
</div>
- <div className="flex flex-col items-center">
- {showHelperButton && (
- <Button type="default" onClick={() => setShowModal(true)}>
- Still connecting?
- </Button>
- )}
+ <div className="flex items-center justify-center space-x-2">
+ <Link href={`/project/${ref}/settings/infrastructure`}>
+ <a>
+ <Button type="default">Check database health</Button>
+ </a>
+ </Link>
+ <Link
+ href={
+ 'https://supabase.com/docs/guides/platform/troubleshooting#unable-to-connect-to-your-supabase-project'
+ }
+ >
+ <a className="translate-y-[1px]">
+ <Button type="default" icon={<IconExternalLink strokeWidth={1.5} />}>
+ Troubleshooting
+ </Button>
+ </a>
+ </Link>
</div>
</div>
</div>
</div>
</div>
- <Modal
- visible={showModal}
- onCancel={() => setShowModal(false)}
- header={
- <div className="flex items-baseline gap-2">
- <h5 className="text-sm text-scale-1200">Checking the health of your database</h5>
- </div>
- }
- size="medium"
- hideFooter
- closable
- >
- <div className="py-4">
- <Modal.Content>
- <div className="space-y-4">
- <p className="text-sm text-scale-1200">
- Your project might be facing resource constraints and hence is having trouble
- connecting. You can verify this by checking your{' '}
- <span className="text-brand-600">
- <Link href={`/project/${project.ref}/settings/database`}>
- <a>database's health</a>
- </Link>
- </span>{' '}
- or your remaining daily disk IO budget via a{' '}
- <span className="text-brand-600">
- <Link href={`/project/${project.ref}/reports`}>
- <a>customizable project report</a>
- </Link>
- </span>
- .
- </p>
- <p className="text-sm text-scale-1200">
- If your project is facing resource constraints, you can{' '}
- <span className="text-brand-600">
- <Link href={`/project/${project.ref}/reports`}>
- <a>upgrade</a>
- </Link>
- </span>{' '}
- your project's subscription to a Pro for access to larger compute sizes.
- </p>
- <p className="text-sm text-scale-1200">
- However, if your project still fails to connect thereafter, you can open a support
- ticket{' '}
- <span className="text-brand-600">
- <Link href={`/support/new?ref=${project.ref}`}>here</Link>
- </span>
- .
- </p>
- </div>
- </Modal.Content>
- </div>
- </Modal>
</>
)
}