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

PROD Deploy 2024-01-26 10:08am EST #4744

Merged
merged 2 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -18,6 +18,8 @@ const getLocationName = (state) => state.locationLabel;
const getColors = (state) => state.colors;
const getSentences = (state) => state.sentences;
const getTitle = (state) => state.title;
const getAlerts = (state) => state.alerts || [];
const getAdm0 = (state) => state.adm0;

export const getPermCats = createSelector([], () =>
tscLossCategories.filter((x) => x.permanent).map((el) => el.value.toString())
Expand Down Expand Up @@ -241,9 +243,41 @@ export const parseTitle = createSelector(
}
);

export const parseAlerts = createSelector(
[getAlerts, getLocationName, getAdm0],
(alerts, locationLabel, adm0) => {
const countriesWithNewWarningText = [
'CMR',
'CIV',
'COD',
'GNQ',
'GAB',
'GHA',
'GIN',
'GNB',
'LBR',
'MDG',
'COG',
'SLE',
];

if (countriesWithNewWarningText.includes(adm0)) {
return [
{
text: `The methods behind the annual tree cover loss data underlying emissions estimates have changed over time, resulting in an underreporting of tree cover loss in ${locationLabel} prior to 2015. We advise against comparing the data before/after 2015 in ${locationLabel}. [Read more here](https://www.globalforestwatch.org/blog/data-and-research/tree-cover-loss-satellite-data-trend-analysis/).`,
visible: ['global', 'country', 'geostore', 'aoi', 'wdpa', 'use'],
},
];
}

return alerts;
}
);

export default createStructuredSelector({
data: parseData,
config: parseConfig,
sentence: parseSentence,
title: parseTitle,
alerts: parseAlerts,
});
34 changes: 34 additions & 0 deletions components/widgets/climate/emissions-deforestation/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const getColors = (state) => state.colors;
const getIndicator = (state) => state.indicator;
const getLocationName = (state) => state.locationLabel;
const getSentences = (state) => state.sentences;
const getAlerts = (state) => state.alerts || [];
const getAdm0 = (state) => state.adm0;

export const parseData = createSelector(
[getData, getSettings],
Expand Down Expand Up @@ -133,8 +135,40 @@ export const parseSentence = createSelector(
}
);

export const parseAlerts = createSelector(
[getAlerts, getLocationName, getAdm0],
(alerts, locationLabel, adm0) => {
const countriesWithNewWarningText = [
'CMR',
'CIV',
'COD',
'GNQ',
'GAB',
'GHA',
'GIN',
'GNB',
'LBR',
'MDG',
'COG',
'SLE',
];

if (countriesWithNewWarningText.includes(adm0)) {
return [
{
text: `The methods behind the annual tree cover loss data underlying emissions estimates have changed over time, resulting in an underreporting of tree cover loss in ${locationLabel} prior to 2015. We advise against comparing the data before/after 2015 in ${locationLabel}. [Read more here](https://www.globalforestwatch.org/blog/data-and-research/tree-cover-loss-satellite-data-trend-analysis/).`,
visible: ['global', 'country', 'geostore', 'aoi', 'wdpa', 'use'],
},
];
}

return alerts;
}
);

export default createStructuredSelector({
data: parseData,
config: parseConfig,
sentence: parseSentence,
alerts: parseAlerts,
});
34 changes: 34 additions & 0 deletions components/widgets/fires/tree-loss-fires-annual/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const getIndicator = (state) => state.indicator;
const getColors = (state) => state.colors;
const getSentence = (state) => state && state.sentence;
const getChartDecorationConfig = (state) => state.chartDecorationConfig;
const getAlerts = (state) => state.alerts || [];
const getAdm0 = (state) => state.adm0;

const sumByYear = (data) => {
const groupedByYear = groupBy(data, 'year');
Expand Down Expand Up @@ -211,9 +213,41 @@ export const parseTitle = createSelector(
}
);

export const parseAlerts = createSelector(
[getAlerts, getLocationLabel, getAdm0],
(alerts, locationLabel, adm0) => {
const countriesWithNewWarningText = [
'CMR',
'CIV',
'COD',
'GNQ',
'GAB',
'GHA',
'GIN',
'GNB',
'LBR',
'MDG',
'COG',
'SLE',
];

if (countriesWithNewWarningText.includes(adm0)) {
return [
{
text: `The methods behind this data have changed over time, resulting in an underreporting of tree cover loss in ${locationLabel} prior to 2015. We advise against comparing the data before/after 2015 in ${locationLabel}. [Read more here](https://www.globalforestwatch.org/blog/data-and-research/tree-cover-loss-satellite-data-trend-analysis/).`,
visible: ['global', 'country', 'geostore', 'aoi', 'wdpa', 'use'],
},
];
}

return alerts;
}
);

