@@ -24,99 +24,7 @@ import {
2424 XIcon ,
2525} from '@primer/octicons-react' ;
2626import type { FC } from 'react' ;
27- import type { Reason , Subject } from '../typesGithub' ;
28-
29- const DESCRIPTIONS = {
30- APPROVAL_REQUESTED : 'You were requested to review and approve a deployment.' ,
31- ASSIGN : 'You were assigned to the issue.' ,
32- AUTHOR : 'You created the thread.' ,
33- CI_ACTIVITY :
34- 'A GitHub Actions workflow run was triggered for your repository' ,
35- COMMENT : 'You commented on the thread.' ,
36- INVITATION : 'You accepted an invitation to contribute to the repository.' ,
37- MANUAL : 'You subscribed to the thread (via an issue or pull request).' ,
38- MEMBER_FEATURE_REQUESTED :
39- 'Organization members have requested to enable a feature such as Draft Pull Requests or CoPilot.' ,
40- MENTION : 'You were specifically @mentioned in the content.' ,
41- REVIEW_REQUESTED :
42- "You, or a team you're a member of, were requested to review a pull request." ,
43- SECURITY_ADVISORY_CREDIT :
44- 'You were credited for contributing to a security advisory.' ,
45- SECURITY_ALERT :
46- 'GitHub discovered a security vulnerability in your repository.' ,
47- STATE_CHANGE :
48- 'You changed the thread state (for example, closing an issue or merging a pull request).' ,
49- SUBSCRIBED : "You're watching the repository." ,
50- TEAM_MENTION : 'You were on a team that was mentioned.' ,
51- UNKNOWN : 'The reason for this notification is not supported by the app.' ,
52- } ;
53-
54- export function formatReason ( reason : Reason ) : {
55- type : string ;
56- description : string ;
57- } {
58- switch ( reason ) {
59- case 'approval_requested' :
60- return {
61- type : 'Approval Requested' ,
62- description : DESCRIPTIONS . APPROVAL_REQUESTED ,
63- } ;
64- case 'assign' :
65- return { type : 'Assigned' , description : DESCRIPTIONS . ASSIGN } ;
66- case 'author' :
67- return { type : 'Authored' , description : DESCRIPTIONS . AUTHOR } ;
68- case 'ci_activity' :
69- return {
70- type : 'Workflow Run Completed' ,
71- description : DESCRIPTIONS . CI_ACTIVITY ,
72- } ;
73- case 'comment' :
74- return { type : 'Commented' , description : DESCRIPTIONS . COMMENT } ;
75- case 'invitation' :
76- return {
77- type : 'Invitation Received' ,
78- description : DESCRIPTIONS . INVITATION ,
79- } ;
80- case 'manual' :
81- return { type : 'Updated' , description : DESCRIPTIONS . MANUAL } ;
82- case 'member_feature_requested' :
83- return {
84- type : 'Member Feature Requested' ,
85- description : DESCRIPTIONS . MEMBER_FEATURE_REQUESTED ,
86- } ;
87- case 'mention' :
88- return { type : 'Mentioned' , description : DESCRIPTIONS . MENTION } ;
89- case 'review_requested' :
90- return {
91- type : 'Review Requested' ,
92- description : DESCRIPTIONS . REVIEW_REQUESTED ,
93- } ;
94- case 'security_advisory_credit' :
95- return {
96- type : 'Security Advisory Credit Recevied' ,
97- description : DESCRIPTIONS . SECURITY_ADVISORY_CREDIT ,
98- } ;
99- case 'security_alert' :
100- return {
101- type : 'Security Alert Received' ,
102- description : DESCRIPTIONS . SECURITY_ALERT ,
103- } ;
104- case 'state_change' :
105- return {
106- type : 'State Changed' ,
107- description : DESCRIPTIONS . STATE_CHANGE ,
108- } ;
109- case 'subscribed' :
110- return { type : 'Updated' , description : DESCRIPTIONS . SUBSCRIBED } ;
111- case 'team_mention' :
112- return {
113- type : 'Team Mentioned' ,
114- description : DESCRIPTIONS . TEAM_MENTION ,
115- } ;
116- default :
117- return { type : 'Unknown' , description : DESCRIPTIONS . UNKNOWN } ;
118- }
119- }
27+ import type { Subject } from '../typesGithub' ;
12028
12129export function getNotificationTypeIcon ( subject : Subject ) : FC < OcticonProps > {
12230 switch ( subject . type ) {
0 commit comments