exampleIntegrationButton.tsx 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import type {ButtonProps} from 'sentry/components/button';
  2. import {Button} from 'sentry/components/button';
  3. import {IconGithub} from 'sentry/icons';
  4. import {t} from 'sentry/locale';
  5. import type {Organization} from 'sentry/types/organization';
  6. import type {IntegrationView} from 'sentry/utils/analytics/integrations';
  7. import {
  8. platformEventLinkMap,
  9. PlatformEvents,
  10. } from 'sentry/utils/analytics/integrations/platformAnalyticsEvents';
  11. import {trackIntegrationAnalytics} from 'sentry/utils/integrationUtil';
  12. import withOrganization from 'sentry/utils/withOrganization';
  13. type ExampleIntegrationButtonProps = {
  14. analyticsView: IntegrationView['view'];
  15. organization: Organization;
  16. } & ButtonProps;
  17. /**
  18. * Button to direct users to the Example App repository
  19. */
  20. function ExampleIntegrationButton({
  21. organization,
  22. analyticsView,
  23. ...buttonProps
  24. }: ExampleIntegrationButtonProps) {
  25. return (
  26. <Button
  27. size="sm"
  28. external
  29. href={platformEventLinkMap[PlatformEvents.EXAMPLE_SOURCE]}
  30. onClick={() => {
  31. trackIntegrationAnalytics(PlatformEvents.EXAMPLE_SOURCE, {
  32. organization,
  33. view: analyticsView,
  34. });
  35. }}
  36. icon={<IconGithub />}
  37. {...buttonProps}
  38. >
  39. {t('View Example App')}
  40. </Button>
  41. );
  42. }
  43. export default withOrganization(ExampleIntegrationButton);