Skip to content

Commit

Permalink
feat(profile-form): update profile form
Browse files Browse the repository at this point in the history
  • Loading branch information
wri7tno committed Jan 15, 2025
1 parent a690c02 commit 6be89ab
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 37 deletions.
9 changes: 1 addition & 8 deletions components/forms/newsletter/component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Select from 'components/forms/components/select';
import Submit from 'components/forms/components/submit';
import SuccessMessage from 'components/success-message';
import Error from 'components/forms/components/error';
import { preferredLanguages } from 'components/forms/profile/config';

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

const preferredLanguages = [
{ label: 'English', value: 'en' },
{ label: 'Français', value: 'fr' },
{ label: 'Español', value: 'es' },
{ label: 'Português', value: 'pt' },
{ label: 'Bahasa Indonesia', value: 'id' },
];

const interests = [
'Innovations in Monitoring',
'Fires',
Expand Down
4 changes: 4 additions & 0 deletions components/forms/profile/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export const saveProfile = createThunkAction(
jobTitle,
signUpForTesting,
isUserProfileFilled,
receive_updates = false,
preferred_language = 'en',
} = fields;

const postData = {
Expand All @@ -47,6 +49,8 @@ export const saveProfile = createThunkAction(
aoiCountry,
jobTitle,
areaOrRegionOfInterest,
receive_updates,
preferred_language,
subsector:
subsector && subsector.includes('Other')
? `Other: ${subsector_otherInput || ''}`
Expand Down
26 changes: 17 additions & 9 deletions components/forms/profile/component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import Submit from 'components/forms/components/submit';
import ConfirmationMessage from 'components/confirmation-message';
import Button from 'components/ui/button';
import Error from 'components/forms/components/error';
import { preferredLanguages } from 'components/forms/profile/config';

import {
email as validateEmail,
Expand Down Expand Up @@ -155,15 +156,17 @@ class ProfileForm extends PureComponent {
label="What topics are you interested in?"
multiple
required
options={[
...sortBy(
interests.map((r) => ({
label: r,
value: r.replace(/( )+|(\/)+/g, '_'),
})),
'label'
),
]}
options={interests.map((r) => ({
label: r,
value: r.replace(/( )+|(\/)+/g, '_').toLowerCase(),
}))}
/>
<Select
name="preferred_language"
label="Preferred Language"
description="Please note that most communications will be sent in English."
placeholder="Select a preferred language"
options={preferredLanguages}
/>
<Checkbox
name="howDoYouUse"
Expand Down Expand Up @@ -209,6 +212,11 @@ class ProfileForm extends PureComponent {
label="Would you like to help us test new application features?"
options={[{ label: 'Yes', value: 'true' }]}
/>
<Checkbox
name="receive_updates"
label="WOULD YOU LIKE TO RECEIVE UPDATES ON NEWS AND EVENTS FROM GLOBAL FOREST?"
options={[{ label: 'Yes', value: 'true' }]}
/>
<Error
valid={valid}
submitFailed={submitFailed}
Expand Down
48 changes: 28 additions & 20 deletions components/forms/profile/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ export const sectors = {
'Legislature/Parliament',
'Ministry/National Agency',
'Subnational Agency',
'Other:'
'Other:',
],
'Donor Institution / Agency': [
'Director/Executive',
'Project/Program Manager',
'Researcher',
'Monitoring/Evaluation',
'Field/Country Staff',
'Other:'
'Other:',
],
'Local NGO (national or subnational)': [
'Director/Executive',
Expand All @@ -24,7 +24,7 @@ export const sectors = {
'Field Staff',
'Communications Specialist',
'Park/Forest Ranger',
'Other:'
'Other:',
],
'International NGO': [
'Director/Executive',
Expand All @@ -34,7 +34,7 @@ export const sectors = {
'Field/Country Staff',
'Communications Specialist',
'Researcher',
'Other:'
'Other:',
],
'UN or International Organization': [
'Director/Executive',
Expand All @@ -44,48 +44,48 @@ export const sectors = {
'Monitoring/Evaluation Specialist',
'GIS/Technical Specialist',
'Communications Specialist',
'Other:'
'Other:',
],
'Academic / Research Organization': [
'Faculty (Primary/Secondary)',
'Faculty (University)',
'Student (Primary/Secondary)',
'Student (University/Graduate)',
'Researcher (Post-Doc, Fellow, etc.)',
'Other:'
'Other:',
],
'Journalist / Media Organization': ['Reporter', 'Editor', 'Other:'],
'Indigenous or Community-Based Organization': [
'Community Leader',
'Forest Manager/Monitor',
'GIS/Technical Specialist',
'Communications Specialist',
'Other:'
'Other:',
],
'Private sector': [
'Supply Chain Manager',
'Supply Chain Analyst',
'Procurement Staff',
'Retailer/Trader',
'Land or Concession Owner',
'Other:'
'Other:',
],
'Individual / No Affiliation': ['Other:'],
Other: ['Other:']
Other: ['Other:'],
};

export const interests = [
'Climate/Carbon',
'Biodiversity',
'Deforestation/Forest Degradation',
'Innovations in forest monitoring',
'Watersheds ',
'General information/Data about forests',
'Reforestation/Landscape restoration',
'Agricultural supply chains',
'Innovations in Monitoring',
'Fires',
'Forest Watcher Mobile App',
'Climate and Carbon',
'Biodiversity',
'Agricultural Supply Chains',
'Small Grants Fund and Tech Fellowship',
'My region or country'
'Landscape Restoration',
'GFW Users in Action',
'Places to Watch alerts',
'Deforestation',
];

export const howDoYouUse = [
Expand All @@ -102,7 +102,7 @@ export const howDoYouUse = [
'Learn about forests/my country',
'Inform purchasing/procurement/investment decisions',
'Educational support materials',
'Not sure; new to GFW'
'Not sure; new to GFW',
];

export const topics = [
Expand All @@ -111,5 +111,13 @@ export const topics = [
'Fires',
'Forest Watcher Mobile App',
'Innovations in Monitoring',
'Small Grants Fund and Tech Fellowship'
'Small Grants Fund and Tech Fellowship',
];

export const preferredLanguages = [
{ label: 'English', value: 'en' },
{ label: 'Français', value: 'fr' },
{ label: 'Español', value: 'es' },
{ label: 'Português', value: 'pt' },
{ label: 'Bahasa Indonesia', value: 'id' },
];

0 comments on commit 6be89ab

Please sign in to comment.