mutedBox.tsx 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import DateTime from 'sentry/components/dateTime';
  2. import Duration from 'sentry/components/duration';
  3. import {BannerContainer, BannerSummary} from 'sentry/components/events/styles';
  4. import {IconMute} from 'sentry/icons';
  5. import {t} from 'sentry/locale';
  6. import {ResolutionStatusDetails} from 'sentry/types';
  7. type Props = {
  8. statusDetails: ResolutionStatusDetails;
  9. };
  10. function MutedBox({statusDetails}: Props) {
  11. function renderReason() {
  12. const {ignoreUntil, ignoreCount, ignoreWindow, ignoreUserCount, ignoreUserWindow} =
  13. statusDetails;
  14. if (ignoreUntil) {
  15. return t(
  16. 'This issue has been ignored until %s',
  17. <strong>
  18. <DateTime date={ignoreUntil} />
  19. </strong>
  20. );
  21. }
  22. if (ignoreCount && ignoreWindow) {
  23. return t(
  24. 'This issue has been ignored until it occurs %s time(s) in %s',
  25. <strong>{ignoreCount.toLocaleString()}</strong>,
  26. <strong>
  27. <Duration seconds={ignoreWindow * 60} />
  28. </strong>
  29. );
  30. }
  31. if (ignoreCount) {
  32. return t(
  33. 'This issue has been ignored until it occurs %s more time(s)',
  34. <strong>{ignoreCount.toLocaleString()}</strong>
  35. );
  36. }
  37. if (ignoreUserCount && ignoreUserWindow) {
  38. return t(
  39. 'This issue has been ignored until it affects %s user(s) in %s',
  40. <strong>{ignoreUserCount.toLocaleString()}</strong>,
  41. <strong>
  42. <Duration seconds={ignoreUserWindow * 60} />
  43. </strong>
  44. );
  45. }
  46. if (ignoreUserCount) {
  47. return t(
  48. 'This issue has been ignored until it affects %s more user(s)',
  49. <strong>{ignoreUserCount.toLocaleString()}</strong>
  50. );
  51. }
  52. return t('This issue has been ignored');
  53. }
  54. return (
  55. <BannerContainer priority="default">
  56. <BannerSummary>
  57. <IconMute color="red300" size="sm" />
  58. <span>
  59. {renderReason()}&nbsp;&mdash;&nbsp;
  60. {t(
  61. 'You will not be notified of any changes and it will not show up by default in feeds.'
  62. )}
  63. </span>
  64. </BannerSummary>
  65. </BannerContainer>
  66. );
  67. }
  68. export default MutedBox;