Skip to content

Commit

Permalink
feat(issue-details): Add provider specific icon to activities (#80259)
Browse files Browse the repository at this point in the history
this pr adds the provider's icon to the Create Issue activity for some
providers . default behavior will stay the same

<img width="311" alt="Screenshot 2024-11-05 at 9 46 35 AM"
src="https://github.com/user-attachments/assets/0c881e1a-a584-484f-87a6-93e2682375fb">
  • Loading branch information
roggenkemper authored Nov 5, 2024
1 parent 0e087fc commit 41be1f5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
4 changes: 3 additions & 1 deletion static/app/views/issueDetails/streamline/activitySection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ function TimelineItem({
);

const iconMapping = groupActivityTypeIconMapping[item.type];
const Icon = iconMapping?.Component ?? null;
const Icon = iconMapping?.componentFunction
? iconMapping.componentFunction(item.data)
: iconMapping?.Component ?? null;

return (
<ActivityTimelineItem
Expand Down
28 changes: 27 additions & 1 deletion static/app/views/issueDetails/streamline/groupActivityIcons.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import {
IconAdd,
IconAsana,
IconBitbucket,
IconChat,
IconCheckmark,
IconClose,
IconCommit,
IconDelete,
IconFire,
IconFlag,
IconGithub,
IconGitlab,
IconGraph,
IconJira,
IconLock,
IconMute,
IconNext,
Expand All @@ -23,6 +28,7 @@ import {GroupActivityType} from 'sentry/types/group';
interface IconWithDefaultProps {
Component: React.ComponentType<any> | null;
defaultProps: {locked?: boolean; type?: string};
componentFunction?: (props: any) => React.ComponentType<any>;
propsFunction?: (props: any) => any;
}

Expand Down Expand Up @@ -50,7 +56,27 @@ export const groupActivityTypeIconMapping: Record<
[GroupActivityType.SET_PUBLIC]: {Component: IconLock, defaultProps: {}},
[GroupActivityType.SET_PRIVATE]: {Component: IconLock, defaultProps: {locked: true}},
[GroupActivityType.SET_REGRESSION]: {Component: IconFire, defaultProps: {}},
[GroupActivityType.CREATE_ISSUE]: {Component: IconAdd, defaultProps: {}},
[GroupActivityType.CREATE_ISSUE]: {
Component: IconAdd,
componentFunction: data => {
const provider = data.provider;
switch (provider) {
case 'GitHub':
return IconGithub;
case 'GitLab':
return IconGitlab;
case 'Bitbucket':
return IconBitbucket;
case 'Jira':
return IconJira;
case 'Asana':
return IconAsana;
default:
return IconAdd;
}
},
defaultProps: {},
},
[GroupActivityType.UNMERGE_SOURCE]: {Component: IconPrevious, defaultProps: {}},
[GroupActivityType.UNMERGE_DESTINATION]: {Component: IconPrevious, defaultProps: {}},
[GroupActivityType.FIRST_SEEN]: {Component: IconFlag, defaultProps: {}},
Expand Down

0 comments on commit 41be1f5

Please sign in to comment.