diff --git a/src/renderer/src/pages/home/search-results.tsx b/src/renderer/src/pages/home/search-results.tsx index abd58535..4ca72487 100644 --- a/src/renderer/src/pages/home/search-results.tsx +++ b/src/renderer/src/pages/home/search-results.tsx @@ -72,6 +72,32 @@ export function SearchResults() { debouncedFunc.current(); }, [searchParams, dispatch]); + const noResultsContent = () => { + if (isLoading) return null; + + if (showTypingMessage) { + return ( +
+ + +

{t("start_typing")}

+
+ ); + } + + if (searchResults.length === 0) { + return ( +
+ + +

{t("no_results")}

+
+ ); + } + + return null; + }; + return (
@@ -94,21 +120,7 @@ export function SearchResults() { )}
- {!isLoading && showTypingMessage && ( -
- - -

{t("start_typing")}

-
- )} - - {!isLoading && searchResults.length === 0 && ( -
- - -

{t("no_results")}

-
- )} + {noResultsContent()}
);