Skip to content

Commit

Permalink
Added blacklist & whitelist for the values on the landingpage
Browse files Browse the repository at this point in the history
  • Loading branch information
zotya committed Jan 17, 2023
1 parent e8387f7 commit 145d6bf
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion searchlib/components/LandingPage/TilesLandingPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,22 @@ const LandingPage = (props) => {
const [landingPageData, setLandingPageData] = useAtom(landingPageDataAtom);
const [isRequested, setIsRequested] = useAtom(isRequestedAtom);

const activeSectionConfig = getFacetConfig(sections, activeSection);

const getTiles = (maxPerSection) => {
let result = landingPageData?.[activeSection]?.[0]?.data || [];

if (activeSectionConfig.blacklist !== undefined) {
result = result.filter(
(res) => !activeSectionConfig.blacklist.includes(res.value),
);
}
if (activeSectionConfig.whitelist !== undefined) {
result = result.filter((res) =>
activeSectionConfig.whitelist.includes(res.value),
);
}

// if (activeSection === 'language') {
// const fConfig = appConfig.facets.filter((f) => f.field === 'language');
// const languages = fConfig[0].facetValues;
Expand All @@ -69,7 +82,6 @@ const LandingPage = (props) => {

const [hasOverflow, tiles] = getTiles(maxPerSection);

const activeSectionConfig = getFacetConfig(sections, activeSection);
const { icon } = activeSectionConfig;

useDeepCompareEffect(() => {
Expand Down

0 comments on commit 145d6bf

Please sign in to comment.