IntegrationsSettings.tsx 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import { Admonition } from 'ui-patterns'
  2. import { AWSPrivateLinkSection } from './AWSPrivateLink/AWSPrivateLinkSection'
  3. import { GitHubSection } from './GithubIntegration/GithubSection'
  4. import { VercelSection } from './VercelIntegration/VercelSection'
  5. import { SidePanelVercelProjectLinker } from '@/components/interfaces/Organization/IntegrationSettings/SidePanelVercelProjectLinker'
  6. import { ScaffoldContainer, ScaffoldDivider } from '@/components/layouts/Scaffold'
  7. import { InlineLink } from '@/components/ui/InlineLink'
  8. import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled'
  9. import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
  10. import { BASE_PATH } from '@/lib/constants'
  11. export const IntegrationImageHandler = ({ title }: { title: 'vercel' | 'github' | 'aws' }) => {
  12. return (
  13. <img
  14. className="border rounded-lg shadow-sm w-full sm:w-48 mt-6 border-body"
  15. src={`${BASE_PATH}/img/integrations/covers/${title}-cover.png`}
  16. alt={`${title} cover`}
  17. />
  18. )
  19. }
  20. export const IntegrationSettings = () => {
  21. const { data: project } = useSelectedProjectQuery()
  22. const isBranch = project?.parent_project_ref !== undefined
  23. const showVercelIntegration = useIsFeatureEnabled('integrations:vercel')
  24. const showAWSPrivateLinkFeature = useIsFeatureEnabled('integrations:aws_private_link')
  25. // PrivateLink is not available in eu-central-2 (Zurich) until Feb 2026
  26. const isPrivateLinkUnsupportedRegion = project?.region === 'eu-central-2'
  27. const showAWSPrivateLink = showAWSPrivateLinkFeature && !isPrivateLinkUnsupportedRegion
  28. return (
  29. <>
  30. {isBranch && (
  31. <ScaffoldContainer>
  32. <Admonition
  33. type="default"
  34. className="mt-6"
  35. title="You are currently on a preview branch of your project"
  36. >
  37. To adjust your project's integration settings, you may return to your{' '}
  38. <InlineLink href={`/project/${project.parent_project_ref}/settings/integrations`}>
  39. main branch
  40. </InlineLink>
  41. .
  42. </Admonition>
  43. </ScaffoldContainer>
  44. )}
  45. <GitHubSection />
  46. {showVercelIntegration && (
  47. <>
  48. <ScaffoldDivider />
  49. <VercelSection isProjectScoped={true} />
  50. <SidePanelVercelProjectLinker />
  51. </>
  52. )}
  53. {showAWSPrivateLink && (
  54. <>
  55. <ScaffoldDivider />
  56. <AWSPrivateLinkSection />
  57. </>
  58. )}
  59. </>
  60. )
  61. }