Skip to content

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

Improve loading UX for orgs

Joshen Lim2c38185545c2
diff --git a/studio/components/interfaces/Home/ProjectList/ProjectList.tsx b/studio/components/interfaces/Home/ProjectList/ProjectList.tsx
index db63585245f..ca96483e6e7 100644
--- a/studio/components/interfaces/Home/ProjectList/ProjectList.tsx
+++ b/studio/components/interfaces/Home/ProjectList/ProjectList.tsx
@@ -1,5 +1,5 @@
import { FC } from 'react'
-import { Button, IconPlus, Loading } from '@supabase/ui'
+import { Button, IconLoader, IconPlus, Loading } from '@supabase/ui'
import { useRouter } from 'next/router'
import { observer } from 'mobx-react-lite'
@@ -23,7 +23,7 @@ const ProjectList: FC<Props> = ({
const router = useRouter()
const { app } = useStore()
const { organizations, projects } = app
- const { isLoading } = projects
+ const { isLoading: isLoadingProjects } = projects
return (
<>
@@ -36,9 +36,9 @@ const ProjectList: FC<Props> = ({
return (
<div className="space-y-3" key={makeRandomString(5)}>
<h4 className="text-lg">{name}</h4>
- <Loading active={isLoading}>
+ <Loading active={isLoadingProjects}>
<ul className="grid gap-4 mx-auto grid-cols-1 sm:grid-cols-1 md:grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 ">
- {!isLoading && isEmpty && (
+ {!isLoadingProjects && isEmpty && (
<div className="max-w-4xl text-center col-span-4 space-y-4 border-2 border-gray-300 border-dashed rounded-lg p-6">
<div className="space-y-1">
<p>No projects</p>
diff --git a/studio/pages/index.tsx b/studio/pages/index.tsx
index 82813127134..46ddf306367 100644
--- a/studio/pages/index.tsx
+++ b/studio/pages/index.tsx
@@ -7,15 +7,16 @@ import { Typography } from '@supabase/ui'
import { Project } from 'types'
import { useStore, withAuth } from 'hooks'
+import { auth } from 'lib/gotrue'
import { post, delete_ } from 'lib/common/fetch'
import { API_URL, IS_PLATFORM, PROJECT_STATUS } from 'lib/constants'
+
+import Connecting from 'components/ui/Loading'
import { AccountLayout } from 'components/layouts'
-import { auth } from 'lib/gotrue'
import Landing from 'components/interfaces/Home/Landing'
import ProjectList from 'components/interfaces/Home/ProjectList'
import OrganizationDropdown from 'components/to-be-cleaned/Dropdown/OrganizationDropdown'
import TextConfirmModal from 'components/to-be-cleaned/ModalsDeprecated/TextConfirmModal'
-import Connecting from 'components/ui/Loading'
const Home: NextPage = () => {
const { app, ui } = useStore()
@@ -88,20 +89,29 @@ const Home: NextPage = () => {
},
]}
>
- <div className="p-4">
- {IS_PLATFORM && (
- <div className="my-2">
- <div className="flex">
- <div className="">
- <OrganizationDropdown organizations={app.organizations} />
+ {app.organizations.isLoading ? (
+ <div className="flex h-full items-center justify-center space-x-2">
+ <Connecting />
+ </div>
+ ) : (
+ <div className="p-4">
+ {IS_PLATFORM && (
+ <div className="my-2">
+ <div className="flex">
+ <div className="">
+ <OrganizationDropdown organizations={app.organizations} />
+ </div>
</div>
</div>
+ )}
+ <div className="my-8 space-y-8">
+ <ProjectList
+ onSelectDelete={onSelectDeleteProject}
+ onSelectRestore={onRestoreProject}
+ />
</div>
- )}
- <div className="my-8 space-y-8">
- <ProjectList onSelectDelete={onSelectDeleteProject} onSelectRestore={onRestoreProject} />
</div>
- </div>
+ )}
<TextConfirmModal
visible={!isUndefined(selectedProjectToDelete)}
title="Are you absolutely sure?"