File tree Expand file tree Collapse file tree 3 files changed +53
-3
lines changed
Expand file tree Collapse file tree 3 files changed +53
-3
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,10 @@ export const NotificationRow: React.FC<IProps> = ({
4949 } ;
5050
5151 const reason = formatReason ( notification . reason ) ;
52- const NotificationIcon = getNotificationTypeIcon ( notification . subject . type ) ;
52+ const NotificationIcon = getNotificationTypeIcon (
53+ notification . subject . type ,
54+ notification . subject . state ,
55+ ) ;
5356 const iconColor = getNotificationTypeIconColor ( notification . subject . state ) ;
5457 const realIconColor = settings
5558 ? ( settings . colors && iconColor ) || ''
Original file line number Diff line number Diff line change @@ -27,9 +27,30 @@ describe('./utils/github-api.ts', () => {
2727 expect ( getNotificationTypeIcon ( 'Issue' ) . displayName ) . toBe (
2828 'IssueOpenedIcon' ,
2929 ) ;
30+ expect ( getNotificationTypeIcon ( 'Issue' , 'draft' ) . displayName ) . toBe (
31+ 'IssueDraftIcon' ,
32+ ) ;
33+ expect ( getNotificationTypeIcon ( 'Issue' , 'closed' ) . displayName ) . toBe (
34+ 'IssueClosedIcon' ,
35+ ) ;
36+ expect ( getNotificationTypeIcon ( 'Issue' , 'completed' ) . displayName ) . toBe (
37+ 'IssueClosedIcon' ,
38+ ) ;
39+ expect ( getNotificationTypeIcon ( 'Issue' , 'reopened' ) . displayName ) . toBe (
40+ 'IssueReopenedIcon' ,
41+ ) ;
3042 expect ( getNotificationTypeIcon ( 'PullRequest' ) . displayName ) . toBe (
3143 'GitPullRequestIcon' ,
3244 ) ;
45+ expect ( getNotificationTypeIcon ( 'PullRequest' , 'draft' ) . displayName ) . toBe (
46+ 'GitPullRequestDraftIcon' ,
47+ ) ;
48+ expect ( getNotificationTypeIcon ( 'PullRequest' , 'closed' ) . displayName ) . toBe (
49+ 'GitPullRequestClosedIcon' ,
50+ ) ;
51+ expect ( getNotificationTypeIcon ( 'PullRequest' , 'merged' ) . displayName ) . toBe (
52+ 'GitMergeIcon' ,
53+ ) ;
3354 expect ( getNotificationTypeIcon ( 'Release' ) . displayName ) . toBe ( 'TagIcon' ) ;
3455 expect (
3556 getNotificationTypeIcon ( 'RepositoryVulnerabilityAlert' ) . displayName ,
Original file line number Diff line number Diff line change @@ -2,8 +2,14 @@ import {
22 AlertIcon ,
33 CommentDiscussionIcon ,
44 GitCommitIcon ,
5+ GitMergeIcon ,
6+ GitPullRequestClosedIcon ,
7+ GitPullRequestDraftIcon ,
58 GitPullRequestIcon ,
9+ IssueClosedIcon ,
10+ IssueDraftIcon ,
611 IssueOpenedIcon ,
12+ IssueReopenedIcon ,
713 MailIcon ,
814 OcticonProps ,
915 QuestionIcon ,
@@ -66,6 +72,7 @@ export function formatReason(reason: Reason): {
6672
6773export function getNotificationTypeIcon (
6874 type : SubjectType ,
75+ state ?: StateType ,
6976) : React . FC < OcticonProps > {
7077 switch ( type ) {
7178 case 'CheckSuite' :
@@ -75,9 +82,28 @@ export function getNotificationTypeIcon(
7582 case 'Discussion' :
7683 return CommentDiscussionIcon ;
7784 case 'Issue' :
78- return IssueOpenedIcon ;
85+ switch ( state ) {
86+ case 'draft' :
87+ return IssueDraftIcon ;
88+ case 'closed' :
89+ case 'completed' :
90+ return IssueClosedIcon ;
91+ case 'reopened' :
92+ return IssueReopenedIcon ;
93+ default :
94+ return IssueOpenedIcon ;
95+ }
7996 case 'PullRequest' :
80- return GitPullRequestIcon ;
97+ switch ( state ) {
98+ case 'draft' :
99+ return GitPullRequestDraftIcon ;
100+ case 'closed' :
101+ return GitPullRequestClosedIcon ;
102+ case 'merged' :
103+ return GitMergeIcon ;
104+ default :
105+ return GitPullRequestIcon ;
106+ }
81107 case 'Release' :
82108 return TagIcon ;
83109 case 'RepositoryInvitation' :
You can’t perform that action at this time.
0 commit comments