From 28c6bf804468019ccb4e787e060dc77b005f024b Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Wed, 19 Jun 2024 09:48:53 -0400 Subject: [PATCH 01/11] feat: show notification number for issues, prs, discussions --- src/components/NotificationRow.tsx | 14 +- .../NotificationRow.test.tsx.snap | 120 ++++++++++++++++++ src/typesGitHub.ts | 2 + src/utils/api/__mocks__/response-mocks.ts | 1 + src/utils/api/graphql/discussions.ts | 1 + src/utils/subject.test.ts | 52 +++++++- src/utils/subject.ts | 3 + 7 files changed, 188 insertions(+), 5 deletions(-) diff --git a/src/components/NotificationRow.tsx b/src/components/NotificationRow.tsx index 5c7c86f19..a808b5696 100644 --- a/src/components/NotificationRow.tsx +++ b/src/components/NotificationRow.tsx @@ -83,11 +83,18 @@ export const NotificationRow: FC = ({ ? `${notification.subject.user.login} updated ${updatedAt}` : `Updated ${updatedAt}`; - const notificationTitle = formatForDisplay([ + const notificationType = formatForDisplay([ notification.subject.state, notification.subject.type, ]); + const notificationNumber = notification.subject?.number + ? `#${notification.subject.number}` + : ''; + + const notificationTitle = + `${notification.subject.title} ${notificationNumber}`.trim(); + const commentsPillDescription = `${notification.subject.comments} ${ notification.subject.comments > 1 ? 'comments' : 'comment' }`; @@ -112,7 +119,7 @@ export const NotificationRow: FC = ({ >
@@ -124,9 +131,10 @@ export const NotificationRow: FC = ({
{notification.subject.title} + {notificationNumber}
diff --git a/src/components/__snapshots__/NotificationRow.test.tsx.snap b/src/components/__snapshots__/NotificationRow.test.tsx.snap index 1ade8bac3..71635152c 100644 --- a/src/components/__snapshots__/NotificationRow.test.tsx.snap +++ b/src/components/__snapshots__/NotificationRow.test.tsx.snap @@ -41,6 +41,11 @@ exports[`components/NotificationRow.tsx notification pills / metrics comment pil title="I am a robot and this is a test!" > I am a robot and this is a test! + + +
I am a robot and this is a test! + + +
I am a robot and this is a test! + + +
I am a robot and this is a test! + + +
I am a robot and this is a test! + + +
I am a robot and this is a test! + + +
I am a robot and this is a test! + + +
I am a robot and this is a test! + + +
I am a robot and this is a test! + + +
I am a robot and this is a test! + + +
I am a robot and this is a test! + + +
I am a robot and this is a test! + + +
I am a robot and this is a test! + + +
I am a robot and this is a test! + + +
I am a robot and this is a test! + + +
I am a robot and this is a test! + + +
I am a robot and this is a test! + + +
I am a robot and this is a test! + + +
I am a robot and this is a test! + + +
I am a robot and this is a test! + + +
I am a robot and this is a test! + + +
I am a robot and this is a test! + + +
I am a robot and this is a test! + + +
I am a robot and this is a test! + + +
{ } export interface Discussion { + number: number; title: string; stateReason: DiscussionStateType; isAnswered: boolean; diff --git a/src/utils/api/__mocks__/response-mocks.ts b/src/utils/api/__mocks__/response-mocks.ts index 74097fb37..714635ab5 100644 --- a/src/utils/api/__mocks__/response-mocks.ts +++ b/src/utils/api/__mocks__/response-mocks.ts @@ -419,6 +419,7 @@ export const mockGraphQLResponse: GraphQLSearch = { search: { nodes: [ { + number: 123, title: '1.16.0', isAnswered: false, stateReason: 'OPEN', diff --git a/src/utils/api/graphql/discussions.ts b/src/utils/api/graphql/discussions.ts index b5ce239af..93ec4c91a 100644 --- a/src/utils/api/graphql/discussions.ts +++ b/src/utils/api/graphql/discussions.ts @@ -31,6 +31,7 @@ export const QUERY_SEARCH_DISCUSSIONS = gql` search(query: $queryStatement, type: DISCUSSION, first: $firstDiscussions) { nodes { ... on Discussion { + number title stateReason isAnswered diff --git a/src/utils/subject.test.ts b/src/utils/subject.test.ts index 9bd3a3af6..0f0ba0ce0 100644 --- a/src/utils/subject.test.ts +++ b/src/utils/subject.test.ts @@ -221,6 +221,7 @@ describe('utils/subject.ts', () => { const result = await getGitifySubjectDetails(mockNotification); expect(result).toEqual({ + number: 123, state: 'ANSWERED', user: { login: mockDiscussionAuthor.login, @@ -247,6 +248,7 @@ describe('utils/subject.ts', () => { const result = await getGitifySubjectDetails(mockNotification); expect(result).toEqual({ + number: 123, state: 'DUPLICATE', user: { login: mockDiscussionAuthor.login, @@ -273,6 +275,7 @@ describe('utils/subject.ts', () => { const result = await getGitifySubjectDetails(mockNotification); expect(result).toEqual({ + number: 123, state: 'OPEN', user: { login: mockDiscussionAuthor.login, @@ -299,6 +302,7 @@ describe('utils/subject.ts', () => { const result = await getGitifySubjectDetails(mockNotification); expect(result).toEqual({ + number: 123, state: 'OUTDATED', user: { login: mockDiscussionAuthor.login, @@ -325,6 +329,7 @@ describe('utils/subject.ts', () => { const result = await getGitifySubjectDetails(mockNotification); expect(result).toEqual({ + number: 123, state: 'REOPENED', user: { login: mockDiscussionAuthor.login, @@ -351,6 +356,7 @@ describe('utils/subject.ts', () => { const result = await getGitifySubjectDetails(mockNotification); expect(result).toEqual({ + number: 123, state: 'RESOLVED', user: { login: mockDiscussionAuthor.login, @@ -385,6 +391,7 @@ describe('utils/subject.ts', () => { const result = await getGitifySubjectDetails(mockNotification); expect(result).toEqual({ + number: 123, state: 'ANSWERED', user: { login: mockDiscussionAuthor.login, @@ -413,7 +420,12 @@ describe('utils/subject.ts', () => { it('open issue state', async () => { nock('https://api.github.com') .get('/repos/gitify-app/notifications-test/issues/1') - .reply(200, { state: 'open', user: mockAuthor, labels: [] }); + .reply(200, { + number: 123, + state: 'open', + user: mockAuthor, + labels: [], + }); nock('https://api.github.com') .get('/repos/gitify-app/notifications-test/issues/comments/302888448') @@ -422,6 +434,7 @@ describe('utils/subject.ts', () => { const result = await getGitifySubjectDetails(mockNotification); expect(result).toEqual({ + number: 123, state: 'open', user: { login: mockCommenter.login, @@ -436,7 +449,12 @@ describe('utils/subject.ts', () => { it('closed issue state', async () => { nock('https://api.github.com') .get('/repos/gitify-app/notifications-test/issues/1') - .reply(200, { state: 'closed', user: mockAuthor, labels: [] }); + .reply(200, { + number: 123, + state: 'closed', + user: mockAuthor, + labels: [], + }); nock('https://api.github.com') .get('/repos/gitify-app/notifications-test/issues/comments/302888448') @@ -445,6 +463,7 @@ describe('utils/subject.ts', () => { const result = await getGitifySubjectDetails(mockNotification); expect(result).toEqual({ + number: 123, state: 'closed', user: { login: mockCommenter.login, @@ -460,6 +479,7 @@ describe('utils/subject.ts', () => { nock('https://api.github.com') .get('/repos/gitify-app/notifications-test/issues/1') .reply(200, { + number: 123, state: 'closed', state_reason: 'completed', user: mockAuthor, @@ -473,6 +493,7 @@ describe('utils/subject.ts', () => { const result = await getGitifySubjectDetails(mockNotification); expect(result).toEqual({ + number: 123, state: 'completed', user: { login: mockCommenter.login, @@ -488,6 +509,7 @@ describe('utils/subject.ts', () => { nock('https://api.github.com') .get('/repos/gitify-app/notifications-test/issues/1') .reply(200, { + number: 123, state: 'open', state_reason: 'not_planned', user: mockAuthor, @@ -501,6 +523,7 @@ describe('utils/subject.ts', () => { const result = await getGitifySubjectDetails(mockNotification); expect(result).toEqual({ + number: 123, state: 'not_planned', user: { login: mockCommenter.login, @@ -516,6 +539,7 @@ describe('utils/subject.ts', () => { nock('https://api.github.com') .get('/repos/gitify-app/notifications-test/issues/1') .reply(200, { + number: 123, state: 'open', state_reason: 'reopened', user: mockAuthor, @@ -529,6 +553,7 @@ describe('utils/subject.ts', () => { const result = await getGitifySubjectDetails(mockNotification); expect(result).toEqual({ + number: 123, state: 'reopened', user: { login: mockCommenter.login, @@ -546,6 +571,7 @@ describe('utils/subject.ts', () => { nock('https://api.github.com') .get('/repos/gitify-app/notifications-test/issues/1') .reply(200, { + number: 123, state: 'open', draft: false, merged: false, @@ -556,6 +582,7 @@ describe('utils/subject.ts', () => { const result = await getGitifySubjectDetails(mockNotification); expect(result).toEqual({ + number: 123, state: 'open', user: { login: mockAuthor.login, @@ -572,6 +599,7 @@ describe('utils/subject.ts', () => { nock('https://api.github.com') .get('/repos/gitify-app/notifications-test/issues/1') .reply(200, { + number: 123, state: 'open', user: mockAuthor, labels: [{ name: 'enhancement' }], @@ -586,6 +614,7 @@ describe('utils/subject.ts', () => { const result = await getGitifySubjectDetails(mockNotification); expect(result).toEqual({ + number: 123, state: 'open', user: { login: mockCommenter.login, @@ -601,6 +630,7 @@ describe('utils/subject.ts', () => { nock('https://api.github.com') .get('/repos/gitify-app/notifications-test/issues/1') .reply(200, { + number: 123, state: 'open', user: mockAuthor, labels: null, @@ -615,6 +645,7 @@ describe('utils/subject.ts', () => { const result = await getGitifySubjectDetails(mockNotification); expect(result).toEqual({ + number: 123, state: 'open', user: { login: mockCommenter.login, @@ -645,6 +676,7 @@ describe('utils/subject.ts', () => { nock('https://api.github.com') .get('/repos/gitify-app/notifications-test/pulls/1') .reply(200, { + number: 123, state: 'closed', draft: false, merged: false, @@ -663,6 +695,7 @@ describe('utils/subject.ts', () => { const result = await getGitifySubjectDetails(mockNotification); expect(result).toEqual({ + number: 123, state: 'closed', user: { login: mockCommenter.login, @@ -680,6 +713,7 @@ describe('utils/subject.ts', () => { nock('https://api.github.com') .get('/repos/gitify-app/notifications-test/pulls/1') .reply(200, { + number: 123, state: 'open', draft: true, merged: false, @@ -698,6 +732,7 @@ describe('utils/subject.ts', () => { const result = await getGitifySubjectDetails(mockNotification); expect(result).toEqual({ + number: 123, state: 'draft', user: { login: mockCommenter.login, @@ -715,6 +750,7 @@ describe('utils/subject.ts', () => { nock('https://api.github.com') .get('/repos/gitify-app/notifications-test/pulls/1') .reply(200, { + number: 123, state: 'open', draft: false, merged: true, @@ -733,6 +769,7 @@ describe('utils/subject.ts', () => { const result = await getGitifySubjectDetails(mockNotification); expect(result).toEqual({ + number: 123, state: 'merged', user: { login: mockCommenter.login, @@ -750,6 +787,7 @@ describe('utils/subject.ts', () => { nock('https://api.github.com') .get('/repos/gitify-app/notifications-test/pulls/1') .reply(200, { + number: 123, state: 'open', draft: false, merged: false, @@ -768,6 +806,7 @@ describe('utils/subject.ts', () => { const result = await getGitifySubjectDetails(mockNotification); expect(result).toEqual({ + number: 123, state: 'open', user: { login: mockCommenter.login, @@ -788,6 +827,7 @@ describe('utils/subject.ts', () => { nock('https://api.github.com') .get('/repos/gitify-app/notifications-test/pulls/1') .reply(200, { + number: 123, state: 'open', draft: false, merged: false, @@ -802,6 +842,7 @@ describe('utils/subject.ts', () => { const result = await getGitifySubjectDetails(mockNotification); expect(result).toEqual({ + number: 123, state: 'open', user: { login: mockAuthor.login, @@ -821,6 +862,7 @@ describe('utils/subject.ts', () => { nock('https://api.github.com') .get('/repos/gitify-app/notifications-test/pulls/1') .reply(200, { + number: 123, state: 'open', draft: false, merged: false, @@ -835,6 +877,7 @@ describe('utils/subject.ts', () => { const result = await getGitifySubjectDetails(mockNotification); expect(result).toEqual({ + number: 123, state: 'open', user: { login: mockAuthor.login, @@ -911,6 +954,7 @@ describe('utils/subject.ts', () => { nock('https://api.github.com') .get('/repos/gitify-app/notifications-test/pulls/1') .reply(200, { + number: 123, state: 'open', draft: false, merged: false, @@ -931,6 +975,7 @@ describe('utils/subject.ts', () => { const result = await getGitifySubjectDetails(mockNotification); expect(result).toEqual({ + number: 123, state: 'open', user: { login: mockCommenter.login, @@ -948,6 +993,7 @@ describe('utils/subject.ts', () => { nock('https://api.github.com') .get('/repos/gitify-app/notifications-test/pulls/1') .reply(200, { + number: 123, state: 'open', draft: false, merged: false, @@ -968,6 +1014,7 @@ describe('utils/subject.ts', () => { const result = await getGitifySubjectDetails(mockNotification); expect(result).toEqual({ + number: 123, state: 'open', user: { login: mockCommenter.login, @@ -1292,6 +1339,7 @@ function mockDiscussionNode( isAnswered: boolean, ): Discussion { return { + number: 123, title: 'This is a mock discussion', url: 'https://github.com/gitify-app/notifications-test/discussions/1' as Link, stateReason: state, diff --git a/src/utils/subject.ts b/src/utils/subject.ts index ba0c7853b..a4063c0a3 100644 --- a/src/utils/subject.ts +++ b/src/utils/subject.ts @@ -183,6 +183,7 @@ async function getGitifySubjectForDiscussion( } return { + number: discussion.number, state: discussionState, user: discussionUser, comments: discussion.comments.totalCount, @@ -226,6 +227,7 @@ async function getGitifySubjectForIssue( } return { + number: issue.number, state: issue.state_reason ?? issue.state, user: { login: issueCommentUser?.login ?? issue.user.login, @@ -272,6 +274,7 @@ async function getGitifySubjectForPullRequest( const linkedIssues = parseLinkedIssuesFromPr(pr); return { + number: pr.number, state: prState, user: { login: prCommentUser?.login ?? pr.user.login, From 11407a7aab88049d4f8613045c07855e487726c7 Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Wed, 19 Jun 2024 11:17:07 -0400 Subject: [PATCH 02/11] feat: update opacity --- src/components/NotificationRow.tsx | 2 +- .../NotificationRow.test.tsx.snap | 48 +++++++++---------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/components/NotificationRow.tsx b/src/components/NotificationRow.tsx index a808b5696..ffcc6e0d1 100644 --- a/src/components/NotificationRow.tsx +++ b/src/components/NotificationRow.tsx @@ -134,7 +134,7 @@ export const NotificationRow: FC = ({ title={notificationTitle} > {notification.subject.title} - {notificationNumber} + {notificationNumber}
diff --git a/src/components/__snapshots__/NotificationRow.test.tsx.snap b/src/components/__snapshots__/NotificationRow.test.tsx.snap index 71635152c..e397c2ec1 100644 --- a/src/components/__snapshots__/NotificationRow.test.tsx.snap +++ b/src/components/__snapshots__/NotificationRow.test.tsx.snap @@ -42,7 +42,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics comment pil > I am a robot and this is a test! @@ -281,7 +281,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics comment pil > I am a robot and this is a test! @@ -577,7 +577,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics comment pil > I am a robot and this is a test! @@ -816,7 +816,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics comment pil > I am a robot and this is a test! @@ -1112,7 +1112,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics comment pil > I am a robot and this is a test! @@ -1329,7 +1329,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics comment pil > I am a robot and this is a test! @@ -1603,7 +1603,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics label pills > I am a robot and this is a test! @@ -1866,7 +1866,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics label pills > I am a robot and this is a test! @@ -2186,7 +2186,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics linked issu > I am a robot and this is a test! @@ -2403,7 +2403,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics linked issu > I am a robot and this is a test! @@ -2677,7 +2677,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics linked issu > I am a robot and this is a test! @@ -2894,7 +2894,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics linked issu > I am a robot and this is a test! @@ -3168,7 +3168,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics milestone p > I am a robot and this is a test! @@ -3452,7 +3452,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics milestone p > I am a robot and this is a test! @@ -3793,7 +3793,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics milestone p > I am a robot and this is a test! @@ -4077,7 +4077,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics milestone p > I am a robot and this is a test! @@ -4418,7 +4418,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics showPills d > I am a robot and this is a test! @@ -4562,7 +4562,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics showPills d > I am a robot and this is a test! @@ -4763,7 +4763,7 @@ exports[`components/NotificationRow.tsx should render itself & its children 1`] > I am a robot and this is a test! @@ -4951,7 +4951,7 @@ exports[`components/NotificationRow.tsx should render itself & its children 1`] > I am a robot and this is a test! @@ -5196,7 +5196,7 @@ exports[`components/NotificationRow.tsx should render itself & its children when > I am a robot and this is a test! @@ -5384,7 +5384,7 @@ exports[`components/NotificationRow.tsx should render itself & its children when > I am a robot and this is a test! @@ -5629,7 +5629,7 @@ exports[`components/NotificationRow.tsx should render itself & its children with > I am a robot and this is a test! @@ -5821,7 +5821,7 @@ exports[`components/NotificationRow.tsx should render itself & its children with > I am a robot and this is a test! From 7dde63a9dd1703bbd196cd56f96e3e2d8292cc8c Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Fri, 21 Jun 2024 07:16:24 -0400 Subject: [PATCH 03/11] Merge branch 'main' into refactor/pills-component --- .../AccountNotifications.test.tsx.snap | 20 +++++++++++++++++++ .../NotificationRow.test.tsx.snap | 10 ++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/components/__snapshots__/AccountNotifications.test.tsx.snap b/src/components/__snapshots__/AccountNotifications.test.tsx.snap index e63164fd3..25927a6d2 100644 --- a/src/components/__snapshots__/AccountNotifications.test.tsx.snap +++ b/src/components/__snapshots__/AccountNotifications.test.tsx.snap @@ -117,6 +117,11 @@ exports[`components/AccountNotifications.tsx should render itself (github.com wi title="I am a robot and this is a test!" > I am a robot and this is a test! + + +
Improve the UI + + +
I am a robot and this is a test! + + +
Improve the UI + + +
I am a robot and this is a test! + + +
I am a robot and this is a test! + + +
Date: Fri, 21 Jun 2024 07:21:26 -0400 Subject: [PATCH 04/11] Merge branch 'main' into refactor/pills-component --- src/components/NotificationRow.tsx | 2 +- .../AccountNotifications.test.tsx.snap | 8 +-- .../NotificationRow.test.tsx.snap | 52 +++++++++---------- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/components/NotificationRow.tsx b/src/components/NotificationRow.tsx index db44757b6..6630c1f41 100644 --- a/src/components/NotificationRow.tsx +++ b/src/components/NotificationRow.tsx @@ -145,7 +145,7 @@ export const NotificationRow: FC = ({ title={notificationTitle} > {notification.subject.title} - {notificationNumber} + {notificationNumber}
I am a robot and this is a test! @@ -319,7 +319,7 @@ exports[`components/AccountNotifications.tsx should render itself (github.com wi > Improve the UI @@ -542,7 +542,7 @@ exports[`components/AccountNotifications.tsx should render itself (github.com wi > I am a robot and this is a test! @@ -743,7 +743,7 @@ exports[`components/AccountNotifications.tsx should render itself (github.com wi > Improve the UI diff --git a/src/components/__snapshots__/NotificationRow.test.tsx.snap b/src/components/__snapshots__/NotificationRow.test.tsx.snap index d02fcce2b..4afc3a89f 100644 --- a/src/components/__snapshots__/NotificationRow.test.tsx.snap +++ b/src/components/__snapshots__/NotificationRow.test.tsx.snap @@ -42,7 +42,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics comment pil > I am a robot and this is a test! @@ -281,7 +281,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics comment pil > I am a robot and this is a test! @@ -577,7 +577,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics comment pil > I am a robot and this is a test! @@ -816,7 +816,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics comment pil > I am a robot and this is a test! @@ -1112,7 +1112,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics comment pil > I am a robot and this is a test! @@ -1329,7 +1329,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics comment pil > I am a robot and this is a test! @@ -1603,7 +1603,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics label pills > I am a robot and this is a test! @@ -1866,7 +1866,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics label pills > I am a robot and this is a test! @@ -2186,7 +2186,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics linked issu > I am a robot and this is a test! @@ -2403,7 +2403,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics linked issu > I am a robot and this is a test! @@ -2677,7 +2677,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics linked issu > I am a robot and this is a test! @@ -2894,7 +2894,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics linked issu > I am a robot and this is a test! @@ -3168,7 +3168,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics milestone p > I am a robot and this is a test! @@ -3452,7 +3452,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics milestone p > I am a robot and this is a test! @@ -3793,7 +3793,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics milestone p > I am a robot and this is a test! @@ -4077,7 +4077,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics milestone p > I am a robot and this is a test! @@ -4418,7 +4418,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics showPills d > I am a robot and this is a test! @@ -4562,7 +4562,7 @@ exports[`components/NotificationRow.tsx notification pills / metrics showPills d > I am a robot and this is a test! @@ -4780,7 +4780,7 @@ exports[`components/NotificationRow.tsx should render itself & its children - gr > I am a robot and this is a test! @@ -4984,7 +4984,7 @@ exports[`components/NotificationRow.tsx should render itself & its children - gr > I am a robot and this is a test! @@ -5228,7 +5228,7 @@ exports[`components/NotificationRow.tsx should render itself & its children - gr > I am a robot and this is a test! @@ -5415,7 +5415,7 @@ exports[`components/NotificationRow.tsx should render itself & its children - gr > I am a robot and this is a test! @@ -5659,7 +5659,7 @@ exports[`components/NotificationRow.tsx should render itself & its children when > I am a robot and this is a test! @@ -5846,7 +5846,7 @@ exports[`components/NotificationRow.tsx should render itself & its children when > I am a robot and this is a test! @@ -6090,7 +6090,7 @@ exports[`components/NotificationRow.tsx should render itself & its children with > I am a robot and this is a test! @@ -6282,7 +6282,7 @@ exports[`components/NotificationRow.tsx should render itself & its children with > I am a robot and this is a test! From f3da55dff81461c30645a6f69c5c915cfdb45536 Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Fri, 21 Jun 2024 07:24:43 -0400 Subject: [PATCH 05/11] opacity --- src/components/NotificationRow.tsx | 4 +- .../AccountNotifications.test.tsx.snap | 24 +-- .../NotificationRow.test.tsx.snap | 156 ++++++------------ 3 files changed, 63 insertions(+), 121 deletions(-) diff --git a/src/components/NotificationRow.tsx b/src/components/NotificationRow.tsx index 6630c1f41..4ca631cb8 100644 --- a/src/components/NotificationRow.tsx +++ b/src/components/NotificationRow.tsx @@ -145,7 +145,9 @@ export const NotificationRow: FC = ({ title={notificationTitle} > {notification.subject.title} - {notificationNumber} + + {notificationNumber} +
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
Improve the UI - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
Improve the UI - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
I am a robot and this is a test! - - + class="text-xxs ml-1 opacity-50" + />
Date: Tue, 25 Jun 2024 11:08:47 -0400 Subject: [PATCH 06/11] add setting --- src/__mocks__/state-mocks.ts | 1 + src/components/NotificationRow.tsx | 8 +++- src/context/App.test.tsx | 2 + src/context/App.tsx | 1 + src/routes/Settings.test.tsx | 25 ++++++++++ src/routes/Settings.tsx | 28 +++++++++++ .../__snapshots__/Settings.test.tsx.snap | 48 +++++++++++++++++++ src/types.ts | 1 + 8 files changed, 113 insertions(+), 1 deletion(-) diff --git a/src/__mocks__/state-mocks.ts b/src/__mocks__/state-mocks.ts index d41641901..ed6cdc541 100644 --- a/src/__mocks__/state-mocks.ts +++ b/src/__mocks__/state-mocks.ts @@ -84,6 +84,7 @@ export const mockSettings: SettingsState = { showAccountHostname: false, delayNotificationState: false, showPills: true, + showNumber: true, keyboardShortcut: true, groupBy: GroupBy.REPOSITORY, }; diff --git a/src/components/NotificationRow.tsx b/src/components/NotificationRow.tsx index d61da1929..5f635e214 100644 --- a/src/components/NotificationRow.tsx +++ b/src/components/NotificationRow.tsx @@ -112,7 +112,13 @@ export const NotificationRow: FC = ({ title={notificationTitle} > {notification.subject.title} - + {notificationNumber}
diff --git a/src/context/App.test.tsx b/src/context/App.test.tsx index bc0e2d675..06ea13a51 100644 --- a/src/context/App.test.tsx +++ b/src/context/App.test.tsx @@ -371,6 +371,7 @@ describe('context/App.tsx', () => { showAccountHostname: false, delayNotificationState: false, showPills: true, + showNumber: true, keyboardShortcut: true, groupBy: 'REPOSITORY', } as SettingsState, @@ -424,6 +425,7 @@ describe('context/App.tsx', () => { showAccountHostname: false, delayNotificationState: false, showPills: true, + showNumber: true, keyboardShortcut: true, groupBy: 'REPOSITORY', } as SettingsState, diff --git a/src/context/App.tsx b/src/context/App.tsx index 16904b58e..6f84667d7 100644 --- a/src/context/App.tsx +++ b/src/context/App.tsx @@ -62,6 +62,7 @@ export const defaultSettings: SettingsState = { showAccountHostname: false, delayNotificationState: false, showPills: true, + showNumber: true, keyboardShortcut: true, groupBy: GroupBy.REPOSITORY, }; diff --git a/src/routes/Settings.test.tsx b/src/routes/Settings.test.tsx index 333cc184e..74374b084 100644 --- a/src/routes/Settings.test.tsx +++ b/src/routes/Settings.test.tsx @@ -155,6 +155,31 @@ describe('routes/Settings.tsx', () => { expect(updateSetting).toHaveBeenCalledWith('showPills', false); }); + it('should toggle show number checkbox', async () => { + await act(async () => { + render( + + + + + , + ); + }); + + await screen.findByLabelText('Show number'); + + fireEvent.click(screen.getByLabelText('Show number')); + + expect(updateSetting).toHaveBeenCalledTimes(1); + expect(updateSetting).toHaveBeenCalledWith('showNumber', false); + }); + it('should toggle account hostname checkbox', async () => { await act(async () => { render( diff --git a/src/routes/Settings.tsx b/src/routes/Settings.tsx index f1635937a..f074b21a8 100644 --- a/src/routes/Settings.tsx +++ b/src/routes/Settings.tsx @@ -1,6 +1,7 @@ import { CheckIcon, CommentIcon, + GitPullRequestIcon, IssueClosedIcon, MilestoneIcon, PersonIcon, @@ -132,6 +133,33 @@ export const SettingsRoute: FC = () => { } /> + updateSetting('showNumber', evt.target.checked)} + tooltip={ +
+
Show GitHub number for:
+
+
    +
  • + + Discussion +
  • +
  • + + Issue +
  • +
  • + + Pull Request +
  • +
+
+
+ } + /> +
+
+
+ +
+
+ +
+
+
diff --git a/src/types.ts b/src/types.ts index 94aa95b8c..c1da44c7a 100644 --- a/src/types.ts +++ b/src/types.ts @@ -60,6 +60,7 @@ interface AppearanceSettingsState { detailedNotifications: boolean; showAccountHostname: boolean; showPills: boolean; + showNumber: boolean; } interface NotificationSettingsState { From 0b2f265b48e5f4b3e77540909af1c5a3dfd5cd16 Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Tue, 25 Jun 2024 11:16:02 -0400 Subject: [PATCH 07/11] add setting --- src/components/NotificationRow.test.tsx | 20 + .../NotificationRow.test.tsx.snap | 427 ++++++++++++++++++ 2 files changed, 447 insertions(+) diff --git a/src/components/NotificationRow.test.tsx b/src/components/NotificationRow.test.tsx index bb781f14a..15a6abb5b 100644 --- a/src/components/NotificationRow.test.tsx +++ b/src/components/NotificationRow.test.tsx @@ -61,6 +61,26 @@ describe('components/NotificationRow.tsx', () => { expect(tree).toMatchSnapshot(); }); + it('should render itself & its children - hide numbers', async () => { + jest + .spyOn(global.Date, 'now') + .mockImplementation(() => new Date('2024').valueOf()); + + const props = { + notification: mockSingleNotification, + account: mockGitHubCloudAccount, + }; + + const tree = render( + + + , + ); + expect(tree).toMatchSnapshot(); + }); + describe('notification interactions', () => { it('should open a notification in the browser - click', () => { const removeNotificationFromState = jest.fn(); diff --git a/src/components/__snapshots__/NotificationRow.test.tsx.snap b/src/components/__snapshots__/NotificationRow.test.tsx.snap index f5d2a9172..c30e3a4ba 100644 --- a/src/components/__snapshots__/NotificationRow.test.tsx.snap +++ b/src/components/__snapshots__/NotificationRow.test.tsx.snap @@ -887,3 +887,430 @@ exports[`components/NotificationRow.tsx should render itself & its children - gr "unmount": [Function], } `; + +exports[`components/NotificationRow.tsx should render itself & its children - hide numbers 1`] = ` +{ + "asFragment": [Function], + "baseElement": +
+
+
+ + + + +
+
+
+ I am a robot and this is a test! +
+
+ +
+ Updated +
+
+ 7 years ago +
+
+ + +
+
+
+
+ + + +
+
+
+ , + "container":
+
+
+ + + + +
+
+
+ I am a robot and this is a test! +
+
+ +
+ Updated +
+
+ 7 years ago +
+
+ + +
+
+
+
+ + + +
+
+
, + "debug": [Function], + "findAllByAltText": [Function], + "findAllByDisplayValue": [Function], + "findAllByLabelText": [Function], + "findAllByPlaceholderText": [Function], + "findAllByRole": [Function], + "findAllByTestId": [Function], + "findAllByText": [Function], + "findAllByTitle": [Function], + "findByAltText": [Function], + "findByDisplayValue": [Function], + "findByLabelText": [Function], + "findByPlaceholderText": [Function], + "findByRole": [Function], + "findByTestId": [Function], + "findByText": [Function], + "findByTitle": [Function], + "getAllByAltText": [Function], + "getAllByDisplayValue": [Function], + "getAllByLabelText": [Function], + "getAllByPlaceholderText": [Function], + "getAllByRole": [Function], + "getAllByTestId": [Function], + "getAllByText": [Function], + "getAllByTitle": [Function], + "getByAltText": [Function], + "getByDisplayValue": [Function], + "getByLabelText": [Function], + "getByPlaceholderText": [Function], + "getByRole": [Function], + "getByTestId": [Function], + "getByText": [Function], + "getByTitle": [Function], + "queryAllByAltText": [Function], + "queryAllByDisplayValue": [Function], + "queryAllByLabelText": [Function], + "queryAllByPlaceholderText": [Function], + "queryAllByRole": [Function], + "queryAllByTestId": [Function], + "queryAllByText": [Function], + "queryAllByTitle": [Function], + "queryByAltText": [Function], + "queryByDisplayValue": [Function], + "queryByLabelText": [Function], + "queryByPlaceholderText": [Function], + "queryByRole": [Function], + "queryByTestId": [Function], + "queryByText": [Function], + "queryByTitle": [Function], + "rerender": [Function], + "unmount": [Function], +} +`; From 07c9638311394580f39da871ac1f5dada19c3dda Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Tue, 25 Jun 2024 22:06:39 -0400 Subject: [PATCH 08/11] add setting --- src/routes/Settings.tsx | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/routes/Settings.tsx b/src/routes/Settings.tsx index f074b21a8..5f9593316 100644 --- a/src/routes/Settings.tsx +++ b/src/routes/Settings.tsx @@ -100,8 +100,12 @@ export const SettingsRoute: FC = () => { updateSetting('showPills', evt.target.checked)} + checked={settings.detailedNotifications && settings.showPills} + onChange={(evt) => + settings.detailedNotifications && + updateSetting('showPills', evt.target.checked) + } + disabled={!settings.detailedNotifications} tooltip={
Show notification metric pills for:
@@ -130,14 +134,22 @@ export const SettingsRoute: FC = () => {
+
+ ⚠️ This setting requires{' '} + Detailed Notifications to be enabled. +
} /> updateSetting('showNumber', evt.target.checked)} + checked={settings.detailedNotifications && settings.showNumber} + onChange={(evt) => + settings.detailedNotifications && + updateSetting('showNumber', evt.target.checked) + } + disabled={!settings.detailedNotifications} tooltip={
Show GitHub number for:
@@ -157,6 +169,10 @@ export const SettingsRoute: FC = () => {
+
+ ⚠️ This setting requires{' '} + Detailed Notifications to be enabled. +
} /> @@ -223,11 +239,11 @@ export const SettingsRoute: FC = () => { disabled={!settings.detailedNotifications} tooltip={
-
+
Show or hide notifications from Bot accounts, such as @dependabot, @renovatebot, etc
-
+
⚠️ This setting requires{' '} Detailed Notifications to be enabled.
@@ -266,7 +282,7 @@ export const SettingsRoute: FC = () => { updateSetting('keyboardShortcut', evt.target.checked) } From fc6b6057b35d7a91019eb981190dcb0b0544eb6e Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Mon, 8 Jul 2024 12:05:55 -0700 Subject: [PATCH 09/11] Merge branch 'main' into feat/show-issue-no --- .../__snapshots__/Settings.test.tsx.snap | 48 ------------------- 1 file changed, 48 deletions(-) diff --git a/src/routes/__snapshots__/Settings.test.tsx.snap b/src/routes/__snapshots__/Settings.test.tsx.snap index 2241044b9..0e2fa07a7 100644 --- a/src/routes/__snapshots__/Settings.test.tsx.snap +++ b/src/routes/__snapshots__/Settings.test.tsx.snap @@ -231,54 +231,6 @@ exports[`routes/Settings.tsx should render itself & its children 1`] = `
-
-
-
- -
-
- -
-
-
From 42d0aef49b609a12a8d59036c94453c65389b0eb Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Mon, 8 Jul 2024 12:09:01 -0700 Subject: [PATCH 10/11] Merge branch 'main' into feat/show-issue-no --- .../settings/AppearanceSettings.test.tsx | 25 +++++++++++++ .../settings/AppearanceSettings.tsx | 36 +++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/src/components/settings/AppearanceSettings.test.tsx b/src/components/settings/AppearanceSettings.test.tsx index dcf8a6d07..d7ea21381 100644 --- a/src/components/settings/AppearanceSettings.test.tsx +++ b/src/components/settings/AppearanceSettings.test.tsx @@ -84,6 +84,31 @@ describe('routes/components/settings/AppearanceSettings.tsx', () => { expect(updateSetting).toHaveBeenCalledWith('showPills', false); }); + it('should toggle show number checkbox', async () => { + await act(async () => { + render( + + + + + , + ); + }); + + await screen.findByLabelText('Show number'); + + fireEvent.click(screen.getByLabelText('Show number')); + + expect(updateSetting).toHaveBeenCalledTimes(1); + expect(updateSetting).toHaveBeenCalledWith('showNumber', false); + }); + it('should toggle account hostname checkbox', async () => { await act(async () => { render( diff --git a/src/components/settings/AppearanceSettings.tsx b/src/components/settings/AppearanceSettings.tsx index 1d0da8e5a..ae0b959b7 100644 --- a/src/components/settings/AppearanceSettings.tsx +++ b/src/components/settings/AppearanceSettings.tsx @@ -1,6 +1,7 @@ import { CheckIcon, CommentIcon, + GitPullRequestIcon, IssueClosedIcon, MilestoneIcon, PaintbrushIcon, @@ -99,6 +100,41 @@ export const AppearanceSettings: FC = () => {
} /> + + settings.detailedNotifications && + updateSetting('showNumber', evt.target.checked) + } + disabled={!settings.detailedNotifications} + tooltip={ +
+
Show GitHub number for:
+
+
    +
  • + + Discussion +
  • +
  • + + Issue +
  • +
  • + + Pull Request +
  • +
+
+
+ ⚠️ This setting requires Detailed Notifications to + be enabled. +
+
+ } + /> Date: Mon, 8 Jul 2024 12:11:34 -0700 Subject: [PATCH 11/11] Merge branch 'main' into feat/show-issue-no --- .../__snapshots__/Settings.test.tsx.snap | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/src/routes/__snapshots__/Settings.test.tsx.snap b/src/routes/__snapshots__/Settings.test.tsx.snap index 0e2fa07a7..2241044b9 100644 --- a/src/routes/__snapshots__/Settings.test.tsx.snap +++ b/src/routes/__snapshots__/Settings.test.tsx.snap @@ -231,6 +231,54 @@ exports[`routes/Settings.tsx should render itself & its children 1`] = ` +
+
+
+ +
+
+ +
+
+