promo.tsx 2.3 KB

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