Skip to content

Commit

Permalink
Fix creator search
Browse files Browse the repository at this point in the history
  • Loading branch information
folix-01 committed Apr 30, 2024
1 parent db23b4e commit 3e0d6c4
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 19 deletions.
22 changes: 11 additions & 11 deletions src/rer/sitesearch/browser/static/dist/prod/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/rer/sitesearch/browser/static/dist/prod/main.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 13 additions & 2 deletions src/rer/sitesearch/browser/static/js/IndexesFilters/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const IndexesFilters = () => {
const facetsIndexes = facets ? facets.indexes : null;
const hasDateIndex = facetsIndexes
? Object.values(facetsIndexes.values).filter(
index => index.type === 'DateIndex',
).length > 0
index => index.type === 'DateIndex',
).length > 0
: false;
const canShow =
hasDateIndex || (results.length > 0 && facetsIndexes) ? true : false;
Expand Down Expand Up @@ -43,6 +43,17 @@ const IndexesFilters = () => {
<DateField filters={filters} index={index} setFilters={setFilters} />
);
break;
case 'Creator':
field = (
<SelectField
values={facetValues}
filters={filters}
index={index}
setFilters={setFilters}
isMulti={false}
/>
);
break;
default:
field = (
<SelectField
Expand Down
10 changes: 5 additions & 5 deletions src/rer/sitesearch/browser/static/js/IndexesFilters/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ import SearchContext from '../utils/searchContext';
import Select, { components } from 'react-select';
import PropTypes from 'prop-types';

const SelectField = ({ values, filters, index, setFilters }) => {
const SelectField = ({ values, filters, index, setFilters, isMulti }) => {
const { translations } = useContext(SearchContext);
const options = Object.keys(values).map(key => {
const label = `${
translations[key.trim()] ? translations[key.trim()] : key
} (${values[key]})`;
const label = `${translations[key.trim()] ? translations[key.trim()] : key
} (${values[key]})`;
return {
value: key,
label,
Expand All @@ -17,7 +16,7 @@ const SelectField = ({ values, filters, index, setFilters }) => {
return (
<Select
options={options}
isMulti
isMulti={isMulti}
isClearable
components={{
// eslint-disable-next-line react/display-name
Expand Down Expand Up @@ -51,6 +50,7 @@ SelectField.propTypes = {
filters: PropTypes.object,
index: PropTypes.string,
setFilters: PropTypes.func,
isMulti: PropTypes.bool
};

export default SelectField;

0 comments on commit 3e0d6c4

Please sign in to comment.