Skip to content

Commit 10322e5

Browse files
authored
Merge pull request #4942 from wri/develop
PROD Deploy 2025-02-27 12:12pm EST
2 parents e42f68e + a6f1e8c commit 10322e5

File tree

9 files changed

+178
-41
lines changed

9 files changed

+178
-41
lines changed

components/forms/newsletter/component.jsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import Select from 'components/forms/components/select';
1111
import Submit from 'components/forms/components/submit';
1212
import SuccessMessage from 'components/success-message';
1313
import Error from 'components/forms/components/error';
14+
import { preferredLanguages } from 'components/forms/profile/config';
1415

1516
import { email as validateEmail } from 'components/forms/validations';
1617
import Checkbox from '../components/checkbox/component';
@@ -29,14 +30,6 @@ const sectors = [
2930
'Other',
3031
];
3132

32-
const preferredLanguages = [
33-
{ label: 'English', value: 'en' },
34-
{ label: 'Français', value: 'fr' },
35-
{ label: 'Español', value: 'es' },
36-
{ label: 'Português', value: 'pt' },
37-
{ label: 'Bahasa Indonesia', value: 'id' },
38-
];
39-
4033
const interests = [
4134
'Innovations in Monitoring',
4235
'Fires',

components/forms/profile/actions.js

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
import { createThunkAction } from 'redux/actions';
2+
import axios from 'axios';
23
import { FORM_ERROR } from 'final-form';
34

45
import { updateProfile, createProfile } from 'services/user';
56
import { setMyGFW } from 'providers/mygfw-provider/actions';
67

8+
const saveOrttoProfile = async (payload) => {
9+
try {
10+
await axios.post('/api/ortto', payload);
11+
} catch (error) {
12+
// eslint-disable-next-line no-console
13+
console.error(error);
14+
}
15+
};
16+
717
export const saveProfile = createThunkAction(
818
'saveProfile',
919
(fields) => (dispatch) => {
@@ -17,6 +27,7 @@ export const saveProfile = createThunkAction(
1727
firstName,
1828
lastName,
1929
email,
30+
old_email,
2031
country,
2132
city,
2233
state,
@@ -29,6 +40,8 @@ export const saveProfile = createThunkAction(
2940
jobTitle,
3041
signUpForTesting,
3142
isUserProfileFilled,
43+
receive_updates = false,
44+
preferred_language = 'en',
3245
} = fields;
3346

3447
const postData = {
@@ -47,6 +60,8 @@ export const saveProfile = createThunkAction(
4760
aoiCountry,
4861
jobTitle,
4962
areaOrRegionOfInterest,
63+
receive_updates,
64+
preferred_language,
5065
subsector:
5166
subsector && subsector.includes('Other')
5267
? `Other: ${subsector_otherInput || ''}`
@@ -72,8 +87,27 @@ export const saveProfile = createThunkAction(
7287
const updateOrCreate = isUserProfileFilled ? updateProfile : createProfile;
7388

7489
return updateOrCreate(id, postData)
75-
.then((response) => {
90+
.then(async (response) => {
7691
if (response.data && response.data.data) {
92+
saveOrttoProfile({
93+
email,
94+
first_name: firstName,
95+
last_name: lastName,
96+
organization: company,
97+
job_title: jobTitle,
98+
job_function:
99+
subsector && subsector.includes('Other')
100+
? `Other: ${subsector_otherInput || ''}`
101+
: subsector,
102+
sector,
103+
city,
104+
country,
105+
preferred_language,
106+
interests: interests.toString(),
107+
receive_updates,
108+
old_email,
109+
});
110+
77111
const { attributes } = response.data.data;
78112
dispatch(
79113
setMyGFW({

components/forms/profile/component.jsx

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import Submit from 'components/forms/components/submit';
1414
import ConfirmationMessage from 'components/confirmation-message';
1515
import Button from 'components/ui/button';
1616
import Error from 'components/forms/components/error';
17+
import { preferredLanguages } from 'components/forms/profile/config';
1718

1819
import {
1920
email as validateEmail,
@@ -95,6 +96,11 @@ class ProfileForm extends PureComponent {
9596
validate={[validateEmail]}
9697
required
9798
/>
99+
<Input
100+
name="old_email"
101+
type="hidden"
102+
value={initialValues.old_email}
103+
/>
98104
<Select
99105
name="sector"
100106
label="sector"
@@ -155,15 +161,17 @@ class ProfileForm extends PureComponent {
155161
label="What topics are you interested in?"
156162
multiple
157163
required
158-
options={[
159-
...sortBy(
160-
interests.map((r) => ({
161-
label: r,
162-
value: r.replace(/( )+|(\/)+/g, '_'),
163-
})),
164-
'label'
165-
),
166-
]}
164+
options={interests.map((r) => ({
165+
label: r,
166+
value: r.replace(/( )+|(\/)+/g, '_').toLowerCase(),
167+
}))}
168+
/>
169+
<Select
170+
name="preferred_language"
171+
label="Preferred Language"
172+
description="Please note that most communications will be sent in English."
173+
placeholder="Select a preferred language"
174+
options={preferredLanguages}
167175
/>
168176
<Checkbox
169177
name="howDoYouUse"
@@ -209,6 +217,11 @@ class ProfileForm extends PureComponent {
209217
label="Would you like to help us test new application features?"
210218
options={[{ label: 'Yes', value: 'true' }]}
211219
/>
220+
<Checkbox
221+
name="receive_updates"
222+
label="WOULD YOU LIKE TO RECEIVE UPDATES ON NEWS AND EVENTS FROM GLOBAL FOREST?"
223+
options={[{ label: 'Yes', value: 'true' }]}
224+
/>
212225
<Error
213226
valid={valid}
214227
submitFailed={submitFailed}

components/forms/profile/config.js

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ export const sectors = {
55
'Legislature/Parliament',
66
'Ministry/National Agency',
77
'Subnational Agency',
8-
'Other:'
8+
'Other:',
99
],
1010
'Donor Institution / Agency': [
1111
'Director/Executive',
1212
'Project/Program Manager',
1313
'Researcher',
1414
'Monitoring/Evaluation',
1515
'Field/Country Staff',
16-
'Other:'
16+
'Other:',
1717
],
1818
'Local NGO (national or subnational)': [
1919
'Director/Executive',
@@ -24,7 +24,7 @@ export const sectors = {
2424
'Field Staff',
2525
'Communications Specialist',
2626
'Park/Forest Ranger',
27-
'Other:'
27+
'Other:',
2828
],
2929
'International NGO': [
3030
'Director/Executive',
@@ -34,7 +34,7 @@ export const sectors = {
3434
'Field/Country Staff',
3535
'Communications Specialist',
3636
'Researcher',
37-
'Other:'
37+
'Other:',
3838
],
3939
'UN or International Organization': [
4040
'Director/Executive',
@@ -44,48 +44,48 @@ export const sectors = {
4444
'Monitoring/Evaluation Specialist',
4545
'GIS/Technical Specialist',
4646
'Communications Specialist',
47-
'Other:'
47+
'Other:',
4848
],
4949
'Academic / Research Organization': [
5050
'Faculty (Primary/Secondary)',
5151
'Faculty (University)',
5252
'Student (Primary/Secondary)',
5353
'Student (University/Graduate)',
5454
'Researcher (Post-Doc, Fellow, etc.)',
55-
'Other:'
55+
'Other:',
5656
],
5757
'Journalist / Media Organization': ['Reporter', 'Editor', 'Other:'],
5858
'Indigenous or Community-Based Organization': [
5959
'Community Leader',
6060
'Forest Manager/Monitor',
6161
'GIS/Technical Specialist',
6262
'Communications Specialist',
63-
'Other:'
63+
'Other:',
6464
],
6565
'Private sector': [
6666
'Supply Chain Manager',
6767
'Supply Chain Analyst',
6868
'Procurement Staff',
6969
'Retailer/Trader',
7070
'Land or Concession Owner',
71-
'Other:'
71+
'Other:',
7272
],
7373
'Individual / No Affiliation': ['Other:'],
74-
Other: ['Other:']
74+
Other: ['Other:'],
7575
};
7676

7777
export const interests = [
78-
'Climate/Carbon',
79-
'Biodiversity',
80-
'Deforestation/Forest Degradation',
81-
'Innovations in forest monitoring',
82-
'Watersheds ',
83-
'General information/Data about forests',
84-
'Reforestation/Landscape restoration',
85-
'Agricultural supply chains',
78+
'Innovations in Monitoring',
8679
'Fires',
80+
'Forest Watcher Mobile App',
81+
'Climate and Carbon',
82+
'Biodiversity',
83+
'Agricultural Supply Chains',
8784
'Small Grants Fund and Tech Fellowship',
88-
'My region or country'
85+
'Landscape Restoration',
86+
'GFW Users in Action',
87+
'Places to Watch alerts',
88+
'Deforestation',
8989
];
9090

9191
export const howDoYouUse = [
@@ -102,7 +102,7 @@ export const howDoYouUse = [
102102
'Learn about forests/my country',
103103
'Inform purchasing/procurement/investment decisions',
104104
'Educational support materials',
105-
'Not sure; new to GFW'
105+
'Not sure; new to GFW',
106106
];
107107

108108
export const topics = [
@@ -111,5 +111,13 @@ export const topics = [
111111
'Fires',
112112
'Forest Watcher Mobile App',
113113
'Innovations in Monitoring',
114-
'Small Grants Fund and Tech Fellowship'
114+
'Small Grants Fund and Tech Fellowship',
115+
];
116+
117+
export const preferredLanguages = [
118+
{ label: 'English', value: 'en' },
119+
{ label: 'Français', value: 'fr' },
120+
{ label: 'Español', value: 'es' },
121+
{ label: 'Português', value: 'pt' },
122+
{ label: 'Bahasa Indonesia', value: 'id' },
115123
];

components/forms/profile/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const splitLastName = (fullName) => {
1818
};
1919

2020
const mapStateToProps = ({ myGfw, countryData }) => {
21-
const { howDoYouUse, subsector, firstName, fullName, lastName } =
21+
const { howDoYouUse, subsector, firstName, fullName, lastName, email } =
2222
myGfw.data || {};
2323

2424
const subsectorHasOther = subsector && subsector.includes('Other');
@@ -43,6 +43,7 @@ const mapStateToProps = ({ myGfw, countryData }) => {
4343
myGfw.data && {
4444
initialValues: {
4545
...myGfw.data,
46+
old_email: email,
4647
firstName: firstName || (fullName && splitFirstName(fullName)),
4748
lastName: lastName || (fullName && splitLastName(fullName)),
4849
subsector: subsectorOther ? 'Other:' : subsector,

components/map/basemaps.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export default {
5151
baseStyle: false,
5252
hasSettings: false,
5353
infoModal: 'satellite_basemap',
54+
caveat: '(global)',
5455
image: satelliteImage,
5556
basemapGroup: 'basemap-satellite',
5657
labelsGroup: 'labels-dark',

components/satellite-basemaps/component.jsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,15 @@ const SatelliteBasemaps = ({
6363
}
6464
}, [isTropics, defaultSatSet]);
6565

66+
let sortedBasemaps = basemaps;
67+
if (basemaps.length >= 4) {
68+
sortedBasemaps = [
69+
basemaps[1],
70+
...basemaps.slice(0, 1),
71+
...basemaps.slice(2),
72+
];
73+
}
74+
6675
const handleToggleActive = () => {
6776
setOpen(!activeBasemap.active);
6877
setMapBasemap({
@@ -142,7 +151,7 @@ const SatelliteBasemaps = ({
142151
<section className="satellite-basemaps">
143152
<h4>SATELLITE IMAGERY</h4>
144153
<ul>
145-
{basemaps.map((basemap) => {
154+
{sortedBasemaps.map((basemap) => {
146155
return (
147156
<li
148157
key={`satellite-basemap-${basemap.value}`}

components/satellite-basemaps/selectors.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export const getActiveDynoBasemap = createSelector(
4949
if (!basemaps || !activeBasemap) {
5050
return null;
5151
}
52-
const defaultBasemap = find(basemaps, { value: 'planet' });
52+
const defaultBasemap = find(basemaps, { value: 'satellite' });
5353
const dynoBasemap = find(basemaps, { value: activeBasemap.value });
5454

5555
if (dynoBasemap) {

0 commit comments

Comments
 (0)