From 3ee05552d3c0ca0ad4f7bfc16afe9a1f55ab3283 Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Fri, 21 Jun 2024 11:54:44 -0400 Subject: [PATCH] refactor: remove null ternaries --- src/components/AccountNotifications.tsx | 38 +++++++++++++------------ src/components/icons/AuthMethodIcon.tsx | 8 ++---- src/components/icons/PlatformIcon.tsx | 8 ++---- 3 files changed, 26 insertions(+), 28 deletions(-) diff --git a/src/components/AccountNotifications.tsx b/src/components/AccountNotifications.tsx index 8eda15d1d..e83f0c55a 100644 --- a/src/components/AccountNotifications.tsx +++ b/src/components/AccountNotifications.tsx @@ -99,26 +99,28 @@ export const AccountNotifications: FC = ( )} - {showAccountNotifications - ? groupByRepository - ? Object.values(groupedNotifications).map((repoNotifications) => { - const repoSlug = repoNotifications[0].repository.full_name; + {showAccountNotifications && ( + <> + {groupByRepository + ? Object.values(groupedNotifications).map((repoNotifications) => { + const repoSlug = repoNotifications[0].repository.full_name; - return ( - + ); + }) + : notifications.map((notification) => ( + - ); - }) - : notifications.map((notification) => ( - - )) - : null} + ))} + + )} ); }; diff --git a/src/components/icons/AuthMethodIcon.tsx b/src/components/icons/AuthMethodIcon.tsx index 85021bfbf..90251bd79 100644 --- a/src/components/icons/AuthMethodIcon.tsx +++ b/src/components/icons/AuthMethodIcon.tsx @@ -11,11 +11,9 @@ export interface IAuthMethodIcon { export const AuthMethodIcon: FC = (props: IAuthMethodIcon) => { return ( - {props.type === 'GitHub App' ? : null} - {props.type === 'Personal Access Token' ? ( - - ) : null} - {props.type === 'OAuth App' ? : null} + {props.type === 'GitHub App' && } + {props.type === 'Personal Access Token' && } + {props.type === 'OAuth App' && } ); }; diff --git a/src/components/icons/PlatformIcon.tsx b/src/components/icons/PlatformIcon.tsx index 3fb341045..7fb50501c 100644 --- a/src/components/icons/PlatformIcon.tsx +++ b/src/components/icons/PlatformIcon.tsx @@ -11,12 +11,10 @@ export interface IPlatformIcon { export const PlatformIcon: FC = (props: IPlatformIcon) => { return ( - {props.type === 'GitHub Cloud' ? ( - - ) : null} - {props.type === 'GitHub Enterprise Server' ? ( + {props.type === 'GitHub Cloud' && } + {props.type === 'GitHub Enterprise Server' && ( - ) : null} + )} ); };