diff --git a/scripts/reassure-tests.sh b/scripts/reassure-tests.sh index 798367e80..dfe58d83a 100755 --- a/scripts/reassure-tests.sh +++ b/scripts/reassure-tests.sh @@ -1,16 +1,19 @@ -set -e +#!/usr/bin/env bash +set -e -BASELINE_BRANCH=main +BASELINE_BRANCH=${GITHUB_BASE_REF:="main"} # Required for `git switch` on CI git fetch origin # Gather baseline perf measurements git switch "$BASELINE_BRANCH" -npm install --force -npx reassure --baseline + +npm install +npm run reassure -- --baseline # Gather current perf measurements & compare results git switch --detach - -npm install --force -npm run reassure \ No newline at end of file + +npm install +npm run reassure -- --branch diff --git a/src/components/Suggestions/AddCommentPrompt.js b/src/components/Suggestions/AddCommentPrompt.js deleted file mode 100644 index a5210e157..000000000 --- a/src/components/Suggestions/AddCommentPrompt.js +++ /dev/null @@ -1,50 +0,0 @@ -// @flow - -import { useNavigation } from "@react-navigation/native"; -import { - INatIconButton, - TextInputSheet -} from "components/SharedComponents"; -import type { Node } from "react"; -import React, { useEffect, useState } from "react"; -import { useTranslation } from "sharedHooks"; -import useStore from "stores/useStore"; - -const AddCommentPrompt = ( ): Node => { - const currentObservation = useStore( state => state.currentObservation ); - const updateComment = useStore( state => state.updateComment ); - const [showAddCommentSheet, setShowAddCommentSheet] = useState( false ); - - const synced = currentObservation?.wasSynced !== undefined - && currentObservation.wasSynced( ); - - const { t } = useTranslation( ); - const navigation = useNavigation( ); - - useEffect( ( ) => { - const addCommentIcon = ( ) => ( - setShowAddCommentSheet( true )} - accessibilityLabel={t( "Add-comment" )} - size={25} - /> - ); - - if ( synced ) { - navigation.setOptions( { - headerRight: addCommentIcon - } ); - } - }, [navigation, t, synced] ); - - return showAddCommentSheet && ( - setShowAddCommentSheet( false )} - headerText={t( "ADD-OPTIONAL-COMMENT" )} - confirm={updateComment} - /> - ); -}; - -export default AddCommentPrompt; diff --git a/src/components/Suggestions/CommentBox.js b/src/components/Suggestions/CommentBox.js deleted file mode 100644 index 9a713929e..000000000 --- a/src/components/Suggestions/CommentBox.js +++ /dev/null @@ -1,34 +0,0 @@ -// @flow - -import { - Body3, INatIcon -} from "components/SharedComponents"; -import { - View -} from "components/styledComponents"; -import type { Node } from "react"; -import React from "react"; -import { useTranslation } from "sharedHooks"; -import useStore from "stores/useStore"; - -const CommentBox = ( ): Node => { - const comment = useStore( state => state.comment ); - const { t } = useTranslation( ); - - return comment && comment.length > 0 && ( - <> - - {t( "Your-identification-will-be-posted-with-the-following-comment" )} - - - - { comment } - - - ); -}; - -export default CommentBox; diff --git a/src/components/Suggestions/SuggestionsHeader.tsx b/src/components/Suggestions/SuggestionsHeader.tsx index 5ab9f89c8..7564c9a07 100644 --- a/src/components/Suggestions/SuggestionsHeader.tsx +++ b/src/components/Suggestions/SuggestionsHeader.tsx @@ -9,8 +9,6 @@ import React from "react"; import { useTheme } from "react-native-paper"; import { useTranslation } from "sharedHooks"; -import AddCommentPrompt from "./AddCommentPrompt"; -import CommentBox from "./CommentBox"; import ObsPhotoSelectionList from "./ObsPhotoSelectionList"; interface Props { @@ -37,7 +35,6 @@ const SuggestionsHeader = ( { return ( <> - )} - ); }; diff --git a/src/components/Suggestions/TaxonSearch.js b/src/components/Suggestions/TaxonSearch.js index 7d82a6674..0d41dcad3 100644 --- a/src/components/Suggestions/TaxonSearch.js +++ b/src/components/Suggestions/TaxonSearch.js @@ -16,8 +16,6 @@ import { useTaxonSearch, useTranslation } from "sharedHooks"; import { getShadowForColor } from "styles/global"; import colors from "styles/tailwindColors"; -import AddCommentPrompt from "./AddCommentPrompt"; -import CommentBox from "./CommentBox"; import useNavigateWithTaxonSelected from "./hooks/useNavigateWithTaxonSelected"; const DROP_SHADOW = getShadowForColor( colors.darkGray, { @@ -50,8 +48,6 @@ const TaxonSearch = ( ): Node => { return ( - - { const navigation = useNavigation( ); const { params } = useRoute( ); const { entryScreen } = params; const currentObservation = useStore( state => state.currentObservation ); - const comment = useStore( state => state.comment ); const updateObservationKeys = useStore( state => state.updateObservationKeys ); const vision = options?.vision; @@ -31,8 +30,7 @@ const useNavigateWithTaxonSelected = ( } else { updateObservationKeys( { owners_identification_from_vision: vision, - taxon: selectedTaxon, - description: comment + taxon: selectedTaxon } ); } @@ -65,7 +63,6 @@ const useNavigateWithTaxonSelected = ( // If we've navigated, there's no need to run this effect again unselectTaxon( ); }, [ - comment, currentObservation?.uuid, entryScreen, navigation, diff --git a/src/i18n/l10n/en.ftl b/src/i18n/l10n/en.ftl index cab053a69..a908bface 100644 --- a/src/i18n/l10n/en.ftl +++ b/src/i18n/l10n/en.ftl @@ -36,7 +36,6 @@ Add-agreement = Add agreement ADD-AN-ID = ADD AN ID Add-an-ID-Later = Add an ID Later ADD-COMMENT = ADD COMMENT -Add-comment = Add comment Add-Date-Time = Add Date/Time # Label for a button that adds a vote of disagreement Add-disagreement = Add disagreement @@ -1163,7 +1162,6 @@ You-need-log-in-to-do-that = You need to log in to do that. 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. -Your-identification-will-be-posted-with-the-following-comment = Your identification will be posted with the following comment: Your-location-uncertainty-is-over-x-km = Your location uncertainty is over { $x } km, which is too high to be helpful to identifiers. Edit the location and zoom in until the accuracy circle turns green and is centered on where you observed the organism. Youre-always-in-control-of-the-location-privacy = You’re always in control of the location privacy of every observation you create. # Text prompting the user to open Settings to grant permission after diff --git a/src/i18n/l10n/en.ftl.json b/src/i18n/l10n/en.ftl.json index d8bfc8412..a3171b41d 100644 --- a/src/i18n/l10n/en.ftl.json +++ b/src/i18n/l10n/en.ftl.json @@ -28,7 +28,6 @@ "ADD-AN-ID": "ADD AN ID", "Add-an-ID-Later": "Add an ID Later", "ADD-COMMENT": "ADD COMMENT", - "Add-comment": "Add comment", "Add-Date-Time": "Add Date/Time", "Add-disagreement": { "comment": "Label for a button that adds a vote of disagreement", @@ -1465,7 +1464,6 @@ "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.", - "Your-identification-will-be-posted-with-the-following-comment": "Your identification will be posted with the following comment:", "Your-location-uncertainty-is-over-x-km": "Your location uncertainty is over { $x } km, which is too high to be helpful to identifiers. Edit the location and zoom in until the accuracy circle turns green and is centered on where you observed the organism.", "Youre-always-in-control-of-the-location-privacy": "You’re always in control of the location privacy of every observation you create.", "Youve-denied-permission-prompt": { diff --git a/src/i18n/strings.ftl b/src/i18n/strings.ftl index cab053a69..a908bface 100644 --- a/src/i18n/strings.ftl +++ b/src/i18n/strings.ftl @@ -36,7 +36,6 @@ Add-agreement = Add agreement ADD-AN-ID = ADD AN ID Add-an-ID-Later = Add an ID Later ADD-COMMENT = ADD COMMENT -Add-comment = Add comment Add-Date-Time = Add Date/Time # Label for a button that adds a vote of disagreement Add-disagreement = Add disagreement @@ -1163,7 +1162,6 @@ You-need-log-in-to-do-that = You need to log in to do that. 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. -Your-identification-will-be-posted-with-the-following-comment = Your identification will be posted with the following comment: Your-location-uncertainty-is-over-x-km = Your location uncertainty is over { $x } km, which is too high to be helpful to identifiers. Edit the location and zoom in until the accuracy circle turns green and is centered on where you observed the organism. Youre-always-in-control-of-the-location-privacy = You’re always in control of the location privacy of every observation you create. # Text prompting the user to open Settings to grant permission after diff --git a/src/stores/createObservationFlowSlice.js b/src/stores/createObservationFlowSlice.js index 16309ba55..7c9784732 100644 --- a/src/stores/createObservationFlowSlice.js +++ b/src/stores/createObservationFlowSlice.js @@ -6,7 +6,6 @@ import Sound from "realmModels/Sound"; const DEFAULT_STATE = { cameraRollUris: [], - comment: "", currentObservation: {}, currentObservationIndex: 0, evidenceToAdd: [], @@ -145,7 +144,6 @@ const createObservationFlowSlice = ( set, get ) => ( { ), firstObservationDefaults: options?.firstObservationDefaults } ) ), - updateComment: newComment => set( { comment: newComment } ), updateObservations: updatedObservations => set( state => ( { observations: updatedObservations.map( observationToJSON ), currentObservation: observationToJSON( updatedObservations[state.currentObservationIndex] ) diff --git a/tests/unit/components/Suggestions/Suggestions.test.js b/tests/unit/components/Suggestions/Suggestions.test.js index e3d372a37..f47ffd8c6 100644 --- a/tests/unit/components/Suggestions/Suggestions.test.js +++ b/tests/unit/components/Suggestions/Suggestions.test.js @@ -72,22 +72,6 @@ describe( "Suggestions", ( ) => { } ); } ); - it( "shows comment section if observation has comment", ( ) => { - useStore.setState( { - comment: "This is a test comment" - } ); - renderComponent( ); - const commentSection = screen.getByText( - i18next.t( "Your-identification-will-be-posted-with-the-following-comment" ) - ); - expect( commentSection ).toBeVisible( ); - } ); - it( "should display empty text if no suggestions are found", ( ) => { renderComponent( ); const emptyText = i18next