disabledDiscardGroup.tsx 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import styled from '@emotion/styled';
  2. import {Button} from 'sentry/components/button';
  3. import EmptyMessage from 'sentry/components/emptyMessage';
  4. import {IconBusiness, IconDelete} from 'sentry/icons';
  5. import {t, tct} from 'sentry/locale';
  6. import {space} from 'sentry/styles/space';
  7. import type {Organization} from 'sentry/types/organization';
  8. import {openUpsellModal} from 'getsentry/actionCreators/modal';
  9. import LearnMoreButton from 'getsentry/components/features/learnMoreButton';
  10. import PlanFeature from 'getsentry/components/features/planFeature';
  11. import {displayPlanName} from 'getsentry/utils/billing';
  12. type Props = {
  13. features: Organization['features'];
  14. organization: Organization;
  15. };
  16. function DisabledDiscardGroup({organization, features}: Props) {
  17. return (
  18. <PlanFeature {...{organization, features}}>
  19. {({plan}) => (
  20. <StyledEmptyMessage
  21. icon={<IconDelete />}
  22. title={t('Keep the noise down')}
  23. description={
  24. plan !== null
  25. ? tct(
  26. '[strong:Discard and Delete] allows you to discard any future events before they reach your stream. This feature [planRequirement] or above.',
  27. {
  28. strong: <strong />,
  29. planRequirement: (
  30. <strong>{t('requires a %s Plan', displayPlanName(plan))}</strong>
  31. ),
  32. }
  33. )
  34. : t(
  35. `Discard and Delete is not available on your plan. Contact
  36. us to migrate to a plan that supports discarding any
  37. future events like this before they reach your stream.`
  38. )
  39. }
  40. action={
  41. <ButtonGroup>
  42. <Button
  43. size="sm"
  44. priority="primary"
  45. icon={<IconBusiness />}
  46. onClick={() =>
  47. openUpsellModal({
  48. organization,
  49. source: 'feature.discard_group',
  50. })
  51. }
  52. >
  53. {t('Learn More')}
  54. </Button>
  55. <LearnMoreButton
  56. organization={organization}
  57. size="sm"
  58. source="feature.discard_group"
  59. href="https://blog.sentry.io/2018/01/03/delete-and-discard"
  60. external
  61. >
  62. {t('About Discard and Delete')}
  63. </LearnMoreButton>
  64. </ButtonGroup>
  65. }
  66. />
  67. )}
  68. </PlanFeature>
  69. );
  70. }
  71. const StyledEmptyMessage = styled(EmptyMessage)`
  72. padding: 0;
  73. `;
  74. const ButtonGroup = styled('div')`
  75. display: grid;
  76. grid-auto-flow: column;
  77. gap: ${space(1)};
  78. `;
  79. export default DisabledDiscardGroup;