Skip to content

Commit b3ccbc3

Browse files
authored
Merge pull request #3552 from Vizzuality/fix/header-global
Add global sentence to header
2 parents ea38744 + cf031e6 commit b3ccbc3

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

app/javascript/pages/dashboards/header/header-reducers.js

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ export const initialState = {
88
'In 2010, {location} had {extent} of tree cover, extending over {percentage} of its land area.',
99
withLoss:
1010
'In 2010, {location} had {extent} of tree cover, extending over {percentage} of its land area. In {year}, it lost {loss} of forest, equivalent to {emission} of CO₂ of emissions.',
11+
globalInitial:
12+
'In 2010, {location} had {extent} of tree cover, extending over {percentage} of its land area. In {year}, it lost {loss} of tree cover, equivalent to {emission} of CO₂ of emissions.',
1113
withPlantationLoss:
1214
'In 2010, {location} had {extent} of natural forest, extending over {percentage} of its land area. In {year}, it lost {loss} of natural forest, equivalent to {emission} of CO₂ of emissions.'
1315
}

app/javascript/pages/dashboards/header/header-selectors.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const getSentence = createSelector(
4747
return 'An error occured while fetching data. Please try again later.';
4848
}
4949
if (isEmpty(data) || isEmpty(locationNames)) return {};
50-
const { initial, withLoss, withPlantationLoss } = sentences;
50+
const { initial, withLoss, withPlantationLoss, globalInitial } = sentences;
5151
const extent =
5252
data.extent < 1 ? format('.3r')(data.extent) : format('.3s')(data.extent);
5353
const percentageCover = format('.1f')(data.extent / data.totalArea * 100);
@@ -75,6 +75,7 @@ export const getSentence = createSelector(
7575
sentence =
7676
data.plantationsLoss.area && location ? withPlantationLoss : withLoss;
7777
}
78+
if (!location) sentence = globalInitial;
7879

7980
return {
8081
sentence,

0 commit comments

Comments
 (0)