RegionLimitation.tsx 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import { VectorBucket } from 'icons'
  2. import { AWS_REGIONS } from 'shared-data'
  3. import { Tooltip, TooltipContent, TooltipTrigger } from 'ui'
  4. import {
  5. EmptyStatePresentational,
  6. PageContainer,
  7. PageSection,
  8. PageSectionContent,
  9. } from 'ui-patterns'
  10. import { AVAILABLE_REPLICA_REGIONS } from '@/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.constants'
  11. import { AlphaNotice } from '@/components/ui/AlphaNotice'
  12. import { InlineLinkClassName } from '@/components/ui/InlineLink'
  13. import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
  14. export const VECTOR_BUCKETS_AVAILABLE_REGIONS = [
  15. 'us-east-1',
  16. 'us-east-2',
  17. 'us-west-2',
  18. 'eu-central-1',
  19. 'ap-southeast-2',
  20. ]
  21. const getRegionNameFromCode = (code: string) =>
  22. Object.values(AWS_REGIONS).find((x) => x.code === code)?.displayName
  23. export const RegionLimitation = () => {
  24. const { data: project } = useSelectedProjectQuery()
  25. const regionLabel = AVAILABLE_REPLICA_REGIONS.find((region) =>
  26. project?.region?.includes(region.region)
  27. )
  28. return (
  29. <PageContainer>
  30. <PageSection>
  31. <PageSectionContent className="flex flex-col gap-y-8">
  32. <AlphaNotice
  33. entity="Vector buckets"
  34. feedbackUrl="https://github.com/orgs/briven/discussions/40815"
  35. />
  36. <EmptyStatePresentational
  37. icon={VectorBucket}
  38. className="[&>div>div>h3]:flex [&>div>div>h3]:items-center [&>div>div>h3]:gap-x-2"
  39. title="Coming soon to your project's region"
  40. description={
  41. <>
  42. Your project is in{' '}
  43. <Tooltip>
  44. <TooltipTrigger className={InlineLinkClassName}>
  45. {regionLabel?.name}
  46. </TooltipTrigger>
  47. <TooltipContent side="bottom">{regionLabel?.region}</TooltipContent>
  48. </Tooltip>
  49. , but Vector buckets are only available for{' '}
  50. <Tooltip>
  51. <TooltipTrigger className={InlineLinkClassName}>certain regions</TooltipTrigger>
  52. <TooltipContent side="bottom">
  53. <ul>
  54. {VECTOR_BUCKETS_AVAILABLE_REGIONS.map((x) => (
  55. <li key={x}>
  56. <span>{getRegionNameFromCode(x)}</span>
  57. <span className="text-foreground-light ml-2">{x}</span>
  58. </li>
  59. ))}
  60. </ul>
  61. </TooltipContent>
  62. </Tooltip>
  63. . We're actively looking to expand that soon.
  64. </>
  65. }
  66. />
  67. </PageSectionContent>
  68. </PageSection>
  69. </PageContainer>
  70. )
  71. }