OrgNotFound.tsx62 lines · main
1import { Skeleton } from 'ui'
2import { Admonition } from 'ui-patterns/admonition'
3
4import { OrganizationCard } from './OrganizationCard'
5import { useOrganizationsQuery } from '@/data/organizations/organizations-query'
6
7export const OrgNotFound = ({ slug }: { slug?: string }) => {
8 const {
9 data: organizations,
10 isSuccess: isOrganizationsSuccess,
11 isPending: isOrganizationsLoading,
12 isError: isOrganizationsError,
13 error: organizationsError,
14 } = useOrganizationsQuery()
15
16 return (
17 <>
18 {slug !== '_' && (
19 <Admonition
20 type="destructive"
21 title="Organization not found"
22 description={
23 <>
24 {slug ? (
25 <>
26 The organization <code className="text-code-inline">{slug}</code>{' '}
27 </>
28 ) : (
29 <>This organization </>
30 )}
31 does not exist or you do not have permission to access to it. Contact the the owner if
32 you believe this is a mistake.
33 </>
34 }
35 />
36 )}
37
38 <h3 className="text-sm">Select a different organization to create your new project in</h3>
39
40 <div className="grid gap-2 grid-cols-2">
41 {isOrganizationsLoading && (
42 <>
43 <Skeleton className="h-[62px] rounded-md" />
44 <Skeleton className="h-[62px] rounded-md" />
45 <Skeleton className="h-[62px] rounded-md" />
46 </>
47 )}
48 {isOrganizationsError && (
49 <Admonition
50 type="destructive"
51 title="Failed to load organizations"
52 description={organizationsError?.message}
53 />
54 )}
55 {isOrganizationsSuccess &&
56 organizations?.map((org) => (
57 <OrganizationCard key={org.slug} organization={org} href={`/new/${org.slug}`} />
58 ))}
59 </div>
60 </>
61 )
62}