groupActivityIcons.tsx 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. import {
  2. IconAdd,
  3. IconAsana,
  4. IconBitbucket,
  5. IconChat,
  6. IconCheckmark,
  7. IconClose,
  8. IconCommit,
  9. IconDelete,
  10. IconFire,
  11. IconFlag,
  12. IconGithub,
  13. IconGitlab,
  14. IconGraph,
  15. IconJira,
  16. IconLock,
  17. IconMute,
  18. IconNext,
  19. IconPlay,
  20. IconPrevious,
  21. IconRefresh,
  22. IconUnsubscribed,
  23. IconUser,
  24. } from 'sentry/icons';
  25. import {IconCellSignal} from 'sentry/icons/iconCellSignal';
  26. import {GroupActivityType} from 'sentry/types/group';
  27. interface IconWithDefaultProps {
  28. Component: React.ComponentType<any> | null;
  29. defaultProps: {locked?: boolean; type?: string};
  30. componentFunction?: (props: any) => React.ComponentType<any>;
  31. propsFunction?: (props: any) => any;
  32. }
  33. export const groupActivityTypeIconMapping: Record<
  34. GroupActivityType,
  35. IconWithDefaultProps
  36. > = {
  37. [GroupActivityType.NOTE]: {Component: IconChat, defaultProps: {}},
  38. [GroupActivityType.SET_RESOLVED]: {Component: IconCheckmark, defaultProps: {}},
  39. [GroupActivityType.SET_RESOLVED_BY_AGE]: {Component: IconCheckmark, defaultProps: {}},
  40. [GroupActivityType.SET_RESOLVED_IN_RELEASE]: {
  41. Component: IconCheckmark,
  42. defaultProps: {},
  43. },
  44. [GroupActivityType.SET_RESOLVED_IN_COMMIT]: {
  45. Component: IconCheckmark,
  46. defaultProps: {},
  47. },
  48. [GroupActivityType.SET_RESOLVED_IN_PULL_REQUEST]: {
  49. Component: IconCommit,
  50. defaultProps: {},
  51. },
  52. [GroupActivityType.SET_UNRESOLVED]: {Component: IconClose, defaultProps: {}},
  53. [GroupActivityType.SET_IGNORED]: {Component: IconMute, defaultProps: {}},
  54. [GroupActivityType.SET_PUBLIC]: {Component: IconLock, defaultProps: {}},
  55. [GroupActivityType.SET_PRIVATE]: {Component: IconLock, defaultProps: {locked: true}},
  56. [GroupActivityType.SET_REGRESSION]: {Component: IconFire, defaultProps: {}},
  57. [GroupActivityType.CREATE_ISSUE]: {
  58. Component: IconAdd,
  59. componentFunction: data => {
  60. const provider = data.provider;
  61. switch (provider) {
  62. case 'GitHub':
  63. return IconGithub;
  64. case 'GitLab':
  65. return IconGitlab;
  66. case 'Bitbucket':
  67. return IconBitbucket;
  68. case 'Jira':
  69. return IconJira;
  70. case 'Asana':
  71. return IconAsana;
  72. default:
  73. return IconAdd;
  74. }
  75. },
  76. defaultProps: {},
  77. },
  78. [GroupActivityType.UNMERGE_SOURCE]: {Component: IconPrevious, defaultProps: {}},
  79. [GroupActivityType.UNMERGE_DESTINATION]: {Component: IconPrevious, defaultProps: {}},
  80. [GroupActivityType.FIRST_SEEN]: {Component: IconFlag, defaultProps: {}},
  81. [GroupActivityType.ASSIGNED]: {Component: IconUser, defaultProps: {}},
  82. [GroupActivityType.UNASSIGNED]: {Component: IconUnsubscribed, defaultProps: {}},
  83. [GroupActivityType.MERGE]: {Component: IconNext, defaultProps: {}},
  84. [GroupActivityType.REPROCESS]: {Component: IconRefresh, defaultProps: {}},
  85. [GroupActivityType.MARK_REVIEWED]: {Component: IconCheckmark, defaultProps: {}},
  86. [GroupActivityType.AUTO_SET_ONGOING]: {Component: IconPlay, defaultProps: {}},
  87. [GroupActivityType.SET_ESCALATING]: {
  88. Component: IconGraph,
  89. defaultProps: {type: 'area'},
  90. },
  91. [GroupActivityType.SET_PRIORITY]: {
  92. Component: IconCellSignal,
  93. defaultProps: {},
  94. propsFunction: data => {
  95. const {priority} = data;
  96. switch (priority) {
  97. case 'high':
  98. return {bars: 3};
  99. case 'medium':
  100. return {bars: 2};
  101. case 'low':
  102. return {bars: 1};
  103. default:
  104. return {bars: 0};
  105. }
  106. },
  107. },
  108. [GroupActivityType.DELETED_ATTACHMENT]: {Component: IconDelete, defaultProps: {}},
  109. };