InstalledIntegrations.tsx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { IntegrationCard, IntegrationLoadingCard } from './IntegrationCard'
  2. import { useInstalledIntegrations } from './useInstalledIntegrations'
  3. import AlertError from '@/components/ui/AlertError'
  4. export const InstalledIntegrations = () => {
  5. const { installedIntegrations, error, isLoading, isSuccess, isError } = useInstalledIntegrations()
  6. return (
  7. <div className="px-4 md:px-10 py-6 flex flex-col gap-y-5">
  8. <h2>Installed integrations</h2>
  9. <div className="grid xl:grid-cols-3 2xl:grid-cols-4 gap-x-4 gap-y-3">
  10. {isLoading &&
  11. new Array(3)
  12. .fill(0)
  13. .map((_, idx) => <IntegrationLoadingCard key={`integration-loading-${idx}`} />)}
  14. {isError && (
  15. <AlertError
  16. className="xl:col-span-3 2xl:col-span-4"
  17. subject="Failed to retrieve installed integrations"
  18. error={error}
  19. />
  20. )}
  21. {isSuccess && (
  22. <>
  23. {installedIntegrations.length === 0 ? (
  24. <div className="xl:col-span-3 2xl:col-span-4 w-full h-[110px] border rounded-sm flex items-center justify-center">
  25. {/* [Joshen] Not high priority imo - very low chance this state will be seen cause Vault is always installed */}
  26. {/* Some placeholder image when no integrations are installed */}
  27. <p className="text-sm text-foreground-light">No integrations installed yet</p>
  28. </div>
  29. ) : (
  30. installedIntegrations.map((i) => <IntegrationCard key={i.id} {...i} />)
  31. )}
  32. </>
  33. )}
  34. </div>
  35. </div>
  36. )
  37. }