metricsApiChangeAlert.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import Alert from 'sentry/components/alert';
  2. import {Button} from 'sentry/components/button';
  3. import ExternalLink from 'sentry/components/links/externalLink';
  4. import {IconClose} from 'sentry/icons/iconClose';
  5. import {t, tct} from 'sentry/locale';
  6. import useDismissAlert from 'sentry/utils/useDismissAlert';
  7. const LOCAL_STORAGE_KEY = 'custom-metrics-sdk-api-change-alert-dismissed';
  8. export function MetricsApiChangeAlert() {
  9. const {isDismissed, dismiss} = useDismissAlert({
  10. key: LOCAL_STORAGE_KEY,
  11. });
  12. if (isDismissed) {
  13. return null;
  14. }
  15. return (
  16. <Alert
  17. type="warning"
  18. showIcon
  19. trailingItems={
  20. <Button
  21. aria-label={t('Dismiss banner')}
  22. icon={<IconClose />}
  23. onClick={dismiss}
  24. size="zero"
  25. borderless
  26. />
  27. }
  28. >
  29. {tct(
  30. 'There are upcoming changes to the Metrics API that may affect your usage. Read the [link:FAQs] for more details.',
  31. {
  32. link: (
  33. <ExternalLink href="https://sentry.zendesk.com/hc/en-us/articles/26369339769883-Upcoming-API-Changes-to-Metrics" />
  34. ),
  35. }
  36. )}
  37. </Alert>
  38. );
  39. }