-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix visualizing individual EU members on NDCS/LTS/Net-Zero explorers #1670
Conversation
PR Summary
This PR introduces a new feature where the EU countries option is incorporated in the maps across the software. Now, there's a provision for toggling the visibility of EU countries on our application through a checkboxes. This has been implemented in all map-related components including 'lts-explore', 'ndcs-explore', and 'net-zero'.
A new attribute has been added that calculates and outputs the precise ISO codes to represent the selected countries on the map. This new component cooperates with the EU countries checkbox to determine what exactly is to be shown on the map.
We have refurbished how data is being selected for display in our tables. Instead of using a former component
This file has received considerable changes. The key takeaway is the incorporation of a couple of new functions that manage the display of EU countries on the map and implement the selection of map countries based on the ISO codes. Additionally, we've updated some existing elements to work alongside the newly added ones, ensuring a seamless user experience.
A decision has been made to temporarily exclude Malta (represented by ISO code |
4bcc5af
to
81677bd
Compare
and the "Individual EU Countries" checkbox
81677bd
to
9e64812
Compare
9e64812
to
e776454
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Description
This PR fixes a couple bugs affecting the following pages:
/ndcs-explore
)/lts-explore
)/net-zero-tracker
)The issues
Eg: with location set to "World" and the "Visualize individual submissions of EU Members on the map" checkbox unchecked, the EU is not highlighted. Similarly, with the location set to "European Union (party to the UNFCCC)" and the checkbox checked, the individual EU countries are not highlighted
Investigation
There are two ways in which EU countries can be selected:
EUU
iso codePRT
,ESP
, etc)pathsWithStylesFunction
(components/ndcs/shared/selectors.js
), responsible the paths displayed on the map as well highlighting countries/regions, does its thing based on an array of iso codes provided byselectedCountriesISO
as well as the "Visualize individual submissions" checkbox.There are a couple issues with this:
EUU
iso code, and we want to display individual submissions, we lack the list of individual EU countries' iso codesEUU
iso codeSimilarly, the documents displayed on the table are based on
selectedCountriesISO
. Note that this function is also used to process the data and display statistics, especially on the sidebar. There is currently no mechanism to allow us to display documents based on the checkbox's state.Proposed solution
The first obvious place to manipulate the ISO in order to fix the map display would be
selectedCountriesISOFunction
(or perhapsselectedCountriesFunction
where the list of selected countries is coming from in the first place)(components/ndcs/shared/selectors.js
).However, because these functions are complex and used to parse/manipulate data to display in the pages (eg: sidebar statistics), and we really only to manipulate the ISOs for the map display, it seems less bug prone to create a map specific selector which takes the resulting ISO array and manipulates it for the map display.
Map
Addition of a
selectedMapCountriesISOFunction
, to be used by thepathsWithStylesFunction
instead of the original function.It takes the list of ISOs from
selectedCountriesISO
as well as the checkbox's state, and manipulates it to address the issues described in the Investigation section:EUU
is selected and we need to display individual countries, we:EUU
iso code and add the individual countries' ISO codesEUU
oneEUU
iso code or their individual ones. This fixes the issue where a single EU country is selected and the checkbox breaks the display.Table
Because the original data parsing is untouched, and we have a correct list of ISO codes to fix the map display, we can simply sync the table with the map display (which will include the checkbox's state) by simply using the new
selectedMapCountriesISOFunction
instead ofselectedCountriesISOFunction
one.Testing
For each of the following:
/ndcs-explore
/lts-explore
/net-zero-tracker
Test the following:
(displaying the EU as whole doesn't make sense in this case)
Tracking
Basecamp