From 34b83c8ad34759df45b38e9b735da5b2d770d3f9 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 20 Apr 2022 12:24:03 -0500 Subject: [PATCH] Onboarding: improve rendering of empty suggestions --- .../steps/suggested-accounts-step.tsx | 48 +++++++++++++------ 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/app/soapbox/features/onboarding/steps/suggested-accounts-step.tsx b/app/soapbox/features/onboarding/steps/suggested-accounts-step.tsx index 027882d21..b8ef40ccc 100644 --- a/app/soapbox/features/onboarding/steps/suggested-accounts-step.tsx +++ b/app/soapbox/features/onboarding/steps/suggested-accounts-step.tsx @@ -19,9 +19,39 @@ const SuggestedAccountsStep = ({ onNext }: { onNext: () => void }) => { dispatch(fetchSuggestions()); }, []); - if (suggestionsToRender.isEmpty()) { - return null; - } + const renderSuggestions = () => { + return ( +
+ {suggestionsToRender.map((suggestion: ImmutableMap) => ( +
+ , but it isn't + id={suggestion.get('account')} + showProfileHoverCard={false} + /> +
+ ))} +
+ ); + }; + + const renderEmpty = () => { + return ( +
+ + + +
+ ); + }; + + const renderBody = () => { + if (suggestionsToRender.isEmpty()) { + return renderEmpty(); + } else { + return renderSuggestions(); + } + }; return ( @@ -39,17 +69,7 @@ const SuggestedAccountsStep = ({ onNext }: { onNext: () => void }) => { -
- {suggestionsToRender.map((suggestion: ImmutableMap) => ( -
- , but it isn't - id={suggestion.get('account')} - showProfileHoverCard={false} - /> -
- ))} -
+ {renderBody()}