Skip to content

Commit 1382768

Browse files
setchyadufr
authored andcommitted
feat: support icons/colors for checksuite / workflow notifications (gitify-app#814)
* feat: support icons/colors for checksuite / workflow notifications * add skipped workflow
1 parent 86d3fa0 commit 1382768

File tree

5 files changed

+340
-95
lines changed

5 files changed

+340
-95
lines changed

src/components/NotificationRow.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,8 @@ export const NotificationRow: React.FC<IProps> = ({
5353
};
5454

5555
const reason = formatReason(notification.reason);
56-
const NotificationIcon = getNotificationTypeIcon(
57-
notification.subject.type,
58-
notification.subject.state,
59-
);
60-
const iconColor = getNotificationTypeIconColor(notification.subject.state);
56+
const NotificationIcon = getNotificationTypeIcon(notification.subject);
57+
const iconColor = getNotificationTypeIconColor(notification.subject);
6158
const realIconColor = settings
6259
? (settings.colors && iconColor) || ''
6360
: iconColor;

src/typesGithub.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,21 @@ export type StateType = IssueStateType | PullRequestStateType;
3737

3838
export type ViewerSubscription = 'IGNORED' | 'SUBSCRIBED' | 'UNSUBSCRIBED';
3939

40+
export type CheckSuiteStatus =
41+
| 'action_required'
42+
| 'cancelled'
43+
| 'completed'
44+
| 'failure'
45+
| 'in_progress'
46+
| 'pending'
47+
| 'queued'
48+
| 'requested'
49+
| 'skipped'
50+
| 'stale'
51+
| 'success'
52+
| 'timed_out'
53+
| 'waiting';
54+
4055
export interface Notification {
4156
id: string;
4257
unread: boolean;
Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,132 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`./utils/github-api.ts should format the notification color 1`] = `"text-red-500"`;
4-
5-
exports[`./utils/github-api.ts should format the notification color 2`] = `"text-purple-500"`;
6-
7-
exports[`./utils/github-api.ts should format the notification color 3`] = `"text-gray-600"`;
8-
9-
exports[`./utils/github-api.ts should format the notification color 4`] = `"text-purple-500"`;
10-
11-
exports[`./utils/github-api.ts should format the notification color 5`] = `"text-gray-300"`;
12-
13-
exports[`./utils/github-api.ts should format the notification color 6`] = `"text-green-500"`;
14-
15-
exports[`./utils/github-api.ts should format the notification color 7`] = `"text-green-500"`;
16-
17-
exports[`./utils/github-api.ts should format the notification color 8`] = `"text-gray-300"`;
18-
19-
exports[`./utils/github-api.ts should format the notification reason 1`] = `
3+
exports[`formatReason should format the notification reason 1`] = `
204
{
215
"description": "You were assigned to the issue.",
226
"type": "Assign",
237
}
248
`;
259

26-
exports[`./utils/github-api.ts should format the notification reason 2`] = `
10+
exports[`formatReason should format the notification reason 2`] = `
2711
{
2812
"description": "You created the thread.",
2913
"type": "Author",
3014
}
3115
`;
3216

33-
exports[`./utils/github-api.ts should format the notification reason 3`] = `
17+
exports[`formatReason should format the notification reason 3`] = `
3418
{
3519
"description": "A GitHub Actions workflow run was triggered for your repository",
3620
"type": "Workflow Run",
3721
}
3822
`;
3923

40-
exports[`./utils/github-api.ts should format the notification reason 4`] = `
24+
exports[`formatReason should format the notification reason 4`] = `
4125
{
4226
"description": "You commented on the thread.",
4327
"type": "Comment",
4428
}
4529
`;
4630

47-
exports[`./utils/github-api.ts should format the notification reason 5`] = `
31+
exports[`formatReason should format the notification reason 5`] = `
4832
{
4933
"description": "You accepted an invitation to contribute to the repository.",
5034
"type": "Invitation",
5135
}
5236
`;
5337

54-
exports[`./utils/github-api.ts should format the notification reason 6`] = `
38+
exports[`formatReason should format the notification reason 6`] = `
5539
{
5640
"description": "You subscribed to the thread (via an issue or pull request).",
5741
"type": "Manual",
5842
}
5943
`;
6044

61-
exports[`./utils/github-api.ts should format the notification reason 7`] = `
45+
exports[`formatReason should format the notification reason 7`] = `
6246
{
6347
"description": "Organization members have requested to enable a feature such as Draft Pull Requests or CoPilot.",
6448
"type": "Member Feature Requested",
6549
}
6650
`;
6751

68-
exports[`./utils/github-api.ts should format the notification reason 8`] = `
52+
exports[`formatReason should format the notification reason 8`] = `
6953
{
7054
"description": "You were specifically @mentioned in the content.",
7155
"type": "Mention",
7256
}
7357
`;
7458

75-
exports[`./utils/github-api.ts should format the notification reason 9`] = `
59+
exports[`formatReason should format the notification reason 9`] = `
7660
{
7761
"description": "You, or a team you're a member of, were requested to review a pull request.",
7862
"type": "Review Requested",
7963
}
8064
`;
8165

82-
exports[`./utils/github-api.ts should format the notification reason 10`] = `
66+
exports[`formatReason should format the notification reason 10`] = `
8367
{
8468
"description": "You were credited for contributing to a security advisory.",
8569
"type": "Security Advisory Credit",
8670
}
8771
`;
8872

89-
exports[`./utils/github-api.ts should format the notification reason 11`] = `
73+
exports[`formatReason should format the notification reason 11`] = `
9074
{
9175
"description": "GitHub discovered a security vulnerability in your repository.",
9276
"type": "Security Alert",
9377
}
9478
`;
9579

96-
exports[`./utils/github-api.ts should format the notification reason 12`] = `
80+
exports[`formatReason should format the notification reason 12`] = `
9781
{
9882
"description": "You changed the thread state (for example, closing an issue or merging a pull request).",
9983
"type": "State Change",
10084
}
10185
`;
10286

103-
exports[`./utils/github-api.ts should format the notification reason 13`] = `
87+
exports[`formatReason should format the notification reason 13`] = `
10488
{
10589
"description": "You're watching the repository.",
10690
"type": "Subscribed",
10791
}
10892
`;
10993

110-
exports[`./utils/github-api.ts should format the notification reason 14`] = `
94+
exports[`formatReason should format the notification reason 14`] = `
11195
{
11296
"description": "You were on a team that was mentioned.",
11397
"type": "Team Mention",
11498
}
11599
`;
116100

117-
exports[`./utils/github-api.ts should format the notification reason 15`] = `
101+
exports[`formatReason should format the notification reason 15`] = `
118102
{
119103
"description": "The reason for this notification is not supported by the app.",
120104
"type": "Unknown",
121105
}
122106
`;
107+
108+
exports[`getNotificationTypeIconColor should format the notification color for check suite 1`] = `"text-gray-500"`;
109+
110+
exports[`getNotificationTypeIconColor should format the notification color for check suite 2`] = `"text-red-500"`;
111+
112+
exports[`getNotificationTypeIconColor should format the notification color for check suite 3`] = `"text-gray-500"`;
113+
114+
exports[`getNotificationTypeIconColor should format the notification color for check suite 4`] = `"text-green-500"`;
115+
116+
exports[`getNotificationTypeIconColor should format the notification color for check suite 5`] = `"text-gray-300"`;
117+
118+
exports[`getNotificationTypeIconColor should format the notification color for state 1`] = `"text-red-500"`;
119+
120+
exports[`getNotificationTypeIconColor should format the notification color for state 2`] = `"text-purple-500"`;
121+
122+
exports[`getNotificationTypeIconColor should format the notification color for state 3`] = `"text-gray-600"`;
123+
124+
exports[`getNotificationTypeIconColor should format the notification color for state 4`] = `"text-purple-500"`;
125+
126+
exports[`getNotificationTypeIconColor should format the notification color for state 5`] = `"text-gray-300"`;
127+
128+
exports[`getNotificationTypeIconColor should format the notification color for state 6`] = `"text-green-500"`;
129+
130+
exports[`getNotificationTypeIconColor should format the notification color for state 7`] = `"text-green-500"`;
131+
132+
exports[`getNotificationTypeIconColor should format the notification color for state 8`] = `"text-gray-300"`;

0 commit comments

Comments
 (0)