mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-06-22 06:28:42 -04:00
Remove text for non-new species (#2658)
* Do not show labels for non-new species or organisms * Show activity indicator while top suggestion loading
This commit is contained in:
@@ -8,7 +8,7 @@ import SuggestionsResult from "./SuggestionsResult";
|
||||
|
||||
const AdditionalSuggestionsScroll = ( {
|
||||
otherSuggestions,
|
||||
otherSuggestionsLoading,
|
||||
suggestionsLoading,
|
||||
onSuggestionChosen
|
||||
} ) => {
|
||||
const { t } = useTranslation( );
|
||||
@@ -41,7 +41,7 @@ const AdditionalSuggestionsScroll = ( {
|
||||
);
|
||||
};
|
||||
|
||||
if ( !otherSuggestionsLoading && otherSuggestions?.length === 0 ) {
|
||||
if ( !suggestionsLoading && otherSuggestions?.length === 0 ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ const AdditionalSuggestionsScroll = ( {
|
||||
return (
|
||||
<View className="mt-4 mb-7">
|
||||
<Heading3 className="mx-5 mb-3">{t( "It-might-also-be" )}</Heading3>
|
||||
{!otherSuggestionsLoading
|
||||
{!suggestionsLoading
|
||||
? (
|
||||
<CustomFlashList
|
||||
ListHeaderComponent={renderHeader}
|
||||
|
||||
@@ -3,7 +3,9 @@ import LocationSection
|
||||
from "components/ObsDetailsDefaultMode/LocationSection/LocationSection.tsx";
|
||||
import MapSection
|
||||
from "components/ObsDetailsDefaultMode/MapSection/MapSection";
|
||||
import { Button, Divider, ScrollViewWrapper } from "components/SharedComponents";
|
||||
import {
|
||||
ActivityIndicator, Button, Divider, ScrollViewWrapper
|
||||
} from "components/SharedComponents";
|
||||
import { View } from "components/styledComponents";
|
||||
import _ from "lodash";
|
||||
import React from "react";
|
||||
@@ -24,7 +26,7 @@ type Props = {
|
||||
handleLocationPickerPressed: ( ) => void,
|
||||
topSuggestion: Object,
|
||||
otherSuggestions: Array<Object>,
|
||||
otherSuggestionsLoading: boolean,
|
||||
suggestionsLoading: boolean,
|
||||
onSuggestionChosen: ( ) => void
|
||||
}
|
||||
|
||||
@@ -36,7 +38,7 @@ const Match = ( {
|
||||
handleLocationPickerPressed,
|
||||
topSuggestion,
|
||||
otherSuggestions,
|
||||
otherSuggestionsLoading,
|
||||
suggestionsLoading,
|
||||
onSuggestionChosen
|
||||
}: Props ) => {
|
||||
const { t } = useTranslation( );
|
||||
@@ -50,7 +52,13 @@ const Match = ( {
|
||||
<ScrollViewWrapper>
|
||||
<Divider />
|
||||
<View className="p-5">
|
||||
<MatchHeader topSuggestion={topSuggestion} />
|
||||
{
|
||||
suggestionsLoading
|
||||
? (
|
||||
<ActivityIndicator size={33} />
|
||||
)
|
||||
: <MatchHeader topSuggestion={topSuggestion} />
|
||||
}
|
||||
</View>
|
||||
<PhotosSection
|
||||
taxon={taxon}
|
||||
@@ -87,7 +95,7 @@ const Match = ( {
|
||||
<AdditionalSuggestionsScroll
|
||||
onSuggestionChosen={onSuggestionChosen}
|
||||
otherSuggestions={otherSuggestions}
|
||||
otherSuggestionsLoading={otherSuggestionsLoading}
|
||||
suggestionsLoading={suggestionsLoading}
|
||||
/>
|
||||
{!latitude && (
|
||||
<Button
|
||||
|
||||
@@ -242,7 +242,7 @@ const MatchContainer = ( ) => {
|
||||
const taxon = topSuggestion?.taxon;
|
||||
const taxonId = taxon?.id;
|
||||
|
||||
const otherSuggestionsLoading = fetchStatus === FETCH_STATUS_LOADING;
|
||||
const suggestionsLoading = fetchStatus === FETCH_STATUS_LOADING;
|
||||
// Remove the top suggestion from the list of other suggestions
|
||||
const otherSuggestions = orderedSuggestions
|
||||
.filter( suggestion => suggestion.taxon.id !== taxonId );
|
||||
@@ -273,7 +273,7 @@ const MatchContainer = ( ) => {
|
||||
handleLocationPickerPressed={handleLocationPickerPressed}
|
||||
topSuggestion={topSuggestion}
|
||||
otherSuggestions={otherSuggestions}
|
||||
otherSuggestionsLoading={otherSuggestionsLoading}
|
||||
suggestionsLoading={suggestionsLoading}
|
||||
/>
|
||||
{renderPermissionsGate( { onPermissionGranted: openLocationPicker } )}
|
||||
</>
|
||||
|
||||
@@ -67,28 +67,16 @@ const MatchHeader = ( { topSuggestion }: Props ) => {
|
||||
if ( confidenceType === "observed" ) {
|
||||
if ( rankDescription === "new_species" ) {
|
||||
congratulatoryText = t( "You-observed-a-new-species" );
|
||||
} else if ( rankDescription === "species" ) {
|
||||
congratulatoryText = t( "You-observed-a-species" );
|
||||
} else if ( rankDescription === "organism" ) {
|
||||
congratulatoryText = t( "You-observed-an-organism-in-this-group" );
|
||||
}
|
||||
}
|
||||
if ( confidenceType === "likely_observed" ) {
|
||||
if ( rankDescription === "new_species" ) {
|
||||
congratulatoryText = t( "You-likely-observed-a-new-species" );
|
||||
} else if ( rankDescription === "species" ) {
|
||||
congratulatoryText = t( "You-likely-observed-a-species" );
|
||||
} else if ( rankDescription === "organism" ) {
|
||||
congratulatoryText = t( "You-likely-observed-an-organism-in-this-group" );
|
||||
}
|
||||
}
|
||||
if ( confidenceType === "may_have_observed" ) {
|
||||
if ( rankDescription === "new_species" ) {
|
||||
congratulatoryText = t( "You-may-have-observed-a-new-species" );
|
||||
} else if ( rankDescription === "species" ) {
|
||||
congratulatoryText = t( "You-may-have-observed-a-species" );
|
||||
} else if ( rankDescription === "organism" ) {
|
||||
congratulatoryText = t( "You-may-have-observed-an-organism-in-this-group" );
|
||||
}
|
||||
}
|
||||
return congratulatoryText;
|
||||
|
||||
@@ -1512,11 +1512,7 @@ You-have-opted-out-of-the-Community-Taxon = You have opted out of the Community
|
||||
You-havent-joined-any-projects-yet = You haven’t joined any projects yet!
|
||||
You-havent-observed-any-species-yet = You haven't observed any species yet.
|
||||
You-likely-observed-a-new-species = You likely observed a new species!
|
||||
You-likely-observed-a-species = You likely observed a species
|
||||
You-likely-observed-an-organism-in-this-group = You likely observed an organism in this group
|
||||
You-may-have-observed-a-new-species = You may have observed a new species!
|
||||
You-may-have-observed-a-species = You may have observed a species
|
||||
You-may-have-observed-an-organism-in-this-group = You may have observed an organism in this group
|
||||
You-must-be-logged-in-to-view-messages = You must be logged in to view messages
|
||||
You-must-install-Google-Play-Services-to-sign-in-with-Google = You must install Google Play Services to sign in with Google.
|
||||
# Error message when you try to do something that requires an Internet
|
||||
@@ -1525,8 +1521,6 @@ You-need-an-Internet-connection-to-do-that = You need an Internet connection to
|
||||
# Error message when you try to do something that requires log in
|
||||
You-need-log-in-to-do-that = You need to log in to do that.
|
||||
You-observed-a-new-species = You observed a new species!
|
||||
You-observed-a-species = You observed a species
|
||||
You-observed-an-organism-in-this-group = You observed an organism in this group
|
||||
You-will-see-notifications = You’ll see notifications here once you log in & upload observations.
|
||||
Your-donation-to-iNaturalist = Your donation to iNaturalist supports the improvement and stability of the mobile apps and website that connects millions of people to nature and enables the protection of biodiversity worldwide!
|
||||
Your-email-is-confirmed = Your email is confirmed! Please log in to continue.
|
||||
|
||||
@@ -914,18 +914,12 @@
|
||||
"You-havent-joined-any-projects-yet": "You haven’t joined any projects yet!",
|
||||
"You-havent-observed-any-species-yet": "You haven't observed any species yet.",
|
||||
"You-likely-observed-a-new-species": "You likely observed a new species!",
|
||||
"You-likely-observed-a-species": "You likely observed a species",
|
||||
"You-likely-observed-an-organism-in-this-group": "You likely observed an organism in this group",
|
||||
"You-may-have-observed-a-new-species": "You may have observed a new species!",
|
||||
"You-may-have-observed-a-species": "You may have observed a species",
|
||||
"You-may-have-observed-an-organism-in-this-group": "You may have observed an organism in this group",
|
||||
"You-must-be-logged-in-to-view-messages": "You must be logged in to view messages",
|
||||
"You-must-install-Google-Play-Services-to-sign-in-with-Google": "You must install Google Play Services to sign in with Google.",
|
||||
"You-need-an-Internet-connection-to-do-that": "You need an Internet connection to do that.",
|
||||
"You-need-log-in-to-do-that": "You need to log in to do that.",
|
||||
"You-observed-a-new-species": "You observed a new species!",
|
||||
"You-observed-a-species": "You observed a species",
|
||||
"You-observed-an-organism-in-this-group": "You observed an organism in this group",
|
||||
"You-will-see-notifications": "You’ll see notifications here once you log in & upload observations.",
|
||||
"Your-donation-to-iNaturalist": "Your donation to iNaturalist supports the improvement and stability of the mobile apps and website that connects millions of people to nature and enables the protection of biodiversity worldwide!",
|
||||
"Your-email-is-confirmed": "Your email is confirmed! Please log in to continue.",
|
||||
|
||||
@@ -1512,11 +1512,7 @@ You-have-opted-out-of-the-Community-Taxon = You have opted out of the Community
|
||||
You-havent-joined-any-projects-yet = You haven’t joined any projects yet!
|
||||
You-havent-observed-any-species-yet = You haven't observed any species yet.
|
||||
You-likely-observed-a-new-species = You likely observed a new species!
|
||||
You-likely-observed-a-species = You likely observed a species
|
||||
You-likely-observed-an-organism-in-this-group = You likely observed an organism in this group
|
||||
You-may-have-observed-a-new-species = You may have observed a new species!
|
||||
You-may-have-observed-a-species = You may have observed a species
|
||||
You-may-have-observed-an-organism-in-this-group = You may have observed an organism in this group
|
||||
You-must-be-logged-in-to-view-messages = You must be logged in to view messages
|
||||
You-must-install-Google-Play-Services-to-sign-in-with-Google = You must install Google Play Services to sign in with Google.
|
||||
# Error message when you try to do something that requires an Internet
|
||||
@@ -1525,8 +1521,6 @@ You-need-an-Internet-connection-to-do-that = You need an Internet connection to
|
||||
# Error message when you try to do something that requires log in
|
||||
You-need-log-in-to-do-that = You need to log in to do that.
|
||||
You-observed-a-new-species = You observed a new species!
|
||||
You-observed-a-species = You observed a species
|
||||
You-observed-an-organism-in-this-group = You observed an organism in this group
|
||||
You-will-see-notifications = You’ll see notifications here once you log in & upload observations.
|
||||
Your-donation-to-iNaturalist = Your donation to iNaturalist supports the improvement and stability of the mobile apps and website that connects millions of people to nature and enables the protection of biodiversity worldwide!
|
||||
Your-email-is-confirmed = Your email is confirmed! Please log in to continue.
|
||||
|
||||
Reference in New Issue
Block a user