Skip to content

Commit

Permalink
Merge pull request #1457 from ClimateWatch-Vizzuality/fix/ghg-bunker-…
Browse files Browse the repository at this point in the history
…fuels-conflict

Fix/ghg bunker fuels conflict
  • Loading branch information
Bluesmile82 authored Jun 3, 2021
2 parents cc41d9c + 9a1db44 commit cbc5d94
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v12
v12.13.0
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ export const getIncompatibleSectorConflicts = (
'Energy',
'Transportation'
]);
if (incompatibleSectors) {

if (incompatibleSectors.length) {
return [
`Bunker Fuels and ${incompatibleSectors.join(
', '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function NDCCountry(props) {
documentsOptions,
documentSelected,
handleDropDownChange,
handleDownload,
handleDownloadAnalytics,
match
} = props;

Expand Down Expand Up @@ -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}
>
Expand Down Expand Up @@ -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
};
Expand Down
8 changes: 3 additions & 5 deletions app/javascript/app/pages/ndc-country/ndc-country.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,16 @@ 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, {
...props,
onSearchChange,
handleCountryLink,
handleDropDownChange,
handleDownload
handleDownloadAnalytics
});
}

Expand Down

0 comments on commit cbc5d94

Please sign in to comment.