Skip to content

Commit 113fd59

Browse files
committed
feat(forest-types): add natural forest option
1 parent ecd9367 commit 113fd59

File tree

30 files changed

+86
-32
lines changed

30 files changed

+86
-32
lines changed

components/ui/dynamic-sentence/component.jsx

+15
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ class DynamicSentence extends PureComponent {
6262
});
6363
}
6464

65+
if (formattedSentence?.includes('sbtn')) {
66+
formattedSentence = formattedSentence?.replace('sbtn', 'SBTN');
67+
}
68+
6569
formattedSentence = [formattedSentence?.replace('{area}', 'selected area')];
6670
if (component) {
6771
const mappedComponent = {
@@ -91,6 +95,17 @@ class DynamicSentence extends PureComponent {
9195
);
9296
}
9397

98+
if (
99+
Array.isArray(formattedSentence) &&
100+
formattedSentence.length !== 0 &&
101+
formattedSentence[0]?.includes('covering a total of')
102+
) {
103+
formattedSentence[0] = formattedSentence[0].replace(
104+
'<b>covering a total of ',
105+
'covering a total of <b>'
106+
);
107+
}
108+
94109
return (
95110
<div
96111
data-test={!!testId && testId}

components/widgets/climate/carbon-flux/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export default {
4343
type: 'select',
4444
placeholder: 'All tree cover',
4545
clearable: true,
46+
blacklist: ['natural_forests_2020'],
4647
},
4748
{
4849
key: 'landCategory',

components/widgets/climate/emissions-deforestation/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export default {
4545
type: 'select',
4646
placeholder: 'All tree cover',
4747
clearable: true,
48+
blacklist: ['natural_forests_2020'],
4849
},
4950
{
5051
key: 'landCategory',

components/widgets/fires/burned-area-cumulative/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const defaultConfig = {
3636
type: 'select',
3737
placeholder: 'All land cover',
3838
clearable: true,
39+
blacklist: ['natural_forests_2020'],
3940
},
4041
{
4142
key: 'landCategory',

components/widgets/fires/burned-area-ranked/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const defaultConfig = {
3333
type: 'select',
3434
placeholder: 'All land cover',
3535
clearable: true,
36+
blacklist: ['natural_forests_2020'],
3637
},
3738
{
3839
key: 'landCategory',

components/widgets/fires/burned-area/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export default {
3030
type: 'select',
3131
placeholder: 'All land cover',
3232
clearable: true,
33+
blacklist: ['natural_forests_2020'],
3334
},
3435
{
3536
key: 'landCategory',

components/widgets/fires/fire-alerts-simple/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export default {
8080
placeholder: 'All categories',
8181
clearable: true,
8282
border: true,
83+
whitelist: ['aze', 'landmark', 'kba', 'mining', 'wdpa'],
8384
},
8485
{
8586
key: 'dataset',

components/widgets/fires/fire-alerts-simple/selectors.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ export const parseConfig = createSelector(
5555
} = data;
5656
const alertsLabel = indicator
5757
? translateText('Other alerts in {indicatorLabel}', {
58-
indicatorLabel: indicator.label,
58+
indicatorLabel: indicator.label.replace('sbtn', 'SBTN'),
5959
})
6060
: translateText('Other alerts');
6161
const highConfidenceAlertsLabel = indicator
6262
? translateText('High confidence alerts in {indicatorLabel}', {
63-
indicatorLabel: indicator.label,
63+
indicatorLabel: indicator.label.replace('sbtn', 'SBTN'),
6464
})
6565
: translateText('High confidence alerts');
6666

components/widgets/fires/fires-alerts-cumulative/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export default {
2525
type: 'select',
2626
placeholder: 'All land cover',
2727
clearable: true,
28+
blacklist: ['natural_forests_2020'],
2829
},
2930
{
3031
key: 'landCategory',

components/widgets/fires/fires-alerts-historical-weekly/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export default {
2828
type: 'select',
2929
placeholder: 'All land cover',
3030
clearable: true,
31+
blacklist: ['natural_forests_2020'],
3132
},
3233
{
3334
key: 'landCategory',

components/widgets/fires/fires-alerts-historical/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export default {
2828
type: 'select',
2929
placeholder: 'All land cover',
3030
clearable: true,
31+
blacklist: ['natural_forests_2020'],
3132
},
3233
{
3334
key: 'landCategory',

components/widgets/fires/fires-alerts/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const defaultConfig = {
3838
type: 'select',
3939
placeholder: 'All land cover',
4040
clearable: true,
41+
blacklist: ['natural_forests_2020'],
4142
},
4243
{
4344
key: 'landCategory',

components/widgets/fires/fires-ranked/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export default {
2424
type: 'select',
2525
placeholder: 'All land cover',
2626
clearable: true,
27+
blacklist: ['natural_forests_2020'],
2728
},
2829
{
2930
key: 'landCategory',

components/widgets/fires/fires-within/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export default {
3030
placeholder: 'All land cover',
3131
clearable: true,
3232
border: false,
33+
blacklist: ['natural_forests_2020'],
3334
},
3435
{
3536
key: 'landCategory',

components/widgets/fires/tree-loss-fires-annual/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default {
4545
type: 'select',
4646
placeholder: 'All tree cover',
4747
clearable: true,
48-
blacklist: ['mangroves_2016'],
48+
blacklist: ['mangroves_2016', 'natural_forests_2020'],
4949
},
5050
{
5151
key: 'landCategory',

components/widgets/fires/tree-loss-fires-proportion/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default {
4444
type: 'select',
4545
placeholder: 'All tree cover',
4646
clearable: true,
47-
blacklist: ['mangroves_2016'],
47+
blacklist: ['mangroves_2016', 'natural_forests_2020'],
4848
},
4949
{
5050
key: 'landCategory',

components/widgets/forest-change/glad-alerts-simple/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export default {
6767
type: 'select',
6868
placeholder: 'All tree cover',
6969
clearable: true,
70+
blacklist: ['natural_forests_2020'],
7071
},
7172
{
7273
key: 'landCategory',

components/widgets/forest-change/glad-alerts/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ export default {
9595
type: 'select',
9696
placeholder: 'All tree cover',
9797
clearable: true,
98+
blacklist: ['natural_forests_2020'],
9899
},
99100
{
100101
key: 'landCategory',

components/widgets/forest-change/glad-ranked/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export default {
3333
type: 'select',
3434
placeholder: 'All tree cover',
3535
clearable: true,
36+
blacklist: ['natural_forests_2020'],
3637
},
3738
{
3839
key: 'landCategory',

components/widgets/forest-change/integrated-alerts-ranked/index.js

+2-15
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,7 @@ export default {
3838
type: 'select',
3939
placeholder: 'All tree cover',
4040
clearable: true,
41-
},
42-
{
43-
key: 'landCategory',
44-
label: 'Land Category',
45-
type: 'select',
46-
whitelist: ['mining', 'wdpa', 'landmark'],
47-
placeholder: 'All categories',
48-
clearable: true,
49-
border: true,
41+
whitelist: ['natural_forests_2020'],
5042
},
5143
{
5244
key: 'deforestationAlertsDataset',
@@ -67,12 +59,6 @@ export default {
6759
whitelist: ['%', 'ha'],
6860
border: true,
6961
},
70-
{
71-
key: 'threshold',
72-
label: 'canopy density',
73-
type: 'mini-select',
74-
metaKey: 'widget_canopy_density',
75-
},
7662
],
7763
pendingKeys: ['extentYear', 'threshold'],
7864
refetchKeys: [
@@ -98,6 +84,7 @@ export default {
9884
layers: [GLAD_ALERTS],
9985
},
10086
],
87+
noStatements: true,
10188
sortOrder: {
10289
summary: 6,
10390
forestChange: 10,

components/widgets/forest-change/integrated-deforestation-alerts/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ export default {
136136
placeholder: 'All categories',
137137
clearable: true,
138138
border: true,
139+
whitelist: ['aze', 'landmark', 'kba', 'mining', 'wdpa'],
139140
},
140141
{
141142
key: 'dateRange',

components/widgets/forest-change/integrated-deforestation-alerts/selectors.js

+18-8
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,24 @@ export const parseConfig = createSelector(
104104
} = data;
105105

106106
const lowAlertsLabel = indicator
107-
? `Detection by a single alert system in ${indicator.label}`
107+
? `Detection by a single alert system in ${indicator.label.replace(
108+
'sbtn',
109+
'SBTN'
110+
)}`
108111
: 'Detection by a single alert system';
109112

110113
const highAlertsLabel = indicator
111-
? `High confidence detection by a single alert system in ${indicator.label}`
114+
? `High confidence detection by a single alert system in ${indicator.label.replace(
115+
'sbtn',
116+
'SBTN'
117+
)}`
112118
: 'High confidence detection by a single alert system';
113119

114120
const highestAlertsLabel = indicator
115-
? `Highest confidence detection by multiple alert systems in ${indicator.label}`
121+
? `Highest confidence detection by multiple alert systems in ${indicator.label.replace(
122+
'sbtn',
123+
'SBTN'
124+
)}`
116125
: 'Highest confidence detection by multiple alert systems';
117126

118127
const highColour = colors.integratedHigh;
@@ -201,11 +210,12 @@ export const parseSentence = createSelector(
201210
totalArea: !totalArea
202211
? ' '
203212
: translateText('covering a total of {area}', {
204-
area: formatNumber({
205-
num: totalArea,
206-
unit: 'ha',
207-
spaceUnit: true,
208-
})}),
213+
area: formatNumber({
214+
num: totalArea,
215+
unit: 'ha',
216+
spaceUnit: true,
217+
}),
218+
}),
209219
total: formatNumber({ num: totalAlertCount, unit: ',' }),
210220
highConfPerc:
211221
highAlertPercentage === 0

components/widgets/forest-change/tree-loss-plantations/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export default {
6868
layers: [FOREST_LOSS],
6969
},
7070
],
71-
dataType: 'naturalForest',
71+
noStatements: true,
7272
sortOrder: {
7373
forestChange: 2,
7474
},

components/widgets/land-cover/natural-forest/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default {
5050
layers: [NATURAL_FOREST_2020],
5151
},
5252
],
53-
dataType: 'naturalForest',
53+
noStatements: true,
5454
sortOrder: {
5555
summary: 6,
5656
landCover: 1,

components/widgets/land-cover/ranked-forest-types/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export default {
3535
type: 'select',
3636
placeholder: 'All land cover',
3737
clearable: true,
38+
blacklist: ['natural_forests_2020'],
3839
},
3940
{
4041
key: 'decile',

components/widgets/land-cover/tree-cover-located/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ export default {
2727
alerts: [
2828
{
2929
id: 'tree-cover-located-alert-1',
30-
text:
31-
'Datasets available here (Tree Cover 2000/ 2010 and Tropical Tree Cover 2020) use different methodologies to measure tree cover. Read [our blog](https://www.globalforestwatch.org/blog/data-and-research/tree-cover-data-comparison/) for more information.',
30+
text: 'Datasets available here (Tree Cover 2000/ 2010 and Tropical Tree Cover 2020) use different methodologies to measure tree cover. Read [our blog](https://www.globalforestwatch.org/blog/data-and-research/tree-cover-data-comparison/) for more information.',
3231
visible: [
3332
'global',
3433
'country',
@@ -152,6 +151,7 @@ export default {
152151
type: 'select',
153152
placeholder: 'All tree cover',
154153
clearable: true,
154+
blacklist: ['natural_forests_2020'],
155155
},
156156
{
157157
key: 'landCategory',

components/widgets/selectors.js

+2
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ export const getWidgets = createSelector(
444444
getDataType: dataTypeFn,
445445
settingsConfig: settingsConfigArr,
446446
getSettingsConfig: settingsConfigFn,
447+
noStatements,
447448
} = w || {};
448449
const active =
449450
(!activeWidgetKey && index === 0) || activeWidgetKey === widget;
@@ -565,6 +566,7 @@ export const getWidgets = createSelector(
565566
type,
566567
dataType,
567568
active,
569+
noStatements,
568570
settings: {
569571
...defaultSettings,
570572
...allowedFooterSettings,

components/widgets/utils/config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ export const getStatements = ({
358358
landCategory,
359359
forestType,
360360
datasets,
361+
noStatements,
361362
}) => {
362363
if (!settings) return null;
363364
const { extentYear, threshold, decile } = settings;
@@ -440,7 +441,7 @@ export const getStatements = ({
440441
...(indicatorStatements || []),
441442
]);
442443

443-
if (dataType === 'naturalForest') {
444+
if (noStatements) {
444445
return [];
445446
}
446447

data/forest-types.js

+16
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ import {
33
INTACT_FOREST_LANDSCAPES_DATASET,
44
PRIMARY_FOREST_DATASET,
55
MANGROVE_FORESTS_DATASET,
6+
NATURAL_FOREST,
67
} from 'data/datasets';
78
import {
89
TREE_PLANTATIONS,
910
INTACT_FOREST_LANDSCAPES,
1011
PRIMARY_FOREST,
1112
MANGROVE_FORESTS,
13+
NATURAL_FOREST_2020,
1214
} from 'data/layers';
1315

1416
export default [
@@ -98,6 +100,20 @@ export default [
98100
],
99101
hidden: false,
100102
},
103+
{
104+
label: 'SBTN natural forest 2020',
105+
value: 'natural_forests_2020',
106+
dataType: 'number',
107+
tableKey: 'sbtn_natural_forests__class',
108+
metaKey: 'sbtn_natural_forests_map',
109+
global: true,
110+
datasets: [
111+
{
112+
dataset: NATURAL_FOREST,
113+
layers: [NATURAL_FOREST_2020],
114+
},
115+
],
116+
},
101117
{
102118
label: 'Tree cover loss driver category',
103119
value: 'tsc',

0 commit comments

Comments
 (0)