From 7f6b88894f21a024e893466d990cdf514b86bd95 Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Tue, 4 Jun 2024 08:00:58 -0400 Subject: [PATCH 1/2] refactor: update notification footer styles --- src/components/NotificationRow.tsx | 177 +- .../NotificationRow.test.tsx.snap | 3740 ++++++++--------- src/utils/constants.ts | 2 +- 3 files changed, 1867 insertions(+), 2052 deletions(-) diff --git a/src/components/NotificationRow.tsx b/src/components/NotificationRow.tsx index 1a5af4379..20b04bd89 100644 --- a/src/components/NotificationRow.tsx +++ b/src/components/NotificationRow.tsx @@ -114,111 +114,104 @@ export const NotificationRow: FC = ({ notification, hostname }) => {
openNotification()} onKeyDown={() => openNotification()} >
{notification.subject.title}
-
- - - {notification.subject.user ? ( - - {`${notification.subject.user.login}'s - - ) : ( - - + + {notification.subject.user ? ( + + {`${notification.subject.user.login}'s + + ) : ( + + + + )} + {reason.title} + {updatedAt} + {notification.subject?.linkedIssues?.length > 0 && ( + + - {updatedAt} - {notification.subject?.linkedIssues?.length > 0 && ( - - - - )} - {notification.subject.reviews - ? notification.subject.reviews.map((review) => { - const icon = getPullRequestReviewIcon(review); - if (!icon) { - return null; - } - - return ( - { + const icon = getPullRequestReviewIcon(review); + if (!icon) { + return null; + } + + return ( + + - - ); - }) - : null} - {notification.subject?.comments > 0 && ( - - - - )} - {notification.subject?.labels?.length > 0 && ( - - - - )} - + + {review.users.length} + + + ); + }) + : null} + {notification.subject?.comments > 0 && ( + + + + )} + {notification.subject?.labels?.length > 0 && ( + + + + )}
diff --git a/src/components/__snapshots__/NotificationRow.test.tsx.snap b/src/components/__snapshots__/NotificationRow.test.tsx.snap index c2cac717f..23c316b69 100644 --- a/src/components/__snapshots__/NotificationRow.test.tsx.snap +++ b/src/components/__snapshots__/NotificationRow.test.tsx.snap @@ -33,307 +33,20 @@ exports[`components/NotificationRow.tsx linked issues/prs should render when lin
I am a robot and this is a test!
- - - - - - Updated - - - over 6 years ago - - - - - - - - - - - - - - - - - - -
-
-
- - - -
- - - , - "container":
-
-
- - - - -
-
-
- I am a robot and this is a test! -
-
- - @@ -353,22 +66,18 @@ exports[`components/NotificationRow.tsx linked issues/prs should render when lin Updated - + over 6 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], -} -`; - -exports[`components/NotificationRow.tsx linked issues/prs should render when linked to one issue/pr 1`] = ` -{ - "asFragment": [Function], - "baseElement": -
-
-
- - - - -
-
-
- I am a robot and this is a test! -
-
- - - - - - - Updated - - - over 6 years ago - - - - - - - - - - - - - - - - - - -
-
-
- - - +
+
+ I am a robot and this is a test! +
+
+ + + + + + Updated + + + over 6 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], +} +`; + +exports[`components/NotificationRow.tsx linked issues/prs should render when linked to one issue/pr 1`] = ` +{ + "asFragment": [Function], + "baseElement": +
+
- I am a robot and this is a test! + + + +
- + I am a robot and this is a test! +
+
@@ -978,22 +667,18 @@ exports[`components/NotificationRow.tsx linked issues/prs should render when lin Updated - + over 6 years ago
+
+
+ + + +
+
+ + , + "container":
+
+
+ + + + +
+
+
+ I am a robot and this is a test! +
+
+ + + + + + Updated + + + over 6 years ago + + + + + + + + + + + + + + + +
@@ -1283,158 +1235,147 @@ exports[`components/NotificationRow.tsx notification labels should render labels
I am a robot and this is a test!
+ + + + + Updated + + + over 6 years ago + - + - - + + + - - + + 1 + + + + - - + + 2 + + + + - + class="mr-1 text-gray-500 dark:text-gray-300" + fill="currentColor" + focusable="false" + height="12" + role="img" + style="display: inline-block; user-select: none; vertical-align: text-bottom; overflow: visible;" + viewBox="0 0 16 16" + width="12" + > + + + 2 +
@@ -1538,158 +1479,147 @@ exports[`components/NotificationRow.tsx notification labels should render labels
I am a robot and this is a test!
+ + + - + Updated + + + over 6 years ago + + + - - - - - + + + - - + + 1 + + + + - + + + + 2 + + + +
@@ -1850,130 +1780,120 @@ exports[`components/NotificationRow.tsx rendering for notification comments coun
I am a robot and this is a test!
+ + + + + Updated + + + over 6 years ago + - + - - + + + - - + + 1 + + + + - + + + 1 +
@@ -2077,130 +1997,120 @@ exports[`components/NotificationRow.tsx rendering for notification comments coun
I am a robot and this is a test!
+ + + - + Updated + + + over 6 years ago + + + - - + + + - - + + 1 + + + + - + + + 1 +
@@ -2361,130 +2271,120 @@ exports[`components/NotificationRow.tsx rendering for notification comments coun
I am a robot and this is a test!
+ + + + + Updated + + + over 6 years ago + + + + - + - - - - - + + + - + + + 2 +
@@ -2588,130 +2488,120 @@ exports[`components/NotificationRow.tsx rendering for notification comments coun
I am a robot and this is a test!
+ + + - + Updated + + + over 6 years ago + + + - - + + + - - + + 1 + + + + - + + + 2 +
@@ -2872,104 +2762,95 @@ exports[`components/NotificationRow.tsx rendering for notification comments coun
I am a robot and this is a test!
+ + + + + Updated + + + over 6 years ago + - + - - + + + - + + + 1 +
@@ -3073,104 +2954,95 @@ exports[`components/NotificationRow.tsx rendering for notification comments coun
I am a robot and this is a test!
+ + + - + Updated + + + over 6 years ago + + + + + + - - - - + 1 +
@@ -3331,98 +3203,90 @@ exports[`components/NotificationRow.tsx should render itself & its children 1`]
I am a robot and this is a test!
- - gitify-app's avatar - - - Updated - - - over 6 years ago - - + + + Updated + + + over 6 years ago + + + - - + + 1 + + + + - + + + 1 +
@@ -3526,98 +3390,90 @@ exports[`components/NotificationRow.tsx should render itself & its children 1`]
I am a robot and this is a test!
- - gitify-app's avatar - - - Updated - - - over 6 years ago - - + + + Updated + + + over 6 years ago + + + - - + + 1 + + + + - + + + 1 +
@@ -3778,98 +3634,90 @@ exports[`components/NotificationRow.tsx should render itself & its children when
I am a robot and this is a test!
- - gitify-app's avatar - - - Updated - - - over 6 years ago - - + + + Updated + + + over 6 years ago + + + - - + + 1 + + + + - + + + 1 +
@@ -3973,98 +3821,90 @@ exports[`components/NotificationRow.tsx should render itself & its children when
I am a robot and this is a test!
- - gitify-app's avatar - - - Updated - - - over 6 years ago - - + + + Updated + + + over 6 years ago + + + - - + + 1 + + + + - + + + 1 +
@@ -4225,104 +4065,95 @@ exports[`components/NotificationRow.tsx should render itself & its children with
I am a robot and this is a test!
+ + + + Updated + + + over 6 years ago + + - + - - + + + - + + + 1 +
@@ -4426,104 +4257,95 @@ exports[`components/NotificationRow.tsx should render itself & its children with
I am a robot and this is a test!
+ + + - + Updated + + + over 6 years ago + + + - - + + + - + + + 1 +
diff --git a/src/utils/constants.ts b/src/utils/constants.ts index a7295819e..bb1567670 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -25,7 +25,7 @@ export const Constants = { READ_CLASS_NAME: 'opacity-50 dark:opacity-50', PILL_CLASS_NAME: - 'rounded-full text-xs px-2 bg-gray-100 hover:bg-gray-200 dark:bg-gray-800 dark:hover:bg-gray-700', + 'rounded-full text-xs px-1.5 bg-gray-100 hover:bg-gray-200 dark:bg-gray-800 dark:hover:bg-gray-700', // GitHub Docs GITHUB_DOCS: { From 9659723ccdcd9939046632dcccf5cc7ad20d5c1f Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Tue, 4 Jun 2024 09:18:24 -0400 Subject: [PATCH 2/2] refactor: update notification footer styles --- src/components/NotificationRow.tsx | 124 +- .../NotificationRow.test.tsx.snap | 2612 +++++++++-------- 2 files changed, 1405 insertions(+), 1331 deletions(-) diff --git a/src/components/NotificationRow.tsx b/src/components/NotificationRow.tsx index 20b04bd89..59a9fdfff 100644 --- a/src/components/NotificationRow.tsx +++ b/src/components/NotificationRow.tsx @@ -126,7 +126,7 @@ export const NotificationRow: FC = ({ notification, hostname }) => { {notification.subject.title}
-
+
{notification.subject.user ? ( = ({ notification, hostname }) => { )} {reason.title} {updatedAt} - {notification.subject?.linkedIssues?.length > 0 && ( - - - - )} - {notification.subject.reviews - ? notification.subject.reviews.map((review) => { - const icon = getPullRequestReviewIcon(review); - if (!icon) { - return null; - } - - return ( - - - - ); - }) - : null} - {notification.subject?.comments > 0 && ( - - - - )} - {notification.subject?.labels?.length > 0 && ( - - - - )} + + {notification.subject?.linkedIssues?.length > 0 && ( + + + + )} + {notification.subject.reviews + ? notification.subject.reviews.map((review) => { + const icon = getPullRequestReviewIcon(review); + if (!icon) { + return null; + } + + return ( + + + + ); + }) + : null} + {notification.subject?.comments > 0 && ( + + + + )} + {notification.subject?.labels?.length > 0 && ( + + + + )} +
diff --git a/src/components/__snapshots__/NotificationRow.test.tsx.snap b/src/components/__snapshots__/NotificationRow.test.tsx.snap index 23c316b69..751812d56 100644 --- a/src/components/__snapshots__/NotificationRow.test.tsx.snap +++ b/src/components/__snapshots__/NotificationRow.test.tsx.snap @@ -43,7 +43,7 @@ exports[`components/NotificationRow.tsx linked issues/prs should render when lin I am a robot and this is a test!
- - - - + + - - - - 1 - - - - + + - - - - 1 - - - - + + - - - - 2 - - - + + + 2 + + + - + + + + 2 + +
@@ -315,7 +319,7 @@ exports[`components/NotificationRow.tsx linked issues/prs should render when lin I am a robot and this is a test!
- - - - + + - - - - 1 - - - - + + - - - - 1 - - - - + + - - - - 2 - - - + + + 2 + + + - + + + + 2 + +
@@ -644,7 +652,7 @@ exports[`components/NotificationRow.tsx linked issues/prs should render when lin I am a robot and this is a test!
- - - - + + - - - - 1 - - - - + + - - - - 1 - - - - + + - - - - 2 - - - + + + 2 + + + - + + + + 2 + +
@@ -916,7 +928,7 @@ exports[`components/NotificationRow.tsx linked issues/prs should render when lin I am a robot and this is a test!
- - - - + + - - - - 1 - - - - + + - - - - 1 - - - - + + - - - - 2 - - - + + + 2 + + + - + + + + 2 + +
@@ -1245,7 +1261,7 @@ exports[`components/NotificationRow.tsx notification labels should render labels I am a robot and this is a test!
- - - - + + - - - - 1 - - - - + + - - - - 2 - - - + + + 2 + + + - + + + + 2 + +
@@ -1489,7 +1509,7 @@ exports[`components/NotificationRow.tsx notification labels should render labels I am a robot and this is a test!
- - - - + + - - - - 1 - - - - + + - - - - 2 - - - + + + 2 + + + - + + + + 2 + +
@@ -1790,7 +1814,7 @@ exports[`components/NotificationRow.tsx rendering for notification comments coun I am a robot and this is a test!
- - - - + + - - - - 1 - - - - + + - - - - 1 - + + + + 1 + +
@@ -2007,7 +2035,7 @@ exports[`components/NotificationRow.tsx rendering for notification comments coun I am a robot and this is a test!
- - - - + + - - - - 1 - - - - + + - - - - 1 - + + + + 1 + +
@@ -2281,7 +2313,7 @@ exports[`components/NotificationRow.tsx rendering for notification comments coun I am a robot and this is a test!
- - - - + + - - - - 1 - - - - + + - - - - 2 - + + + + 2 + +
@@ -2498,7 +2534,7 @@ exports[`components/NotificationRow.tsx rendering for notification comments coun I am a robot and this is a test!
- - - - + + - - - - 1 - - - - + + - - - - 2 - + + + + 2 + +
@@ -2772,7 +2812,7 @@ exports[`components/NotificationRow.tsx rendering for notification comments coun I am a robot and this is a test!
- - - - + + - - - - 1 - + + + + 1 + +
@@ -2964,7 +3008,7 @@ exports[`components/NotificationRow.tsx rendering for notification comments coun I am a robot and this is a test!
- - - - + + - - - - 1 - + + + + 1 + +
@@ -3213,7 +3261,7 @@ exports[`components/NotificationRow.tsx should render itself & its children 1`] I am a robot and this is a test!
- - - - + + - - - - 1 - + + + + 1 + +
@@ -3400,7 +3452,7 @@ exports[`components/NotificationRow.tsx should render itself & its children 1`] I am a robot and this is a test!
- - - - + + - - - - 1 - + + + + 1 + +
@@ -3644,7 +3700,7 @@ exports[`components/NotificationRow.tsx should render itself & its children when I am a robot and this is a test!
- - - - + + - - - - 1 - + + + + 1 + +
@@ -3831,7 +3891,7 @@ exports[`components/NotificationRow.tsx should render itself & its children when I am a robot and this is a test!
- - - - + + - - - - 1 - + + + + 1 + +
@@ -4075,7 +4139,7 @@ exports[`components/NotificationRow.tsx should render itself & its children with I am a robot and this is a test!
- - - - + + - - - - 1 - + + + + 1 + +
@@ -4267,7 +4335,7 @@ exports[`components/NotificationRow.tsx should render itself & its children with I am a robot and this is a test!
- - - - + + - - - - 1 - + + + + 1 + +