From 360eb2a48a6537527d4e1375864feba470a74f20 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Thu, 20 Nov 2025 14:04:08 +0200 Subject: [PATCH] jazz up no results screen --- src/lib/constants.ts | 1 + src/screens/Search/SearchResults.tsx | 56 +++++++++++++++++++++++----- 2 files changed, 47 insertions(+), 10 deletions(-) diff --git a/src/lib/constants.ts b/src/lib/constants.ts index c777480fc0..97a7679615 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -204,6 +204,7 @@ export const urls = { website: { blog: { initialVerificationAnnouncement: `https://bsky.social/about/blog/04-21-2025-verification`, + searchTipsAndTricks: 'https://bsky.social/about/blog/05-31-2024-search', }, }, } diff --git a/src/screens/Search/SearchResults.tsx b/src/screens/Search/SearchResults.tsx index 82517a6fcb..63decdad47 100644 --- a/src/screens/Search/SearchResults.tsx +++ b/src/screens/Search/SearchResults.tsx @@ -4,6 +4,8 @@ import {type AppBskyFeedDefs} from '@atproto/api' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' +import {urls} from '#/lib/constants' +import {cleanError} from '#/lib/strings/errors' import {augmentSearchQuery} from '#/lib/strings/helpers' import {useActorSearch} from '#/state/queries/actor-search' import {usePopularFeedsSearch} from '#/state/queries/feed' @@ -112,11 +114,11 @@ function Loader() { } function EmptyState({ - message, + messageText, error, children, }: { - message: string + messageText: React.ReactNode error?: string children?: React.ReactNode }) { @@ -126,7 +128,7 @@ function EmptyState({ - {message} + {messageText} {error && ( <> @@ -155,6 +157,41 @@ function EmptyState({ ) } +function NoResultsText({query}: {query: string}) { + const t = useTheme() + const {_} = useLingui() + + return ( + <> + + + No results found for " + {query} + ". + + + {'\n\n'} + + + Try a different search term, or{' '} + + read about how to use search filters + + . + + + + ) +} + type SearchResultSlice = | { type: 'post' @@ -279,10 +316,10 @@ let SearchScreenPostResults = ({ return error ? ( ) : ( <> @@ -311,7 +348,7 @@ let SearchScreenPostResults = ({ } /> ) : ( - + } /> )} ) : ( @@ -365,7 +402,7 @@ let SearchScreenUserResults = ({ if (error) { return ( ) : ( - + } /> )} ) : ( @@ -409,7 +446,6 @@ let SearchScreenFeedsResults = ({ active: boolean }): React.ReactNode => { const t = useTheme() - const {_} = useLingui() const {data: results, isFetched} = usePopularFeedsSearch({ query, @@ -437,7 +473,7 @@ let SearchScreenFeedsResults = ({ ListFooterComponent={} /> ) : ( - + } /> )} ) : (