Skip to content

Commit

Permalink
Added site countries
Browse files Browse the repository at this point in the history
  • Loading branch information
razvanMiu committed Apr 21, 2021
1 parent ba7d585 commit 92553b2
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 11 deletions.
Binary file removed Files for web/About button.png
Binary file not shown.
Binary file removed Files for web/Analyse button.png
Binary file not shown.
Binary file removed Files for web/Chemicals icon.png
Binary file not shown.
Binary file removed Files for web/Download button.png
Binary file not shown.
Binary file removed Files for web/EIEP mock up version 2.png
Binary file not shown.
Binary file removed Files for web/Elliptical image.png
Binary file not shown.
Binary file removed Files for web/Energy icon.png
Binary file not shown.
Binary file removed Files for web/Explore full image.png
Binary file not shown.
Binary file removed Files for web/Food and beverage icon.png
Binary file not shown.
Binary file removed Files for web/Metals icon.png
Binary file not shown.
Binary file removed Files for web/Minerals icon.png
Binary file not shown.
Binary file removed Files for web/Other icon.png
Binary file not shown.
Binary file removed Files for web/Paper and wood icon.png
Binary file not shown.
Binary file removed Files for web/Waste and wastewater icon.png
Binary file not shown.
31 changes: 20 additions & 11 deletions src/components/manage/Blocks/FiltersBlock/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,12 @@ const View = ({ content, ...props }) => {
const filtersMeta = {
...state.filtersMeta,
};
const newQueryParams = {
advancedFiltering: true,
filtersCounter: props.discodata_query.search['filtersCounter']
? props.discodata_query.search['filtersCounter'] + 1
: 1,
};
Object.entries(filtersMeta).forEach(([key, meta]) => {
if (!meta.static) {
delete filtersMeta[key];
Expand Down Expand Up @@ -523,20 +529,23 @@ const View = ({ content, ...props }) => {
?.map((item) => item.reportingYear)
?.sort((a, b) => b - a) || [];
if (reportingYears.length) {
props.setQueryParam({
queryParam: {
[metadata[index].queryToSet]: [reportingYears[0]],
advancedFiltering: true,
filtersCounter: props.discodata_query.search[
'filtersCounter'
]
? props.discodata_query.search['filtersCounter'] + 1
: 1,
},
});
newQueryParams[metadata[index].queryToSet] = [
reportingYears[0],
];
}
}
if (metadata[index]?.key === 'countries') {
newQueryParams.siteCountryNames = res.data?.results || [];
}
});
if (Object.keys(newQueryParams).length > 2) {
props.setQueryParam({
queryParam: {
...(newQueryParams || {}),
},
});
}

setLoadingData(false);
setState({
...state,
Expand Down

0 comments on commit 92553b2

Please sign in to comment.