Skip to content

Commit

Permalink
Net-zero Explore to only show individual EU members check if EU membe…
Browse files Browse the repository at this point in the history
…rs displayed
  • Loading branch information
SARodrigues committed Jul 20, 2023
1 parent 077ec53 commit 81677bd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ function NetZeroMap(props) {
tooltipValues,
donutActiveIndex,
selectActiveDonutIndex,
pngDownloadId
pngDownloadId,
showEUCountriesCheckbox
} = props;
useEffect(() => {
selectActiveDonutIndex(0);
Expand Down Expand Up @@ -305,12 +306,14 @@ function NetZeroMap(props) {
text="The map reflects latest communication of each country. Explore which countries have adopted a net-zero target below and click on a country to see its climate profile."
/>
{renderMap({ isTablet })}
<CheckInput
theme={blueCheckboxTheme}
label="Visualize individual targets of EU Members on the map"
checked={checked}
onChange={() => handleOnChangeChecked(!checked)}
/>
{showEUCountriesCheckbox && (
<CheckInput
theme={blueCheckboxTheme}
label="Visualize individual targets of EU Members on the map"
checked={checked}
onChange={() => handleOnChangeChecked(!checked)}
/>
)}
{countryData && (
<ExploreMapTooltip
id={TOOLTIP_ID}
Expand Down Expand Up @@ -374,7 +377,8 @@ NetZeroMap.propTypes = {
pngSelectionSubtitle: PropTypes.string,
pngDownloadId: PropTypes.string.isRequired,
selectActiveDonutIndex: PropTypes.func.isRequired,
donutActiveIndex: PropTypes.number
donutActiveIndex: PropTypes.number,
showEUCountriesCheckbox: PropTypes.bool
};

export default NetZeroMap;
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
selectedMapCountriesISOFunction,
selectedCountriesISOFunction,
selectedCountriesFunction,
getIsEUDisplayedFunction,
categoryIndicatorsFunction,
pathsWithStylesFunction,
locationsNamesFunction,
Expand Down Expand Up @@ -144,6 +145,11 @@ export const getSelectedCountriesISO = createSelector(
selectedCountriesISOFunction
);

export const getShowEUCountriesCheckbox = createSelector(
[getSelectedCountriesISO],
getIsEUDisplayedFunction
);

export const getSelectedMapCountriesISO = createSelector(
[getIsShowEUCountriesChecked, getSelectedCountriesISO],
selectedMapCountriesISOFunction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ import {
getDonutActiveIndex,
getPngSelectionSubtitle,
getLocations,
getSelectedLocations
getSelectedLocations,
getShowEUCountriesCheckbox
} from './net-zero-map-selectors';

const actions = {
Expand Down Expand Up @@ -76,7 +77,8 @@ const mapStateToProps = (state, { location }) => {
donutActiveIndex: getDonutActiveIndex(netZeroWithSelection),
pngSelectionSubtitle: getPngSelectionSubtitle(netZeroWithSelection),
selectedLocations: getSelectedLocations(netZeroWithSelection),
locations: getLocations(netZeroWithSelection)
locations: getLocations(netZeroWithSelection),
showEUCountriesCheckbox: getShowEUCountriesCheckbox(netZeroWithSelection)
};
};

Expand Down

0 comments on commit 81677bd

Please sign in to comment.