Improve messaging on no results with applied filter

This commit is contained in:
Bogdan
2024-07-25 08:08:48 +03:00
parent cc7769b601
commit 4c99971882
6 changed files with 20 additions and 16 deletions

View File

@@ -1,4 +1,6 @@
.message { .message {
composes: alert from '~Components/Alert.css';
margin-top: 10px; margin-top: 10px;
margin-bottom: 30px; margin-bottom: 30px;
text-align: center; text-align: center;

View File

@@ -1,4 +1,5 @@
import React from 'react'; import React from 'react';
import Alert from 'Components/Alert';
import Button from 'Components/Link/Button'; import Button from 'Components/Link/Button';
import { kinds } from 'Helpers/Props'; import { kinds } from 'Helpers/Props';
import translate from 'Utilities/String/translate'; import translate from 'Utilities/String/translate';
@@ -14,11 +15,9 @@ function NoIndexer(props: NoIndexerProps) {
if (totalItems > 0) { if (totalItems > 0) {
return ( return (
<div> <Alert kind={kinds.WARNING} className={styles.message}>
<div className={styles.message}>
{translate('AllIndexersHiddenDueToFilter')} {translate('AllIndexersHiddenDueToFilter')}
</div> </Alert>
</div>
); );
} }

View File

@@ -1,4 +1,6 @@
.message { .message {
composes: alert from '~Components/Alert.css';
margin-top: 10px; margin-top: 10px;
margin-bottom: 30px; margin-bottom: 30px;
text-align: center; text-align: center;

View File

@@ -1,4 +1,6 @@
import React from 'react'; import React from 'react';
import Alert from 'Components/Alert';
import { kinds } from 'Helpers/Props';
import translate from 'Utilities/String/translate'; import translate from 'Utilities/String/translate';
import styles from './NoSearchResults.css'; import styles from './NoSearchResults.css';
@@ -11,18 +13,16 @@ function NoSearchResults(props: NoSearchResultsProps) {
if (totalItems > 0) { if (totalItems > 0) {
return ( return (
<div> <Alert kind={kinds.WARNING} className={styles.message}>
<div className={styles.message}> {translate('AllSearchResultsHiddenByFilter')}
{translate('AllIndexersHiddenDueToFilter')} </Alert>
</div>
</div>
); );
} }
return ( return (
<div> <Alert kind={kinds.INFO} className={styles.message}>
<div className={styles.message}>{translate('NoSearchResultsFound')}</div> {translate('NoSearchResultsFound')}
</div> </Alert>
); );
} }

View File

@@ -282,7 +282,7 @@ class SearchIndex extends Component {
const ViewComponent = getViewComponent(isSmallScreen); const ViewComponent = getViewComponent(isSmallScreen);
const isLoaded = !!(!error && isPopulated && items.length && this.scrollerRef.current); const isLoaded = !!(!error && isPopulated && items.length && this.scrollerRef.current);
const hasNoIndexer = !totalItems; const hasNoSearchResults = !totalItems;
return ( return (
<PageContent title={translate('Search')}> <PageContent title={translate('Search')}>
@@ -306,7 +306,7 @@ class SearchIndex extends Component {
<SearchIndexSortMenu <SearchIndexSortMenu
sortKey={sortKey} sortKey={sortKey}
sortDirection={sortDirection} sortDirection={sortDirection}
isDisabled={hasNoIndexer} isDisabled={hasNoSearchResults}
onSortSelect={onSortSelect} onSortSelect={onSortSelect}
/> />
@@ -314,7 +314,7 @@ class SearchIndex extends Component {
selectedFilterKey={selectedFilterKey} selectedFilterKey={selectedFilterKey}
filters={filters} filters={filters}
customFilters={customFilters} customFilters={customFilters}
isDisabled={hasNoIndexer} isDisabled={hasNoSearchResults}
onFilterSelect={onFilterSelect} onFilterSelect={onFilterSelect}
/> />
</PageToolbarSection> </PageToolbarSection>

View File

@@ -31,6 +31,7 @@
"Album": "Album", "Album": "Album",
"All": "All", "All": "All",
"AllIndexersHiddenDueToFilter": "All indexers are hidden due to applied filter.", "AllIndexersHiddenDueToFilter": "All indexers are hidden due to applied filter.",
"AllSearchResultsHiddenByFilter": "All search results are hidden by the applied filter.",
"Analytics": "Analytics", "Analytics": "Analytics",
"AnalyticsEnabledHelpText": "Send anonymous usage and error information to {appName}'s servers. This includes information on your browser, which {appName} WebUI pages you use, error reporting as well as OS and runtime version. We will use this information to prioritize features and bug fixes.", "AnalyticsEnabledHelpText": "Send anonymous usage and error information to {appName}'s servers. This includes information on your browser, which {appName} WebUI pages you use, error reporting as well as OS and runtime version. We will use this information to prioritize features and bug fixes.",
"Any": "Any", "Any": "Any",