organizationRegionAction.tsx 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import styled from '@emotion/styled';
  2. import FieldHelp from 'sentry/components/forms/fieldGroup/fieldHelp';
  3. import {t} from 'sentry/locale';
  4. import {space} from 'sentry/styles/space';
  5. import type {Organization} from 'sentry/types';
  6. import {getRegionDataFromOrganization, shouldDisplayRegions} from 'sentry/utils/regions';
  7. import {DATA_STORAGE_DOCS_LINK} from 'sentry/views/organizationCreate';
  8. type Props = {
  9. organization?: Organization;
  10. };
  11. const OrganizationRegionInformationWrapper = styled('div')`
  12. margin-top: ${space(2)};
  13. text-align: end;
  14. `;
  15. const OrganizationFlag = styled('span')`
  16. font-size: ${p => p.theme.fontSizeLarge};
  17. `;
  18. export function OrganizationRegionAction({organization, ...props}: Props) {
  19. if (!organization || !shouldDisplayRegions()) {
  20. return null;
  21. }
  22. const regionData = getRegionDataFromOrganization(organization);
  23. if (!regionData) {
  24. return null;
  25. }
  26. return (
  27. <OrganizationRegionInformationWrapper {...props}>
  28. <div>
  29. {`${regionData.displayName} `}
  30. <OrganizationFlag>{regionData.flag}</OrganizationFlag>
  31. </div>
  32. <FieldHelp>
  33. {t("Your organization's data storage location. ")}
  34. <a href={DATA_STORAGE_DOCS_LINK}>{t('Learn More')}</a>
  35. </FieldHelp>
  36. </OrganizationRegionInformationWrapper>
  37. );
  38. }