groupActivityIcons.tsx 3.5 KB

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