onboarding.tsx 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. import styled from '@emotion/styled';
  2. import emptyStateImg from 'sentry-images/spot/performance-empty-state.svg';
  3. import tourAlert from 'sentry-images/spot/performance-tour-alert.svg';
  4. import tourCorrelate from 'sentry-images/spot/performance-tour-correlate.svg';
  5. import tourMetrics from 'sentry-images/spot/performance-tour-metrics.svg';
  6. import tourTrace from 'sentry-images/spot/performance-tour-trace.svg';
  7. import Button from 'app/components/button';
  8. import ButtonBar from 'app/components/buttonBar';
  9. import FeatureTourModal, {
  10. TourImage,
  11. TourStep,
  12. TourText,
  13. } from 'app/components/modals/featureTourModal';
  14. import OnboardingPanel from 'app/components/onboardingPanel';
  15. import {t} from 'app/locale';
  16. import {Organization} from 'app/types';
  17. import {trackAnalyticsEvent} from 'app/utils/analytics';
  18. const performanceSetupUrl =
  19. 'https://docs.sentry.io/performance-monitoring/getting-started/';
  20. const docsLink = (
  21. <Button external href={performanceSetupUrl}>
  22. {t('Setup')}
  23. </Button>
  24. );
  25. export const PERFORMANCE_TOUR_STEPS: TourStep[] = [
  26. {
  27. title: t('Track Application Metrics'),
  28. image: <TourImage src={tourMetrics} />,
  29. body: (
  30. <TourText>
  31. {t(
  32. 'Monitor your slowest pageloads and APIs to see which users are having the worst time.'
  33. )}
  34. </TourText>
  35. ),
  36. actions: docsLink,
  37. },
  38. {
  39. title: t('Correlate Errors and Performance'),
  40. image: <TourImage src={tourCorrelate} />,
  41. body: (
  42. <TourText>
  43. {t(
  44. 'See what errors occurred within a transaction and the impact of those errors.'
  45. )}
  46. </TourText>
  47. ),
  48. actions: docsLink,
  49. },
  50. {
  51. title: t('Watch and Alert'),
  52. image: <TourImage src={tourAlert} />,
  53. body: (
  54. <TourText>
  55. {t(
  56. 'Highlight mission-critical pages and APIs and set latency alerts to notify you before things go wrong.'
  57. )}
  58. </TourText>
  59. ),
  60. actions: docsLink,
  61. },
  62. {
  63. title: t('Trace Across Systems'),
  64. image: <TourImage src={tourTrace} />,
  65. body: (
  66. <TourText>
  67. {t(
  68. "Follow a trace from a user's session and drill down to identify any bottlenecks that occur."
  69. )}
  70. </TourText>
  71. ),
  72. },
  73. ];
  74. type Props = {
  75. organization: Organization;
  76. };
  77. function Onboarding({organization}: Props) {
  78. function handleAdvance(step: number, duration: number) {
  79. trackAnalyticsEvent({
  80. eventKey: 'performance_views.tour.advance',
  81. eventName: 'Performance Views: Tour Advance',
  82. organization_id: parseInt(organization.id, 10),
  83. step,
  84. duration,
  85. });
  86. }
  87. function handleClose(step: number, duration: number) {
  88. trackAnalyticsEvent({
  89. eventKey: 'performance_views.tour.close',
  90. eventName: 'Performance Views: Tour Close',
  91. organization_id: parseInt(organization.id, 10),
  92. step,
  93. duration,
  94. });
  95. }
  96. return (
  97. <OnboardingPanel image={<PerfImage src={emptyStateImg} />}>
  98. <h3>{t('Pinpoint problems')}</h3>
  99. <p>
  100. {t(
  101. 'Something seem slow? Track down transactions to connect the dots between 10-second page loads and poor-performing API calls or slow database queries.'
  102. )}
  103. </p>
  104. <ButtonList gap={1}>
  105. <Button
  106. priority="primary"
  107. target="_blank"
  108. href="https://docs.sentry.io/performance-monitoring/getting-started/"
  109. >
  110. {t('Start Setup')}
  111. </Button>
  112. <FeatureTourModal
  113. steps={PERFORMANCE_TOUR_STEPS}
  114. onAdvance={handleAdvance}
  115. onCloseModal={handleClose}
  116. doneUrl={performanceSetupUrl}
  117. doneText={t('Start Setup')}
  118. >
  119. {({showModal}) => (
  120. <Button
  121. priority="default"
  122. onClick={() => {
  123. trackAnalyticsEvent({
  124. eventKey: 'performance_views.tour.start',
  125. eventName: 'Performance Views: Tour Start',
  126. organization_id: parseInt(organization.id, 10),
  127. });
  128. showModal();
  129. }}
  130. >
  131. {t('Take a Tour')}
  132. </Button>
  133. )}
  134. </FeatureTourModal>
  135. </ButtonList>
  136. </OnboardingPanel>
  137. );
  138. }
  139. const PerfImage = styled('img')`
  140. @media (min-width: ${p => p.theme.breakpoints[0]}) {
  141. max-width: unset;
  142. user-select: none;
  143. position: absolute;
  144. top: 50px;
  145. bottom: 0;
  146. width: 450px;
  147. margin-top: auto;
  148. margin-bottom: auto;
  149. }
  150. @media (min-width: ${p => p.theme.breakpoints[1]}) {
  151. width: 480px;
  152. }
  153. @media (min-width: ${p => p.theme.breakpoints[2]}) {
  154. width: 600px;
  155. }
  156. `;
  157. const ButtonList = styled(ButtonBar)`
  158. grid-template-columns: repeat(auto-fit, minmax(130px, max-content));
  159. `;
  160. export default Onboarding;