Files
supabase/apps/studio/components/interfaces/Organization/OrgNotFound.tsx
Ivan Vasilov 2bec311971 fix: Make the database.new redirect work (#37370)
* Add a special case for /new/last-visited-org

* Handle the case where last visited org is null. Don't show an admonition if the org slug is _.

* Smol fix to disable oauth apps request if slug is _, and also dont prematurely show no perms UI state

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-07-23 15:06:53 +08:00

53 lines
1.7 KiB
TypeScript

import AlertError from 'components/ui/AlertError'
import { useOrganizationsQuery } from 'data/organizations/organizations-query'
import { Skeleton } from 'ui'
import { Admonition } from 'ui-patterns/admonition'
import { OrganizationCard } from './OrganizationCard'
export const OrgNotFound = ({ slug }: { slug?: string }) => {
const {
data: organizations,
isSuccess: isOrganizationsSuccess,
isLoading: isOrganizationsLoading,
isError: isOrganizationsError,
error: organizationsError,
} = useOrganizationsQuery()
return (
<>
{slug !== '_' && (
<Admonition type="danger">
The selected organization does not exist or you don't have permission to access it.{' '}
{slug ? (
<>
Contact the owner or administrator to create a new project in the <code>{slug}</code>{' '}
organization.
</>
) : (
<>Contact the owner or administrator to create a new project.</>
)}
</Admonition>
)}
<h3 className="text-sm">Select an organization to create your new project from</h3>
<div className="grid gap-2 grid-cols-2">
{isOrganizationsLoading && (
<>
<Skeleton className="h-[62px] rounded-md" />
<Skeleton className="h-[62px] rounded-md" />
<Skeleton className="h-[62px] rounded-md" />
</>
)}
{isOrganizationsError && (
<AlertError error={organizationsError} subject="Failed to load organizations" />
)}
{isOrganizationsSuccess &&
organizations?.map((org) => (
<OrganizationCard key={org.slug} organization={org} href={`/new/${org.slug}`} />
))}
</div>
</>
)
}