diff --git a/src/renderer/components/avatars/AvatarWithFallback.tsx b/src/renderer/components/avatars/AvatarWithFallback.tsx index 476d71d74..93a51ae02 100644 --- a/src/renderer/components/avatars/AvatarWithFallback.tsx +++ b/src/renderer/components/avatars/AvatarWithFallback.tsx @@ -26,6 +26,7 @@ export const AvatarWithFallback: React.FC = ({ const [isBroken, setIsBroken] = useState(false); const isNonHuman = isNonHumanUser(userType); + const DefaultUserIcon = isNonHuman ? MarkGithubIcon : FeedPersonIcon; // TODO explore using AnchoredOverlay component (https://primer.style/components/anchored-overlay/react/alpha) to render Avatar Card on hover return ( @@ -36,11 +37,7 @@ export const AvatarWithFallback: React.FC = ({ data-testid="avatar" > {!src || isBroken ? ( - isNonHuman ? ( - - ) : ( - - ) + ) : ( = ({ )} - {counter && ( + {counter ? ( {counter} - )} + ) : null} ) ); diff --git a/src/renderer/components/metrics/MetricPill.tsx b/src/renderer/components/metrics/MetricPill.tsx index 9719565fb..1840c51a3 100644 --- a/src/renderer/components/metrics/MetricPill.tsx +++ b/src/renderer/components/metrics/MetricPill.tsx @@ -23,7 +23,9 @@ export const MetricPill: FC = (props: IMetricPill) => { > - {props.metric && {props.metric}} + {props.metric ? ( + {props.metric} + ) : null} ); diff --git a/src/renderer/components/notifications/NotificationRow.tsx b/src/renderer/components/notifications/NotificationRow.tsx index 14c9ebcaa..a1e12979c 100644 --- a/src/renderer/components/notifications/NotificationRow.tsx +++ b/src/renderer/components/notifications/NotificationRow.tsx @@ -85,8 +85,9 @@ export const NotificationRow: FC = ({ ? `#${notification.subject.number}` : ''; - const notificationTitle = - `${notification.subject.title} ${notificationNumber && `[${notificationNumber}]`}`.trim(); + const notificationTitle = notificationNumber + ? `${notification.subject.title} [${notificationNumber}]` + : notification.subject.title; const groupByDate = settings.groupBy === GroupBy.DATE; diff --git a/src/renderer/typesGitHub.ts b/src/renderer/typesGitHub.ts index f2da59075..d38ff2c27 100644 --- a/src/renderer/typesGitHub.ts +++ b/src/renderer/typesGitHub.ts @@ -94,7 +94,7 @@ export type PullRequestReviewAuthorAssociation = | 'NONE' | 'OWNER'; -// TODO: Add explicit types for GitHub API response vs Gitify Notifications object +// TODO: #828 Add explicit types for GitHub API response vs Gitify Notifications object export type Notification = GitHubNotification & GitifyNotification; export interface GitHubNotification { diff --git a/src/renderer/utils/auth/utils.test.ts b/src/renderer/utils/auth/utils.test.ts index b17ed3c11..9e38b5ff6 100644 --- a/src/renderer/utils/auth/utils.test.ts +++ b/src/renderer/utils/auth/utils.test.ts @@ -101,7 +101,9 @@ describe('renderer/utils/auth/utils.ts', () => { }); await expect(async () => await auth.authGitHub()).rejects.toEqual( - "Oops! Something went wrong and we couldn't log you in using GitHub. Please try again. Reason: The redirect_uri is missing or invalid. Docs: https://docs.github.com/en/developers/apps/troubleshooting-oauth-errors", + new Error( + "Oops! Something went wrong and we couldn't log you in using GitHub. Please try again. Reason: The redirect_uri is missing or invalid. Docs: https://docs.github.com/en/developers/apps/troubleshooting-oauth-errors", + ), ); expect(openExternalLinkMock).toHaveBeenCalledTimes(1); diff --git a/src/renderer/utils/auth/utils.ts b/src/renderer/utils/auth/utils.ts index d75d6c2ad..9fcc79714 100644 --- a/src/renderer/utils/auth/utils.ts +++ b/src/renderer/utils/auth/utils.ts @@ -54,7 +54,9 @@ export function authGitHub( }); } else if (error) { reject( - `Oops! Something went wrong and we couldn't log you in using GitHub. Please try again. Reason: ${errorDescription} Docs: ${errorUri}`, + new Error( + `Oops! Something went wrong and we couldn't log you in using GitHub. Please try again. Reason: ${errorDescription} Docs: ${errorUri}`, + ), ); } }; @@ -257,9 +259,7 @@ export function getNewOAuthAppURL(hostname: Hostname): Link { } export function isValidHostname(hostname: Hostname) { - return /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$/i.test( - hostname, - ); + return /^([A-Z0-9]([A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}$/i.test(hostname); } export function isValidClientId(clientId: ClientID) { diff --git a/src/renderer/utils/constants.ts b/src/renderer/utils/constants.ts index 79e9d10d8..afaee132a 100644 --- a/src/renderer/utils/constants.ts +++ b/src/renderer/utils/constants.ts @@ -1,5 +1,4 @@ -import type { Link } from '../types'; -import type { ClientID, ClientSecret, Hostname } from '../types'; +import type { ClientID, ClientSecret, Hostname, Link } from '../types'; export const Constants = { REPO_SLUG: 'gitify-app/gitify',