+
+ I am a robot and this is a test! +
+
+ + + Subscribed + + - + + Updated over 6 years ago
diff --git a/src/routes/__snapshots__/Notifications.test.tsx.snap b/src/routes/__snapshots__/Notifications.test.tsx.snap index ab3a6744d..6bf402178 100644 --- a/src/routes/__snapshots__/Notifications.test.tsx.snap +++ b/src/routes/__snapshots__/Notifications.test.tsx.snap @@ -89,6 +89,10 @@ exports[`routes/Notifications.tsx should render itself & its children (with noti "title": "I am a robot and this is a test!", "type": "Issue", "url": "https://api.github.com/repos/manosim/notifications-test/issues/1", + "user": { + "avatar_url": "https://avatars0.githubusercontent.com/u/6333409?v=3", + "login": "manosim", + }, }, "subscription_url": "https://api.github.com/notifications/threads/138661096/subscription", "unread": true, From ea825ba976bbc068f59a8aa5f507f2990c444541 Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Wed, 3 Apr 2024 01:45:18 -0400 Subject: [PATCH 09/13] Merge remote-tracking branch 'origin/main' into feature/user-avatar --- src/hooks/useNotifications.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/useNotifications.test.ts b/src/hooks/useNotifications.test.ts index c1b00614b..11bbdae63 100644 --- a/src/hooks/useNotifications.test.ts +++ b/src/hooks/useNotifications.test.ts @@ -286,7 +286,7 @@ describe('hooks/useNotifications.ts', () => { databaseId: 2297637, createdAt: '2022-03-04T20:39:44Z', author: { - login: 'commenst-user', + login: 'comment-user', url: 'https://github.com/comment-user', avatar_url: 'https://avatars.githubusercontent.com/u/1?v=4', From e52395c168ecc5193c39915866f9e66139fa64d5 Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Wed, 3 Apr 2024 02:07:41 -0400 Subject: [PATCH 10/13] Merge remote-tracking branch 'origin/main' into feature/user-avatar --- src/components/NotificationRow.test.tsx | 34 +++++++++---------- src/components/NotificationRow.tsx | 15 ++++---- .../NotificationRow.test.tsx.snap | 15 ++++---- 3 files changed, 34 insertions(+), 30 deletions(-) diff --git a/src/components/NotificationRow.test.tsx b/src/components/NotificationRow.test.tsx index 3444ee828..1e742eff7 100644 --- a/src/components/NotificationRow.test.tsx +++ b/src/components/NotificationRow.test.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import * as TestRenderer from 'react-test-renderer'; -import { act, fireEvent, render } from '@testing-library/react'; +import { fireEvent, render } from '@testing-library/react'; import * as helpers from '../utils/helpers'; @@ -165,7 +165,7 @@ describe('components/NotificationRow.tsx', () => { expect(unsubscribeNotification).toHaveBeenCalledTimes(1); }); - it('should open notification user profile', async () => { + it('should open notification user profile', () => { const props = { notification: { ...mockedSingleNotification, @@ -182,23 +182,21 @@ describe('components/NotificationRow.tsx', () => { hostname: 'github.com', }; - let getByLabelText; - - await act(async () => { - const { getByLabelText: getByLabelTextLocal } = render( - - - , - ); - getByLabelText = getByLabelTextLocal; - }); + const { getByTitle } = render( + + + , + ); - fireEvent.click(getByLabelText('View User Profile')); + fireEvent.click(getByTitle('View User Profile')); expect(shell.openExternal).toHaveBeenCalledTimes(1); + expect(shell.openExternal).toHaveBeenCalledWith( + props.notification.subject.user.html_url, + ); }); }); diff --git a/src/components/NotificationRow.tsx b/src/components/NotificationRow.tsx index 763d2b67e..ce1f47911 100644 --- a/src/components/NotificationRow.tsx +++ b/src/components/NotificationRow.tsx @@ -101,15 +101,18 @@ export const NotificationRow: React.FC = ({ - {notification.subject.user && ( - openExternalLink(notification.subject.user.html_url) } - /> + > + + )} {updatedAtLabel} diff --git a/src/components/__snapshots__/NotificationRow.test.tsx.snap b/src/components/__snapshots__/NotificationRow.test.tsx.snap index f3f359378..0f2fc505f 100644 --- a/src/components/__snapshots__/NotificationRow.test.tsx.snap +++ b/src/components/__snapshots__/NotificationRow.test.tsx.snap @@ -62,13 +62,16 @@ exports[`components/NotificationRow.tsx should render itself & its children with className="flex ml-1" title="manosim updated over 6 years ago" > - + title="View User Profile" + > + + updated over 6 years ago From 1d089aef19cba536aed31423cfd519fee0debcf5 Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Wed, 3 Apr 2024 02:14:08 -0400 Subject: [PATCH 11/13] revert --- .husky/pre-commit | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 000000000..c6254913e --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,2 @@ +pnpx lint-staged +pnpm test -- --onlyChanged From 7eadba58cd5445f84039379eed0982929c5d7bd3 Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Wed, 3 Apr 2024 02:16:02 -0400 Subject: [PATCH 12/13] revert --- .husky/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index c6254913e..88c91d674 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,2 +1,2 @@ pnpx lint-staged -pnpm test -- --onlyChanged +pnpm test -- --onlyChanged \ No newline at end of file From fdfb1275922eda61d7af626ce79688bc5e2fc497 Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Fri, 5 Apr 2024 13:19:17 -0400 Subject: [PATCH 13/13] feat: simplify notification footer format --- src/components/NotificationRow.tsx | 36 ++++++---- .../NotificationRow.test.tsx.snap | 67 +++++++++++++------ .../__snapshots__/github-api.test.ts.snap | 24 +++---- src/utils/github-api.ts | 24 +++---- 4 files changed, 94 insertions(+), 57 deletions(-) diff --git a/src/components/NotificationRow.tsx b/src/components/NotificationRow.tsx index 50b424f25..92ba9ca91 100644 --- a/src/components/NotificationRow.tsx +++ b/src/components/NotificationRow.tsx @@ -1,6 +1,11 @@ import React, { useCallback, useContext } from 'react'; import { formatDistanceToNow, parseISO } from 'date-fns'; -import { CheckIcon, BellSlashIcon, ReadIcon } from '@primer/octicons-react'; +import { + CheckIcon, + BellSlashIcon, + ReadIcon, + FeedPersonIcon, +} from '@primer/octicons-react'; import { formatReason, @@ -62,13 +67,10 @@ export const NotificationRow: React.FC = ({ const updatedAt = formatDistanceToNow(parseISO(notification.updated_at), { addSuffix: true, }); - const updatedAtLabel = notification.subject.user - ? `updated ${updatedAt}` - : `Updated ${updatedAt}`; const updatedLabel = notification.subject.user - ? `${notification.subject.user.login} ${updatedAtLabel}` - : updatedAtLabel; + ? `${notification.subject.user.login} updated ${updatedAt}` + : `Updated ${updatedAt}`; const notificationTitle = formatForDisplay([ notification.subject.state, notification.subject.type, @@ -95,12 +97,8 @@ export const NotificationRow: React.FC = ({
- - {reason.type} - - - - - {notification.subject.user && ( + + {notification.subject.user ? ( @@ -108,13 +106,23 @@ export const NotificationRow: React.FC = ({ } > + ) : ( + + + )} - {updatedAtLabel} + + {reason.type} + + {updatedAt}
diff --git a/src/components/__snapshots__/NotificationRow.test.tsx.snap b/src/components/__snapshots__/NotificationRow.test.tsx.snap index 0f2fc505f..44b9c1e2b 100644 --- a/src/components/__snapshots__/NotificationRow.test.tsx.snap +++ b/src/components/__snapshots__/NotificationRow.test.tsx.snap @@ -52,14 +52,7 @@ exports[`components/NotificationRow.tsx should render itself & its children with className="flex items-center" > - Subscribed - - - - - updated over 6 years ago + + Updated + + + over 6 years ago +