Skip to content

Commit

Permalink
Tweak Published filter
Browse files Browse the repository at this point in the history
  • Loading branch information
tiberiuichim committed Dec 27, 2022
1 parent 8725eff commit 9e35966
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions searchlib/components/FilterList/ActiveFilterList.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Segment, Accordion, Button, Icon } from 'semantic-ui-react';
import { useSearchContext } from '@eeacms/search/lib/hocs';
import { useAppConfig } from '@eeacms/search/lib/hocs';
import { useAppConfig, useSearchContext } from '@eeacms/search/lib/hocs';
import { isFilterValueDefaultValue } from '@eeacms/search/lib/search/helpers';
import { isLandingPageAtom } from '@eeacms/search/state';
import { useAtom } from 'jotai';

Expand All @@ -13,16 +13,21 @@ const ActiveFilterList = (props) => {
const [isLandingPage] = useAtom(isLandingPageAtom);
const { appConfig } = useAppConfig();
const { facets = [] } = appConfig;

const filterableFacets = facets.filter(
(f) => !f.isFilter && f.showInFacetsList,
(f) =>
f.isFilter ||
(typeof f.showInFacetsList !== 'undefined' ? f.showInFacetsList : true),
);
const facetNames = filterableFacets.map((f) => f.field);

const filterNames = filters
.filter((f) => facetNames.includes(f.field))
.map((f) => f.field);

const activeFilters = filters.filter((f) => filterNames.includes(f.field));
const activeFilters = filters
.filter((f) => filterNames.includes(f.field))
.filter((f) => !isFilterValueDefaultValue(f, appConfig));

return !isLandingPage && activeFilters.length ? (
<Segment className="active-filter-list">
Expand Down
2 changes: 1 addition & 1 deletion src/SearchBlock/templates/FullView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function FullView(props) {
}

FullView.schemaEnhancer = ({ schema }) => {
schema.fieldsets[0].fields.unshift('defaultResultView');
// schema.fieldsets[0].fields.unshift('defaultResultView');

return schema;
};
Expand Down

0 comments on commit 9e35966

Please sign in to comment.