diff --git a/src/renderer/components/notifications/NotificationFooter.tsx b/src/renderer/components/notifications/NotificationFooter.tsx index 09f3cea4f..ca44a26ee 100644 --- a/src/renderer/components/notifications/NotificationFooter.tsx +++ b/src/renderer/components/notifications/NotificationFooter.tsx @@ -1,15 +1,12 @@ import type { FC, MouseEvent } from 'react'; import { FeedPersonIcon, MarkGithubIcon } from '@primer/octicons-react'; -import { Avatar } from '@primer/react'; +import { Avatar, RelativeTime, Stack, Text } from '@primer/react'; import { IconColor, Opacity, Size } from '../../types'; import type { Notification } from '../../typesGitHub'; import { cn } from '../../utils/cn'; -import { - formatNotificationUpdatedAt, - isNonHumanUser, -} from '../../utils/helpers'; +import { isNonHumanUser } from '../../utils/helpers'; import { openUserProfile } from '../../utils/links'; import { formatReason } from '../../utils/reason'; import { Pills } from './Pills'; @@ -23,13 +20,8 @@ export const NotificationFooter: FC = ({ }: INotificationFooter) => { const reason = formatReason(notification.reason); - const updatedAt = formatNotificationUpdatedAt(notification); - const updatedLabel = notification.subject.user - ? `${notification.subject.user.login} updated ${updatedAt}` - : `Updated ${updatedAt}`; - return ( -
+ {notification.subject.user ? ( = ({ )} )} - - {reason.title} - - - {updatedAt} + + + {reason.title} + + + + -
+ ); }; diff --git a/src/renderer/components/notifications/__snapshots__/AccountNotifications.test.tsx.snap b/src/renderer/components/notifications/__snapshots__/AccountNotifications.test.tsx.snap index 8c17fd3d6..150407d1d 100644 --- a/src/renderer/components/notifications/__snapshots__/AccountNotifications.test.tsx.snap +++ b/src/renderer/components/notifications/__snapshots__/AccountNotifications.test.tsx.snap @@ -835,7 +835,13 @@ exports[`renderer/components/notifications/AccountNotifications.tsx should rende />
- Updated - - - 8 years ago +
+ + Updated + + + • + + + May 20, 2017 + +
- Authored - - - 8 years ago +
+ + Authored + + + • + + + May 20, 2017 + +
- Updated - - - 8 years ago +
+ + Updated + + + • + + + May 20, 2017 + +
- Authored - - - 8 years ago +
+ + Authored + + + • + + + May 20, 2017 + +
- Updated - - - 7 years ago +
+ + Updated + + + • + + + May 20, 2017 + +
, "container":
- Updated - - - 7 years ago +
+ + Updated + + + • + + + May 20, 2017 + +
- Updated - - - 7 years ago +
+ + Updated + + + • + + + May 20, 2017 + +
, "container":
- Updated - - - 7 years ago +
+ + Updated + + + • + + + May 20, 2017 + +
- Updated - - - 7 years ago +
+ + Updated + + + • + + + May 20, 2017 + +
, "container":
- Updated - - - 7 years ago +
+ + Updated + + + • + + + May 20, 2017 + +
- Updated - - - 7 years ago +
+ + Updated + + + • + + + May 20, 2017 + +
, "container":
- Updated - - - 7 years ago +
+ + Updated + + + • + + + May 20, 2017 + +
- Updated - - - 7 years ago +
+ + Updated + + + • + + + May 20, 2017 + +
, "container":
- Updated - - - 7 years ago +
+ + Updated + + + • + + + May 20, 2017 + +
- Updated - - - 7 years ago +
+ + Updated + + + • + + + May 20, 2017 + +
- Updated - - - 7 years ago +
+ + Updated + + + • + + + May 20, 2017 + +
- Updated - - - 7 years ago +
+ + Updated + + + • + + + May 20, 2017 + +
- Updated - - - 7 years ago +
+ + Updated + + + • + + + May 20, 2017 + +
- Updated - - - 7 years ago +
+ + Updated + + + • + + + May 20, 2017 + +
- Updated - - - 7 years ago +
+ + Updated + + + • + + + May 20, 2017 + +
{ 'Not Planned Issue', ); }); - - describe('formatNotificationUpdatedAt', () => { - it('should use updated_at if last_read_at is null', () => { - const notification = { - ...mockSingleNotification, - last_read_at: null, - updated_at: '2021-06-23T17:00:00Z', - }; - - expect(formatNotificationUpdatedAt(notification)).toContain('ago'); - }); - - it('should return empty if all dates are null', () => { - const notification = { - ...mockSingleNotification, - last_read_at: null, - updated_at: null, - }; - - expect(formatNotificationUpdatedAt(notification)).toBe(''); - }); - - it('should return empty if unable to parse dates', () => { - const notification = { - ...mockSingleNotification, - last_read_at: 'not an iso date', - updated_at: 'not an iso date', - }; - - expect(formatNotificationUpdatedAt(notification)).toBe(''); - }); - }); }); describe('getChevronDetails', () => { diff --git a/src/renderer/utils/helpers.ts b/src/renderer/utils/helpers.ts index c95b8f7ab..a660e9f47 100644 --- a/src/renderer/utils/helpers.ts +++ b/src/renderer/utils/helpers.ts @@ -3,7 +3,6 @@ import { ChevronLeftIcon, ChevronRightIcon, } from '@primer/octicons-react'; -import { formatDistanceToNowStrict, parseISO } from 'date-fns'; import { logError, logWarn } from '../../shared/logger'; import type { Chevron, Hostname, Link } from '../types'; @@ -187,18 +186,6 @@ export function formatForDisplay(text: string[]): string { }); } -export function formatNotificationUpdatedAt( - notification: Notification, -): string { - try { - return formatDistanceToNowStrict(parseISO(notification.updated_at), { - addSuffix: true, - }); - } catch (e) {} - - return ''; -} - export function getChevronDetails( hasNotifications: boolean, isVisible: boolean,