archivedBox.tsx 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 ExternalLink from 'sentry/components/links/externalLink';
  5. import {t} from 'sentry/locale';
  6. import {Group, GroupSubstatus, ResolutionStatusDetails} from 'sentry/types';
  7. interface ArchivedBoxProps {
  8. statusDetails: ResolutionStatusDetails;
  9. substatus: Group['substatus'];
  10. }
  11. function ArchivedBox({substatus, statusDetails}: ArchivedBoxProps) {
  12. function renderReason() {
  13. const {ignoreUntil, ignoreCount, ignoreWindow, ignoreUserCount, ignoreUserWindow} =
  14. statusDetails;
  15. if (substatus === GroupSubstatus.ARCHIVED_UNTIL_ESCALATING) {
  16. return t(
  17. "This issue has been archived. It'll return to your inbox if it escalates. To learn more, %s",
  18. <ExternalLink href="https://sentry-docs-git-update-beta-test-archiving.sentry.dev/product/issues/states-triage/">
  19. {t('read the docs')}
  20. </ExternalLink>
  21. );
  22. }
  23. if (ignoreUntil) {
  24. return t(
  25. 'This issue has been archived until %s.',
  26. <strong>
  27. <DateTime date={ignoreUntil} />
  28. </strong>
  29. );
  30. }
  31. if (ignoreCount && ignoreWindow) {
  32. return t(
  33. 'This issue has been archived until it occurs %s time(s) in %s.',
  34. <strong>{ignoreCount.toLocaleString()}</strong>,
  35. <strong>
  36. <Duration seconds={ignoreWindow * 60} />
  37. </strong>
  38. );
  39. }
  40. if (ignoreCount) {
  41. return t(
  42. 'This issue has been archived until it occurs %s more time(s).',
  43. <strong>{ignoreCount.toLocaleString()}</strong>
  44. );
  45. }
  46. if (ignoreUserCount && ignoreUserWindow) {
  47. return t(
  48. 'This issue has been archived until it affects %s user(s) in %s.',
  49. <strong>{ignoreUserCount.toLocaleString()}</strong>,
  50. <strong>
  51. <Duration seconds={ignoreUserWindow * 60} />
  52. </strong>
  53. );
  54. }
  55. if (ignoreUserCount) {
  56. return t(
  57. 'This issue has been archived until it affects %s more user(s).',
  58. <strong>{ignoreUserCount.toLocaleString()}</strong>
  59. );
  60. }
  61. return t('This issue has been archived forever.');
  62. }
  63. return (
  64. <BannerContainer priority="default">
  65. <BannerSummary>
  66. <span>{renderReason()}</span>
  67. </BannerSummary>
  68. </BannerContainer>
  69. );
  70. }
  71. export default ArchivedBox;