exampleIntegrationButton.tsx 1.2 KB

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