Allow deselecting values when using search through url query params

pull/1841/head
Bogdan 1 year ago
parent 39a54eb8f6
commit 0eaa538e8a

@ -24,6 +24,7 @@ class SearchFooter extends Component {
super(props, context); super(props, context);
const { const {
defaultSearchQueryParams,
defaultIndexerIds, defaultIndexerIds,
defaultCategories, defaultCategories,
defaultSearchQuery, defaultSearchQuery,
@ -33,16 +34,16 @@ class SearchFooter extends Component {
} = props; } = props;
this.state = { this.state = {
isQueryParameterModalOpen: false, searchIndexerIds: defaultSearchQueryParams.searchIndexerIds ?? defaultIndexerIds,
queryModalOptions: null, searchCategories: defaultSearchQueryParams.searchCategories ?? defaultCategories,
searchType: defaultSearchType, searchQuery: (defaultSearchQueryParams.searchQuery ?? defaultSearchQuery) || '',
searchType: defaultSearchQueryParams.searchType ?? defaultSearchType,
searchLimit: defaultSearchQueryParams.searchLimit ?? defaultSearchLimit,
searchOffset: defaultSearchQueryParams.searchOffset ?? defaultSearchOffset,
newSearch: true,
searchingReleases: false, searchingReleases: false,
searchQuery: defaultSearchQuery || '', isQueryParameterModalOpen: false,
searchIndexerIds: defaultIndexerIds, queryModalOptions: null
searchCategories: defaultCategories,
searchLimit: defaultSearchLimit,
searchOffset: defaultSearchOffset,
newSearch: true
}; };
} }
@ -189,6 +190,7 @@ class SearchFooter extends Component {
break; break;
default: default:
icon = icons.SEARCH; icon = icons.SEARCH;
break;
} }
let footerLabel = searchIndexerIds.length === 0 ? translate('SearchAllIndexers') : translate('SearchCountIndexers', { count: searchIndexerIds.length }); let footerLabel = searchIndexerIds.length === 0 ? translate('SearchAllIndexers') : translate('SearchCountIndexers', { count: searchIndexerIds.length });
@ -300,6 +302,7 @@ class SearchFooter extends Component {
} }
SearchFooter.propTypes = { SearchFooter.propTypes = {
defaultSearchQueryParams: PropTypes.object.isRequired,
defaultIndexerIds: PropTypes.arrayOf(PropTypes.number).isRequired, defaultIndexerIds: PropTypes.arrayOf(PropTypes.number).isRequired,
defaultCategories: PropTypes.arrayOf(PropTypes.number).isRequired, defaultCategories: PropTypes.arrayOf(PropTypes.number).isRequired,
defaultSearchQuery: PropTypes.string.isRequired, defaultSearchQuery: PropTypes.string.isRequired,

@ -49,12 +49,12 @@ function createMapStateToProps() {
return { return {
defaultSearchQueryParams, defaultSearchQueryParams,
defaultSearchQuery: defaultSearchQueryParams.searchQuery ?? defaultSearchQuery, defaultSearchQuery,
defaultIndexerIds: defaultSearchQueryParams.searchIndexerIds ?? defaultIndexerIds, defaultIndexerIds,
defaultCategories: defaultSearchQueryParams.searchCategories ?? defaultCategories, defaultCategories,
defaultSearchType: defaultSearchQueryParams.searchType ?? defaultSearchType, defaultSearchType,
defaultSearchLimit: defaultSearchQueryParams.searchLimit ?? defaultSearchLimit, defaultSearchLimit,
defaultSearchOffset: defaultSearchQueryParams.searchOffset ?? defaultSearchOffset defaultSearchOffset
}; };
} }
); );
@ -87,14 +87,9 @@ class SearchFooterConnector extends Component {
// Render // Render
render() { render() {
const {
defaultSearchQueryParams,
...otherProps
} = this.props;
return ( return (
<SearchFooter <SearchFooter
{...otherProps} {...this.props}
onInputChange={this.onInputChange} onInputChange={this.onInputChange}
/> />
); );

Loading…
Cancel
Save