groupActivityIcons.tsx 2.9 KB

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