organizationRegionAction.tsx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 {Organization} from 'sentry/types';
  6. import {getRegionDataFromOrganization, shouldDisplayRegions} from 'sentry/utils/regions';
  7. type Props = {
  8. organization?: Organization;
  9. };
  10. const OrganizationRegionInformationWrapper = styled('div')`
  11. margin-top: ${space(2)};
  12. text-align: end;
  13. `;
  14. const OrganizationFlag = styled('span')`
  15. font-size: ${p => p.theme.fontSizeLarge};
  16. `;
  17. export function OrganizationRegionAction({organization, ...props}: Props) {
  18. if (!organization || !shouldDisplayRegions()) {
  19. return null;
  20. }
  21. const regionData = getRegionDataFromOrganization(organization);
  22. if (!regionData) {
  23. return null;
  24. }
  25. return (
  26. <OrganizationRegionInformationWrapper {...props}>
  27. <div>
  28. {`${regionData.displayName} `}
  29. <OrganizationFlag>{regionData.flag}</OrganizationFlag>
  30. </div>
  31. <FieldHelp>
  32. {t("Your organization's data storage location. ")}
  33. <a href="https://docs.sentry.io/product/accounts/choose-your-data-center">
  34. {t('Learn More')}
  35. </a>
  36. </FieldHelp>
  37. </OrganizationRegionInformationWrapper>
  38. );
  39. }