Skip to content

Commit

Permalink
Add: open the newest filter by defauly in the previous exhibitions page
Browse files Browse the repository at this point in the history
  • Loading branch information
cihanandac committed May 6, 2024
1 parent ef12329 commit d6b4866
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions frontend/src/components/blocks/Search/TopFiltersLayout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ const TopSideFacets = (props) => {
'/en/collection-research/collection',
];

const previousExhibitionPaths = [
'/nl/zien-en-doen/geweest',
'/en/see-and-do/previous',
];

// Check if the current URL is one of the allowed paths and the specific query isn't present
if (
allowedPaths.includes(location.pathname) &&
Expand All @@ -88,6 +93,14 @@ const TopSideFacets = (props) => {

history.replace(newURL); // Update the URL

// Refresh the page to apply changes
window.location.reload();
} else if(
previousExhibitionPaths.includes(location.pathname) &&
!location.hash.includes('#query')
){
const newURL = `${location.pathname}${location.search}#query=%5B%7B"i"%3A"portal_type"%2C"o"%3A"paqo.selection.any"%2C"v"%3A%5B"exhibition"%5D%7D%5D&sort_on=eventTimeStart&sort_order=descending`;
history.replace(newURL); // Update the URL
// Refresh the page to apply changes
window.location.reload();
}
Expand Down

0 comments on commit d6b4866

Please sign in to comment.