Skip to content
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

Addressing 2025 NDC Tracker feedback #1698

Merged
merged 22 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
7e4554c
(1.1) Rename module naming from '2025 NDC Tracker to NDC Tracker'
SARodrigues Oct 9, 2024
aee5e0c
(1.2) Change title of 2025 trakcer timeline
SARodrigues Oct 9, 2024
f57e9f7
(2.1) Title changes
SARodrigues Oct 9, 2024
02cbbd2
(2.2) Copy changes to subtitle
SARodrigues Oct 9, 2024
121798e
(2.3) Adjust the titles of the white boxes
SARodrigues Oct 9, 2024
2f739a5
(2.9) Update 2025 tracker metadata source
SARodrigues Oct 9, 2024
efbb18c
(5.1) Change title of the module (SEO focused, follow up to 1.1)
SARodrigues Oct 9, 2024
a948f74
(2.7) Show a country's full name on GHG emissions tooltips for the 20…
SARodrigues Oct 9, 2024
b98668a
(4.3) Dont show no information countries on the table
Bluesmile82 Oct 10, 2024
cff3ff3
(4.2) Adjustments to the Initials and legends of the NDC Comparison i…
Bluesmile82 Oct 10, 2024
1f6b76f
(3.2, 4.1) No New NDC” countries should be dark grey
Bluesmile82 Oct 10, 2024
7909584
(2.10) 2025 tracker GHG Chart to display both EU as a whole and indiv…
SARodrigues Oct 10, 2024
cb4160c
(2.10) 2025 tracker Exclude EU from the list of total countries; not …
SARodrigues Oct 10, 2024
cebffd7
Merge pull request #1699 from ClimateWatch-Vizzuality/2025-ndc-tracke…
SARodrigues Oct 10, 2024
7b4f428
Update legend and 2025 submitted label
Bluesmile82 Oct 10, 2024
9de1307
(2.4) Make cards titles (left ones) spacing smaller
SARodrigues Oct 10, 2024
b0a6964
Merge pull request #1700 from ClimateWatch-Vizzuality/2025-ndc-tracke…
SARodrigues Oct 10, 2024
fbaf063
(2.5) Add 'Explore NDC Content' button to 2025 tracker chart section
SARodrigues Oct 10, 2024
831d1f1
Merge pull request #1701 from ClimateWatch-Vizzuality/2025-ndc-tracke…
SARodrigues Oct 10, 2024
1fc67f4
(4.3b) Dont show comparison on the tooltip if the value is 'No New NDC'
Bluesmile82 Oct 10, 2024
bbf045b
Merge branch '2025-ndc-tracker-feedback' of github.com:ClimateWatch-V…
Bluesmile82 Oct 10, 2024
1f5e165
(1.3) Add scroll if needed on timeline
Bluesmile82 Oct 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class CountryTimeline extends PureComponent {
>
<div className={styles.timeline}>
<h3 className={styles.timelineDescription}>
<AbbrReplace>Latest 2025 NDC Submitted</AbbrReplace>
<AbbrReplace>Latest NDC Submissions</AbbrReplace>
</h3>
{documentYears?.length > 0 ? (
<HorizontalTimeline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,25 +103,27 @@
}

.links {
display: block !important;
width: max-content;
display: block;
min-width: 220px;
width: fit-content;
position: absolute;
bottom: 15px;
border-radius: 4px;
background-color: $gray3;
overflow: hidden;
overflow-y: auto;
max-height: 140px;
padding: 4px;

li {
text-align: left;
position: relative;
display: block !important;
border-bottom: 1px solid rgba($white, 0.2);
transition: color 0.1s linear;
border-radius: 4px;

a {
padding: 10px 30px 10px 10px;
display: block;
width: auto;
height: auto;
font-size: $font-size;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const NDCSEnhancements2025Map = ({
<NDCSEnhancementsTooltip
id={TOOLTIP_ID}
tooltipValues={tooltipValues}
is2025
/>
)}
{indicator && renderMapLegend()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,9 @@ export const reduceLegendBuckets = createSelector(
updatedIndicator.legendBuckets
).reduce((acc, [key, value]) => {
if (value.name === 'No Information') {
acc[key] = { ...value, name: 'No 2025 NDC' };
acc[key] = { ...value, name: 'No New NDC' };
} else if (value.name === 'Submitted 2025 NDC') {
acc[key] = { ...value, name: 'New NDC' };
} else {
acc[key] = value;
}
Expand All @@ -217,7 +219,9 @@ export const reduceLegendBuckets = createSelector(
updatedIndicator.locations
).reduce((acc, [key, value]) => {
if (value.name === 'No Information') {
acc[key] = { ...value, name: 'No 2025 NDC' };
acc[key] = { ...value, name: 'No New NDC' };
} else if (value.name === 'Submitted 2025 NDC') {
acc[key] = { ...value, name: 'New NDC' };
} else {
acc[key] = value;
}
Expand All @@ -233,13 +237,7 @@ export const sortIndicatorLegend = createSelector(
indicator => {
if (!indicator) return null;
const updatedIndicator = { ...indicator };
const namesLegendOrder = [
'Submitted 2025 NDC with 2030 and 2035 targets',
'Submitted 2025 NDC with 2030 target',
'Submitted 2025 NDC',
'No 2025 NDC',
'Not Applicable'
];
const namesLegendOrder = ['New NDC', 'No New NDC', 'Not Applicable'];
const updatedLegendBuckets = {};

Object.entries(updatedIndicator.legendBuckets).forEach(([key, value]) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const getIndicatorsParsed = createSelector(
value: i.slug,
categoryIds: i.category_ids,
locations: i.locations,
labels: i.labels,
isPreviousComparison
})),
'value'
Expand All @@ -61,30 +62,39 @@ export const tableGetSelectedData = createSelector(
return [];
}
const refIndicator = indicators.find(
ind => ind.value === INDICATOR_SLUGS.emissions
); // Emissions indicator is used as reference to get all countries
return Object.keys(refIndicator.locations).map(iso => {
const countryData =
countries.find(country => country.iso_code3 === iso) || {};
const row = {
country: countryData.wri_standard_name || iso,
iso
};
indicators.forEach(ind => {
if (ind.locations[iso]) {
if (ind.value === INDICATOR_SLUGS.enhancements) {
row[ind.label] = {
slug: ind.locations[iso].label_slug,
label: ind.locations[iso].value
};
} else {
row[ind.isPreviousComparison ? ind.value : ind.label] =
ind.locations[iso].value;
}
ind => ind.value === INDICATOR_SLUGS.submitted2025
);
const noInformationLabelId = Object.entries(refIndicator.labels).find(
([, { name }]) => name === 'No Information'
)?.[0];

return Object.keys(refIndicator.locations)
.map(iso => {
if (refIndicator.locations[iso]?.label_id === noInformationLabelId) {
return null;
}
});
return row;
});
const countryData =
countries.find(country => country.iso_code3 === iso) || {};
const row = {
country: countryData.wri_standard_name || iso,
iso
};
indicators.forEach(ind => {
if (ind.locations[iso]) {
if (ind.value === INDICATOR_SLUGS.enhancements) {
row[ind.label] = {
slug: ind.locations[iso].label_slug,
label: ind.locations[iso].value
};
} else {
row[ind.isPreviousComparison ? ind.value : ind.label] =
ind.locations[iso].value;
}
}
});
return row;
})
.filter(Boolean);
}
);

Expand Down Expand Up @@ -117,9 +127,10 @@ export const tableRemoveIsoFromData = createSelector(
updatedD['NDC Status'] = d['2025 NDC Submission'] && {
color,
text:
d['2025 NDC Submission'] === 'No Information'
? 'No 2025 NDC'
: d['2025 NDC Submission'],
{
'Submitted 2025 NDC': 'New NDC',
'No Information': 'No New NDC'
}[d['2025 NDC Submission']] || d['2025 NDC Submission'],
sortIndex: Object.values(NDC_2025_LABEL_SLUGS).indexOf(
d['2025 NDC Submission']
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,15 @@ export const getData = createSelector(
const data = Object.entries(emissionsIndicator.locations).map(
([iso, location]) => ({
iso,
country: iso,
// Country property is only used to display the country name on the chart tooltips.
// We'll use the wri_standard_name as a standard, and default to the ISO code if one doesn't
// exist in order to fail safely. (IE: FE not crashing due to unexpected/missing data)
country:
countries.find(country => iso === country.iso_code3)
?.wri_standard_name || iso,
indc_submission:
// ! TODO Default value conflicts with the one in the component. Needs to be addressed
statusIndicator.locations[iso]?.value || 'No 2025 NDC',
statusIndicator.locations[iso]?.value || 'No New NDC',
submission_date:
dateIndicator.locations[iso]?.value ||
no2025DateIndicator.locations[iso]?.value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
} from 'recharts';
import { Switch } from 'cw-components';
import { Link } from 'react-router-dom';
import Button from 'components/button';
import ButtonGroup from 'components/button-group';
import { generateLinkToDataExplorer } from 'utils/data-explorer';
import ModalMetadata from 'components/modal-metadata';
Expand All @@ -25,7 +26,7 @@ const SUBMISSION_TYPES = {
submittedWith2030: 'Submitted 2025 NDC with 2030 target',
submitted2025: 'Submitted 2025 NDC',
// ! TODO Default value conflicts with the the default on in the selector. Needs to be addressed
notSubmitted: 'No 2025 NDC'
notSubmitted: 'No New NDC'
};

const Ndc2025TrackerChartComponent = props => {
Expand Down Expand Up @@ -64,9 +65,9 @@ const Ndc2025TrackerChartComponent = props => {
const countriesBySubmissionType = React.useMemo(() => {
const findCountriesBySubmissionType = submissionType =>
parsedData?.filter(
// Don't include EU countries in the chart; instead we account for EUU
({ indc_submission, is_in_eu }) =>
!is_in_eu && indc_submission === submissionType
// Note: 'EUU' is not a country, we need to explicitly exclude it.
({ indc_submission, iso }) =>
iso !== 'EUU' && indc_submission === submissionType
);

return Object.entries(SUBMISSION_TYPES).reduce(
Expand Down Expand Up @@ -135,19 +136,10 @@ const Ndc2025TrackerChartComponent = props => {
// Parse data to create a chart display
// We do not want to display EU countries in the chart; instead we do EUU.
const chartData = React.useMemo(() => {
const parsedDataWithoutEuCountries = parsedData.filter(
country => country.is_in_eu === false
);

let sortedData = parsedDataWithoutEuCountries || [];
let sortedData = [];
if (sortedBy === 'submission_date') {
sortedData = sortedData.sort((a, b) => {
const indcSubmissionSortOrder = [
'Submitted 2025 NDC with 2030 target',
'Submitted 2025 NDC with 2030 and 2035 targets',
'Submitted 2025 NDC',
'No 2025 NDC'
];
const indcSubmissionSortOrder = ['New NDC', 'No New NDC'];
const sortByIndcSubmission =
indcSubmissionSortOrder.indexOf(a.indc_submission) -
indcSubmissionSortOrder.indexOf(b.indc_submission);
Expand All @@ -156,7 +148,7 @@ const Ndc2025TrackerChartComponent = props => {
return parseFloat(b.ndce_ghg) - parseFloat(a.ndce_ghg);
});
} else if (sortedBy === 'emissions') {
sortedData = sortedData.sort((a, b) => b[sortedBy] - a[sortedBy]);
sortedData = parsedData.sort((a, b) => b[sortedBy] - a[sortedBy]);
}

const barsData = sortedData.map((country, idx) => ({
Expand Down Expand Up @@ -219,7 +211,7 @@ const Ndc2025TrackerChartComponent = props => {
<div className={layout.content}>
<div className={styles.summary}>
<div className={styles.summaryHeader}>
<h2>What countries have submitted a 2025 NDC?</h2>
<h2>Which countries have submitted a new NDC?</h2>
<ButtonGroup
className={styles.buttonGroup}
dataTour="ndc-enhancement-tracker-04"
Expand Down Expand Up @@ -250,39 +242,54 @@ const Ndc2025TrackerChartComponent = props => {
}
]}
/>
<Button
className={styles.exploreNdcContentButton}
variant="primary"
href="/ndcs-explore"
// TODO: Analytics? Category, etc
>
Explore NDC Content
</Button>
</div>
<p>
Track which countries are submitting an updated version of their
NDC--a 2025 NDC. You can compare countries’ submissions side by side{' '}
Track which countries have submitted a new NDC. You can compare
countries’ submissions side by side{' '}
<Link
to="custom-compare/overview"
title="Compare submissions"
target="_blank"
>
here
</Link>{' '}
or by referring to the table below. To request changes or additions,
please contact{' '}
. To request changes or additions, please contact{' '}
<a
href="mailto:Mengpin.Ge@wri.org?subject=NDC 2025 Tracker Update"
target="_blank"
rel="noopener noreferrer"
>
Mengpin Ge
</a>
. Find out more about our resources on NDCs{' '}
<a
href="https://www.wri.org/ndcs"
target="_blank"
rel="noopener noreferrer"
>
<u>here</u>
</a>
.
</p>
</div>
<div className={styles.cards}>
<p />
{/* {renderCardHead(
'submittedWith2030And2035',
'2025 NDCs',
'New NDCs',
'with 2030 and 2035 targets'
)}
{renderCardHead('submittedWith2030', '2025 NDCs', 'with 2030 target')} */}
{renderCardHead('submitted2025', '2025 NDCs')}
{renderCardHead('notSubmitted', 'No 2025 NDCs')}
{renderCardHead('submittedWith2030', 'New NDCs', 'with 2030 target')} */}
{renderCardHead('submitted2025', 'New NDCs')}
{renderCardHead('notSubmitted', 'No New NDCs')}
<p />

<p>Total Countries</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
flex-wrap: wrap;
justify-content: space-between;
margin-bottom: 34px;
gap: 8px;
gap: 20px;
}

h2 {
font-size: $font-size-large;
color: $theme-color;
font-weight: $font-weight;
flex: 1;
}
}

Expand All @@ -34,14 +35,17 @@
}
}

.exploreNdcContentButton {
width: auto;
}

.cards {
display: grid;
// For use when displaying extra indicator cards
// grid-template-columns: repeat(5, 1fr);
// grid-template-columns: 160px repeat(4, 1fr);
// column-gap: 20px;
grid-template-columns: repeat(4, 1fr);
grid-template-columns: 160px repeat(3, 1fr);
column-gap: 32px;

margin-block: 45px 30px;
row-gap: 6px;

Expand All @@ -53,9 +57,9 @@

@media #{$tablet-landscape} {
// For use when displaying extra indicator cards
// grid-template-columns: repeat(5, 214px);
// grid-template-columns: 160px repeat(4, 214px);
// column-gap: 14px;
grid-template-columns: repeat(4, 235);
grid-template-columns: 160px repeat(3, 235);
column-gap: 52px;
}

Expand All @@ -66,10 +70,10 @@

&:nth-child(2),
&:nth-child(3) {
// For use when displaying enhanced card
// &:nth-child(4),
// For use when displaying extra indicator cards
// &:nth-child(5) {
// For use when displaying enhanced card
// &:nth-child(4),
// For use when displaying extra indicator cards
// &:nth-child(5) {
@media #{$tablet-portrait} {
font-size: $font-size-large;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function Ndc2025TrackerChartContainer(props) {
const handleInfoClick = () => {
setModalMetadata({
category: 'NDC Content Map',
slugs: '2025_status',
slugs: '2025_ndc',
open: true
});
};
Expand Down
Loading
Loading