banner.tsx 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. import tourAlert from 'sentry-images/spot/discover-tour-alert.svg';
  2. import tourExplore from 'sentry-images/spot/discover-tour-explore.svg';
  3. import tourFilter from 'sentry-images/spot/discover-tour-filter.svg';
  4. import tourGroup from 'sentry-images/spot/discover-tour-group.svg';
  5. import Banner from 'app/components/banner';
  6. import Button from 'app/components/button';
  7. import FeatureTourModal, {
  8. TourImage,
  9. TourStep,
  10. TourText,
  11. } from 'app/components/modals/featureTourModal';
  12. import {t} from 'app/locale';
  13. import {Organization} from 'app/types';
  14. import {trackAnalyticsEvent} from 'app/utils/analytics';
  15. import BackgroundSpace from './backgroundSpace';
  16. const docsUrl = 'https://docs.sentry.io/product/discover-queries/';
  17. const docsLink = (
  18. <Button external href={docsUrl}>
  19. {t('View Docs')}
  20. </Button>
  21. );
  22. const TOUR_STEPS: TourStep[] = [
  23. {
  24. title: t('Explore Data over Time'),
  25. image: <TourImage src={tourExplore} />,
  26. body: (
  27. <TourText>
  28. {t(
  29. 'Analyze and visualize all of your data over time to find answers to your most complex problems.'
  30. )}
  31. </TourText>
  32. ),
  33. actions: docsLink,
  34. },
  35. {
  36. title: t('Filter on Event Attributes.'),
  37. image: <TourImage src={tourFilter} />,
  38. body: (
  39. <TourText>
  40. {t(
  41. 'Drill down on data by any custom tag or field to reduce noise and hone in on specific areas.'
  42. )}
  43. </TourText>
  44. ),
  45. actions: docsLink,
  46. },
  47. {
  48. title: t('Group Data by Tags'),
  49. image: <TourImage src={tourGroup} />,
  50. body: (
  51. <TourText>
  52. {t(
  53. 'Go beyond Issues and create custom groupings to investigate events from a different lens.'
  54. )}
  55. </TourText>
  56. ),
  57. actions: docsLink,
  58. },
  59. {
  60. title: t('Save, Share and Alert'),
  61. image: <TourImage src={tourAlert} />,
  62. body: (
  63. <TourText>
  64. {t('Send insights to your team and set alerts to monitor any future spikes.')}
  65. </TourText>
  66. ),
  67. },
  68. ];
  69. type Props = {
  70. organization: Organization;
  71. resultsUrl: string;
  72. isSmallBanner: boolean;
  73. onHideBanner: () => void;
  74. };
  75. function DiscoverBanner({organization, resultsUrl, isSmallBanner, onHideBanner}: Props) {
  76. function onAdvance(step: number, duration: number) {
  77. trackAnalyticsEvent({
  78. eventKey: 'discover_v2.tour.advance',
  79. eventName: 'Discoverv2: Tour Advance',
  80. organization_id: parseInt(organization.id, 10),
  81. step,
  82. duration,
  83. });
  84. }
  85. function onCloseModal(step: number, duration: number) {
  86. trackAnalyticsEvent({
  87. eventKey: 'discover_v2.tour.close',
  88. eventName: 'Discoverv2: Tour Close',
  89. organization_id: parseInt(organization.id, 10),
  90. step,
  91. duration,
  92. });
  93. }
  94. return (
  95. <Banner
  96. title={t('Discover Trends')}
  97. subtitle={t(
  98. 'Customize and save queries by search conditions, event fields, and tags'
  99. )}
  100. backgroundComponent={<BackgroundSpace />}
  101. onCloseClick={onHideBanner}
  102. >
  103. <Button
  104. size={isSmallBanner ? 'xsmall' : undefined}
  105. to={resultsUrl}
  106. onClick={() => {
  107. trackAnalyticsEvent({
  108. eventKey: 'discover_v2.build_new_query',
  109. eventName: 'Discoverv2: Build a new Discover Query',
  110. organization_id: parseInt(organization.id, 10),
  111. });
  112. }}
  113. >
  114. {t('Build a new query')}
  115. </Button>
  116. <FeatureTourModal
  117. steps={TOUR_STEPS}
  118. doneText={t('View all Events')}
  119. doneUrl={resultsUrl}
  120. onAdvance={onAdvance}
  121. onCloseModal={onCloseModal}
  122. >
  123. {({showModal}) => (
  124. <Button
  125. size={isSmallBanner ? 'xsmall' : undefined}
  126. onClick={() => {
  127. trackAnalyticsEvent({
  128. eventKey: 'discover_v2.tour.start',
  129. eventName: 'Discoverv2: Tour Start',
  130. organization_id: parseInt(organization.id, 10),
  131. });
  132. showModal();
  133. }}
  134. >
  135. {t('Get a Tour')}
  136. </Button>
  137. )}
  138. </FeatureTourModal>
  139. </Banner>
  140. );
  141. }
  142. export default DiscoverBanner;