promo.tsx 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import styled from '@emotion/styled';
  2. import onboardingServerSideSampling from 'sentry-images/spot/onboarding-server-side-sampling.svg';
  3. import Button from 'sentry/components/button';
  4. import ButtonBar from 'sentry/components/buttonBar';
  5. import EmptyStateWarning from 'sentry/components/emptyStateWarning';
  6. import {t} from 'sentry/locale';
  7. import space from 'sentry/styles/space';
  8. import {SERVER_SIDE_SAMPLING_DOC_LINK} from './utils';
  9. type Props = {
  10. hasAccess: boolean;
  11. onGetStarted: () => void;
  12. };
  13. export function Promo({onGetStarted, hasAccess}: Props) {
  14. return (
  15. <StyledEmptyStateWarning withIcon={false}>
  16. <img src={onboardingServerSideSampling} />
  17. <Description>
  18. <h3>{t('No sampling rules active yet')}</h3>
  19. <p>{t('Set up your project for sampling success')}</p>
  20. <Actions gap={1}>
  21. <Button href={SERVER_SIDE_SAMPLING_DOC_LINK} external>
  22. {t('Read Docs')}
  23. </Button>
  24. <Button
  25. priority="primary"
  26. onClick={onGetStarted}
  27. disabled={!hasAccess}
  28. title={
  29. hasAccess
  30. ? undefined
  31. : t('You do not have permission to set up the sampling rules.')
  32. }
  33. >
  34. {t('Start Setup')}
  35. </Button>
  36. </Actions>
  37. </Description>
  38. </StyledEmptyStateWarning>
  39. );
  40. }
  41. const StyledEmptyStateWarning = styled(EmptyStateWarning)`
  42. align-items: center;
  43. justify-content: center;
  44. flex-direction: column;
  45. gap: ${space(4)};
  46. grid-column: 1/-1;
  47. text-align: center;
  48. img {
  49. width: 320px;
  50. }
  51. && {
  52. display: flex;
  53. padding: ${space(4)};
  54. }
  55. @media (min-width: ${p => p.theme.breakpoints.large}) {
  56. text-align: left;
  57. flex-direction: row;
  58. img {
  59. width: 100%;
  60. max-width: 40%;
  61. min-width: 320px;
  62. }
  63. }
  64. `;
  65. const Actions = styled(ButtonBar)`
  66. justify-content: center;
  67. @media (min-width: ${p => p.theme.breakpoints.large}) {
  68. justify-content: flex-start;
  69. }
  70. `;
  71. const Description = styled('div')`
  72. justify-content: space-between;
  73. @media (min-width: ${p => p.theme.breakpoints.large}) {
  74. padding: ${space(4)};
  75. justify-content: flex-start;
  76. }
  77. p {
  78. font-size: ${p => p.theme.fontSizeLarge};
  79. }
  80. `;