replayOnboardingPanel.tsx 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import styled from '@emotion/styled';
  2. import emptyStateImg from 'sentry-images/spot/replays-empty-state.svg';
  3. import ButtonBar from 'sentry/components/buttonBar';
  4. import OnboardingPanel from 'sentry/components/onboardingPanel';
  5. import {t} from 'sentry/locale';
  6. import PreferencesStore from 'sentry/stores/preferencesStore';
  7. import {useLegacyStore} from 'sentry/stores/useLegacyStore';
  8. interface Props {
  9. children?: React.ReactNode;
  10. }
  11. type Breakpoints = {
  12. large: string;
  13. medium: string;
  14. small: string;
  15. xlarge: string;
  16. };
  17. export default function ReplayOnboardingPanel(props: Props) {
  18. const preferences = useLegacyStore(PreferencesStore);
  19. const breakpoints = preferences.collapsed
  20. ? {
  21. small: '800px',
  22. medium: '992px',
  23. large: '1210px',
  24. xlarge: '1450px',
  25. }
  26. : {
  27. small: '800px',
  28. medium: '1175px',
  29. large: '1375px',
  30. xlarge: '1450px',
  31. };
  32. return (
  33. <OnboardingPanel image={<HeroImage src={emptyStateImg} breakpoints={breakpoints} />}>
  34. <h3>{t('Get to the root cause faster')}</h3>
  35. <p>
  36. {t(
  37. 'See a video-like reproduction of your user sessions so you can see what happened before, during, and after an error or latency issue occurred.'
  38. )}
  39. </p>
  40. <ButtonList gap={1}>{props.children}</ButtonList>
  41. </OnboardingPanel>
  42. );
  43. }
  44. const HeroImage = styled('img')<{breakpoints: Breakpoints}>`
  45. @media (min-width: ${p => p.breakpoints.small}) {
  46. user-select: none;
  47. position: absolute;
  48. top: 0;
  49. bottom: 0;
  50. width: 220px;
  51. margin-top: auto;
  52. margin-bottom: auto;
  53. transform: translateX(-50%);
  54. left: 50%;
  55. }
  56. @media (min-width: ${p => p.breakpoints.medium}) {
  57. transform: translateX(-55%);
  58. width: 300px;
  59. min-width: 300px;
  60. }
  61. @media (min-width: ${p => p.breakpoints.large}) {
  62. transform: translateX(-60%);
  63. width: 380px;
  64. min-width: 380px;
  65. }
  66. @media (min-width: ${p => p.breakpoints.xlarge}) {
  67. transform: translateX(-65%);
  68. width: 420px;
  69. min-width: 420px;
  70. }
  71. `;
  72. const ButtonList = styled(ButtonBar)`
  73. grid-template-columns: repeat(auto-fit, minmax(130px, max-content));
  74. `;