From 9cef14f4ceed733415eae25dd31ff093a1c5d992 Mon Sep 17 00:00:00 2001 From: lunars97 Date: Fri, 10 Jan 2025 23:11:41 +0100 Subject: [PATCH] Fix feeback rating for no search results as negative --- native/src/components/FeedbackContainer.tsx | 15 +++++++++++++-- native/src/routes/SearchModal.tsx | 8 +++++++- web/src/components/FeedbackContainer.tsx | 5 ++++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/native/src/components/FeedbackContainer.tsx b/native/src/components/FeedbackContainer.tsx index bc39a50791..a837c046cf 100644 --- a/native/src/components/FeedbackContainer.tsx +++ b/native/src/components/FeedbackContainer.tsx @@ -22,9 +22,17 @@ export type FeedbackContainerProps = { cityCode: string query?: string slug?: string + noResults: boolean } -const FeedbackContainer = ({ query, language, routeType, cityCode, slug }: FeedbackContainerProps): ReactElement => { +const FeedbackContainer = ({ + query, + language, + routeType, + cityCode, + slug, + noResults, +}: FeedbackContainerProps): ReactElement => { const [comment, setComment] = useState('') const [contactMail, setContactMail] = useState('') const [isPositiveRating, setIsPositiveRating] = useState(null) @@ -33,7 +41,10 @@ const FeedbackContainer = ({ query, language, routeType, cityCode, slug }: Feedb useEffect(() => { setSearchTerm(query) - }, [query]) + if (noResults === true) { + setIsPositiveRating(false) + } + }, [query, noResults]) const handleSubmit = () => { setSendingStatus('sending') diff --git a/native/src/routes/SearchModal.tsx b/native/src/routes/SearchModal.tsx index 9e7da908ea..6c3dfcc613 100644 --- a/native/src/routes/SearchModal.tsx +++ b/native/src/routes/SearchModal.tsx @@ -89,7 +89,13 @@ const SearchModal = ({ accessibilityLabel={t('searchResultsCount', { count: searchResults.length })} style={{ flex: 1 }} noItemsMessage={ - + } /> diff --git a/web/src/components/FeedbackContainer.tsx b/web/src/components/FeedbackContainer.tsx index 083be2fc8a..731b5ebe7c 100644 --- a/web/src/components/FeedbackContainer.tsx +++ b/web/src/components/FeedbackContainer.tsx @@ -40,7 +40,10 @@ export const FeedbackContainer = ({ useEffect(() => { setSearchTerm(query) - }, [query]) + if (noResults === true) { + isPositiveRating = false + } + }, [query, noResults]) const handleSubmit = () => { setSendingStatus('sending')