missingExampleWarning.tsx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import {Alert} from 'sentry/components/alert';
  2. import ExternalLink from 'sentry/components/links/externalLink';
  3. import platforms from 'sentry/data/platforms';
  4. import {tct} from 'sentry/locale';
  5. import type {PlatformKey} from 'sentry/types';
  6. import type {OnboardingPlatformDoc} from 'sentry/types/onboarding';
  7. /**
  8. * The documentation will include the following string should it be missing the
  9. * verification example, which currently a lot of docs are.
  10. */
  11. const INCOMPLETE_DOC_FLAG = 'TODO-ADD-VERIFICATION-EXAMPLE';
  12. export function MissingExampleWarning({
  13. platformDocs,
  14. platform,
  15. }: {
  16. platform: PlatformKey | null;
  17. platformDocs: OnboardingPlatformDoc | null;
  18. }) {
  19. const missingExample = platformDocs?.html.includes(INCOMPLETE_DOC_FLAG);
  20. if (!missingExample) {
  21. return null;
  22. }
  23. return (
  24. <Alert type="warning" showIcon>
  25. {tct(
  26. `Looks like this getting started example is still undergoing some
  27. work and doesn't include an example for triggering an event quite
  28. yet. If you have trouble sending your first event be sure to consult
  29. the [docsLink:full documentation] for [platform].`,
  30. {
  31. docsLink: <ExternalLink href={platformDocs?.link} />,
  32. platform: platforms.find(p => p.id === platform)?.name,
  33. }
  34. )}
  35. </Alert>
  36. );
  37. }