From d867a03420b58abee3a8b831b8472592ca0c969e Mon Sep 17 00:00:00 2001 From: sepeterson <10458078+sepeterson@users.noreply.github.com> Date: Mon, 29 Dec 2025 10:36:11 -0600 Subject: [PATCH 01/18] MOB-1077 refactor match screen to have a single return --- src/components/Match/Match.tsx | 236 ++++++++++++--------------------- 1 file changed, 85 insertions(+), 151 deletions(-) diff --git a/src/components/Match/Match.tsx b/src/components/Match/Match.tsx index 23200e3a9..3833a5d2d 100644 --- a/src/components/Match/Match.tsx +++ b/src/components/Match/Match.tsx @@ -66,90 +66,80 @@ const Match = ( { const latitude = observation?.privateLatitude || observation?.latitude; const taxon = topSuggestion?.taxon; + const hasNoSuggestions = !topSuggestion && otherSuggestions.length === 0; + const hasOnlyOtherSuggestions = !topSuggestion && otherSuggestions.length > 0; - // In case there are no suggestions, at all - if ( !topSuggestion && otherSuggestions.length === 0 ) { - return ( + const headerContent = suggestionsLoading + ? + : ( <> - - - { - suggestionsLoading - ? ( - - ) - : ( - - {t( "The-AI-is-not-confident-Upload-to-ask-the-community" )} - - ) - } - - - { !suggestionsLoading - && ( - - - {t( "Do-you-know-what-group-this-is-in" )} - - - - {t( "If-you-save-this-observation-and-upload-it-to-iNaturalist" )} - - - {t( "Or-you-can-try-to-get-a-clearer-photo-by-zooming-in-getting-closer" )} - - {!latitude && ( -