OrgNotFound.tsx 1.9 KB

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