missingReleasesButtons.tsx 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import {Button} from 'sentry/components/button';
  2. import ButtonBar from 'sentry/components/buttonBar';
  3. import FeatureTourModal from 'sentry/components/modals/featureTourModal';
  4. import {t} from 'sentry/locale';
  5. import {Organization} from 'sentry/types';
  6. import {trackAnalytics} from 'sentry/utils/analytics';
  7. import {RELEASES_TOUR_STEPS} from 'sentry/views/releases/list/releasesPromo';
  8. const DOCS_URL = 'https://docs.sentry.io/product/releases/';
  9. const DOCS_HEALTH_URL = 'https://docs.sentry.io/product/releases/health/';
  10. type Props = {
  11. organization: Organization;
  12. health?: boolean;
  13. projectId?: string;
  14. };
  15. function MissingReleasesButtons({organization, health, projectId}: Props) {
  16. function handleTourAdvance(step: number, duration: number) {
  17. trackAnalytics('project_detail.releases_tour.advance', {
  18. organization,
  19. project_id: projectId ?? '',
  20. step,
  21. duration,
  22. });
  23. }
  24. function handleClose(step: number, duration: number) {
  25. trackAnalytics('project_detail.releases_tour.close', {
  26. organization,
  27. project_id: projectId ?? '',
  28. step,
  29. duration,
  30. });
  31. }
  32. return (
  33. <ButtonBar gap={1}>
  34. <Button
  35. size="sm"
  36. priority="primary"
  37. external
  38. href={health ? DOCS_HEALTH_URL : DOCS_URL}
  39. >
  40. {t('Start Setup')}
  41. </Button>
  42. {!health && (
  43. <FeatureTourModal
  44. steps={RELEASES_TOUR_STEPS}
  45. onAdvance={handleTourAdvance}
  46. onCloseModal={handleClose}
  47. doneText={t('Start Setup')}
  48. doneUrl={health ? DOCS_HEALTH_URL : DOCS_URL}
  49. >
  50. {({showModal}) => (
  51. <Button size="sm" onClick={showModal}>
  52. {t('Get Tour')}
  53. </Button>
  54. )}
  55. </FeatureTourModal>
  56. )}
  57. </ButtonBar>
  58. );
  59. }
  60. export default MissingReleasesButtons;