From 3459e4ac0c180a0f9c31f05f01a3d5b16b056645 Mon Sep 17 00:00:00 2001 From: Alvaro Leal Date: Thu, 3 Jun 2021 11:06:57 +0200 Subject: [PATCH 1/3] Open link in a different page --- .../app/pages/ndc-country/ndc-country-component.jsx | 8 +++++--- app/javascript/app/pages/ndc-country/ndc-country.js | 8 +++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/javascript/app/pages/ndc-country/ndc-country-component.jsx b/app/javascript/app/pages/ndc-country/ndc-country-component.jsx index 8071a21c45..74e79f730d 100644 --- a/app/javascript/app/pages/ndc-country/ndc-country-component.jsx +++ b/app/javascript/app/pages/ndc-country/ndc-country-component.jsx @@ -35,7 +35,7 @@ function NDCCountry(props) { documentsOptions, documentSelected, handleDropDownChange, - handleDownload, + handleDownloadAnalytics, match } = props; @@ -72,8 +72,10 @@ function NDCCountry(props) { onClick={() => documentSelected && documentSelected.url && - handleDownload(documentSelected.url) + handleDownloadAnalytics(documentSelected) } + href={documentSelected && documentSelected.url} + target="_blank" className={styles.viewDocumentButton} disabled={!documentsOptions} > @@ -200,7 +202,7 @@ NDCCountry.propTypes = { documentSelected: PropTypes.object, countriesOptions: PropTypes.array, handleDropDownChange: PropTypes.func, - handleDownload: PropTypes.func, + handleDownloadAnalytics: PropTypes.func, location: PropTypes.object, notSummary: PropTypes.bool }; diff --git a/app/javascript/app/pages/ndc-country/ndc-country.js b/app/javascript/app/pages/ndc-country/ndc-country.js index 8b88eb887f..e25fa548f4 100644 --- a/app/javascript/app/pages/ndc-country/ndc-country.js +++ b/app/javascript/app/pages/ndc-country/ndc-country.js @@ -82,10 +82,8 @@ function NDCCountryContainer(props) { } }; - const handleDownload = downloadUrl => { - handleAnalytics('NDC', 'Download document', 'Download original PDF'); - - window.location.assign(downloadUrl); + const handleDownloadAnalytics = documentSelected => { + handleAnalytics('NDC', 'Download document', documentSelected.value); }; return createElement(NDCCountryComponent, { @@ -93,7 +91,7 @@ function NDCCountryContainer(props) { onSearchChange, handleCountryLink, handleDropDownChange, - handleDownload + handleDownloadAnalytics }); } From a920f283ebc36ef6ff31da79fd77b88b91365bb9 Mon Sep 17 00:00:00 2001 From: Alvaro Leal Date: Thu, 3 Jun 2021 11:07:51 +0200 Subject: [PATCH 2/3] More specific node version --- .nvmrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.nvmrc b/.nvmrc index dae199aecb..bce43c253f 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v12 +v12.13.0 From 9a1db44ef8285523df9a5b321e0d52bea3e85cf8 Mon Sep 17 00:00:00 2001 From: Alvaro Leal Date: Thu, 3 Jun 2021 11:17:10 +0200 Subject: [PATCH 3/3] Fix conflict --- .../ghg-emissions-selectors-conflicts.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/javascript/app/components/ghg-emissions/ghg-emissions-selectors/ghg-emissions-selectors-conflicts.js b/app/javascript/app/components/ghg-emissions/ghg-emissions-selectors/ghg-emissions-selectors-conflicts.js index 8110c8b9fc..668e8a9ee6 100644 --- a/app/javascript/app/components/ghg-emissions/ghg-emissions-selectors/ghg-emissions-selectors-conflicts.js +++ b/app/javascript/app/components/ghg-emissions/ghg-emissions-selectors/ghg-emissions-selectors-conflicts.js @@ -102,7 +102,8 @@ export const getIncompatibleSectorConflicts = ( 'Energy', 'Transportation' ]); - if (incompatibleSectors) { + + if (incompatibleSectors.length) { return [ `Bunker Fuels and ${incompatibleSectors.join( ', '