export default createStructuredSelector({
data: zeroFillData,
config: parseConfig,
sentence: parseSentence,
title: parseTitle,
alerts: parseAlerts,
});
31 changes: 29 additions & 2 deletions components/widgets/forest-change/tree-loss-drivers/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const getSentences = (state) => state.sentences;
const getAlerts = (state) => state.alerts;
const getTitle = (state) => state.title;
const getAdm0 = (state) => state.adm0;
const getLocationLabel = (state) => state.locationLabel;

export const getPermCats = createSelector([], () =>
tscLossCategories.filter((x) => x.permanent).map((el) => el.value.toString())
Expand Down Expand Up @@ -259,8 +260,34 @@ export const parseTitle = createSelector(
);

export const parseAlerts = createSelector(
[getAlerts, getAdm0],
(alerts, adm0) => (adm0 === 'IDN' ? alerts.indonesia : alerts.default)
[getAlerts, getAdm0, getLocationLabel],
(alerts, adm0, locationLabel) => {
const countriesWithNewWarningText = [
'CMR',
'CIV',
'COD',
'GNQ',
'GAB',
'GHA',
'GIN',
'GNB',
'LBR',
'MDG',
'COG',
'SLE',
];

if (countriesWithNewWarningText.includes(adm0)) {
return [
{
text: `The methods behind this data have changed over time, resulting in an underreporting of tree cover loss in ${locationLabel} prior to 2015. We advise against comparing the data before/after 2015 in ${locationLabel}. [Read more here](https://www.globalforestwatch.org/blog/data-and-research/tree-cover-loss-satellite-data-trend-analysis/).`,
visible: ['global', 'country', 'geostore', 'aoi', 'wdpa', 'use'],
},
];
}

return adm0 === 'IDN' ? alerts.indonesia : alerts.default;
}
);

export default createStructuredSelector({
Expand Down
34 changes: 34 additions & 0 deletions components/widgets/forest-change/tree-loss-primary/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const getPrimaryLoss = (state) => state.data && state.data.primaryLoss;
const getAdminLoss = (state) => state.data && state.data.adminLoss;
const getSettings = (state) => state.settings;
const getLocationLabel = (state) => state.locationLabel;
const getAlerts = (state) => state.alerts || [];
const getAdm0 = (state) => state.adm0;
const getIndicator = (state) => state.indicator;
const getColors = (state) => state.colors;
const getSentence = (state) => state && state.sentence;
Expand Down Expand Up @@ -162,6 +164,37 @@ export const parseTitle = createSelector(
}
);

export const parseAlerts = createSelector(
[getAlerts, getLocationLabel, getAdm0],
(alerts, locationLabel, adm0) => {
const countriesWithNewWarningText = [
'CMR',
'CIV',
'COD',
'GNQ',
'GAB',
'GHA',
'GIN',
'GNB',
'LBR',
'MDG',
'COG',
'SLE',
];

if (countriesWithNewWarningText.includes(adm0)) {
return [
{
text: `The methods behind this data have changed over time, resulting in an underreporting of tree cover loss in ${locationLabel} prior to 2015. We advise against comparing the data before/after 2015 in ${locationLabel}. [Read more here](https://www.globalforestwatch.org/blog/data-and-research/tree-cover-loss-satellite-data-trend-analysis/).`,
visible: ['global', 'country', 'geostore', 'aoi', 'wdpa', 'use'],
},
];
}

return alerts;
}
);

const parseSentence = createSelector(
[
parseData,
Expand Down Expand Up @@ -249,4 +282,5 @@ export default createStructuredSelector({
config: parseConfig,
sentence: parseSentence,
title: parseTitle,
alerts: parseAlerts,
});
34 changes: 34 additions & 0 deletions components/widgets/forest-change/tree-loss/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ const getLocationLabel = (state) => state.locationLabel;
const getIndicator = (state) => state.indicator;
const getColors = (state) => state.colors;
const getSentence = (state) => state && state.sentence;
const getAlerts = (state) => state.alerts || [];
const getAdm0 = (state) => state.adm0;

const parseData = createSelector(
[getLoss, getExtent, getSettings],
Expand Down Expand Up @@ -161,8 +163,40 @@ const parseSentence = createSelector(
}
);

export const parseAlerts = createSelector(
[getAlerts, getLocationLabel, getAdm0],
(alerts, locationLabel, adm0) => {
const countriesWithNewWarningText = [
'CMR',
'CIV',
'COD',
'GNQ',
'GAB',
'GHA',
'GIN',
'GNB',
'LBR',
'MDG',
'COG',
'SLE',
];

if (countriesWithNewWarningText.includes(adm0)) {
return [
{
text: `The methods behind this data have changed over time, resulting in an underreporting of tree cover loss in ${locationLabel} prior to 2015. We advise against comparing the data before/after 2015 in ${locationLabel}. [Read more here](https://www.globalforestwatch.org/blog/data-and-research/tree-cover-loss-satellite-data-trend-analysis/).`,
visible: ['global', 'country', 'geostore', 'aoi', 'wdpa', 'use'],
},
];
}

return alerts;
}
);

export default createStructuredSelector({
data: zeroFillData,
config: parseConfig,
sentence: parseSentence,
alerts: parseAlerts,
});
Loading