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

chore: permission form, add two questions and answers in en #677

Merged
46 changes: 39 additions & 7 deletions messages/renderer/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@
},
"renderer.components.MapEditor.ICCAExportDialog.question1Prompt": {
"description": "Question prompts",
"message": "Has your community or indigenous people collectively consented to the map\n and other information being shared with UNEP-WCMC?"
"message": "Have your community or indigenous people collectively consented to the map \n and other information being shared with UNEP-WCMC?"
},
"renderer.components.MapEditor.ICCAExportDialog.question2Prompt": {
"message": "Do you want the map and other information to be available for anyone to\n view and download?"
"message": "Do you want the map and other information to be available for anyone \n to view and download?"
},
"renderer.components.MapEditor.ICCAExportDialog.question3Prompt": {
"message": "Name of the community, indigenous people, or individual providing the\n information"
"message": "Name of the community, indigenous people, or individual providing the\n information (Original language, English)"
},
"renderer.components.MapEditor.ICCAExportDialog.question4Answer1": {
"description": "Choices for question 4",
Expand All @@ -130,12 +130,44 @@
"renderer.components.MapEditor.ICCAExportDialog.question4Prompt": {
"message": "If you are an individual, what is your relationship to the indigenous\n people or community?"
},
"renderer.components.MapEditor.ICCAExportDialog.question5Placeholder": {
"description": "Placeholder for question 5",
"message": "Your contact information"
"renderer.components.MapEditor.ICCAExportDialog.question5Answer1": {
"description": "Choices for question 5",
"message": "Yes - peer review"
},
"renderer.components.MapEditor.ICCAExportDialog.question5Answer2": {
"message": "Yes - government review"
},
"renderer.components.MapEditor.ICCAExportDialog.question5Answer3": {
"message": "No"
},
"renderer.components.MapEditor.ICCAExportDialog.question5Answer4": {
"message": "Don’t know"
},
"renderer.components.MapEditor.ICCAExportDialog.question5Prompt": {
"message": "Email address, phone number or address where we can contact you. We will\n contact you to confirm we have received your information and to discuss\n the information further where needed. We will also contact you periodically\n to make sure the information is up to date."
"message": "Has the ICCA information been reviewed either by a peer-review process \n (i.e., by other communities) or by a government body? (For more information on this topic, \n please see the ICCA data manual: https://www.wcmc.io/iccadatamanual)"
},
"renderer.components.MapEditor.ICCAExportDialog.question6Answer1": {
"description": "Choices for question 6",
"message": "Yes - as a protected area"
},
"renderer.components.MapEditor.ICCAExportDialog.question6Answer2": {
"message": "Yes - as an OECM"
},
"renderer.components.MapEditor.ICCAExportDialog.question6Answer3": {
"message": "No - only as an ICCA"
},
"renderer.components.MapEditor.ICCAExportDialog.question6Answer4": {
"message": "Don’t know"
},
"renderer.components.MapEditor.ICCAExportDialog.question6Prompt": {
"message": "Would you like to submit the ICCA as a protected area or an other effective \n area-based conservation measure (OECM)? (For more information on this topic, \n please see the ICCA data manual: https://www.wcmc.io/iccadatamanual)"
},
"renderer.components.MapEditor.ICCAExportDialog.question7Placeholder": {
"description": "Placeholder for question 7",
"message": "Your contact information"
},
"renderer.components.MapEditor.ICCAExportDialog.question7Prompt": {
"message": "Email address where we can contact you. We will contact you \n to confirm we have received your information and to discuss \n the information further where needed. We will also contact you periodically \n to make sure the information is up to date."
},
"renderer.components.MapEditor.ICCAExportDialog.requiredAnswer": {
"description": "Helper texts",
Expand Down
154 changes: 139 additions & 15 deletions src/renderer/components/MapEditor/ICCAExportDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,29 @@ const msgs = defineMessages({
aboutYouSection: 'About you:',
// Question prompts
question1Prompt: `
Has your community or indigenous people collectively consented to the map
Have your community or indigenous people collectively consented to the map
and other information being shared with UNEP-WCMC?`,
question2Prompt: `
Do you want the map and other information to be available for anyone to
view and download?`,
Do you want the map and other information to be available for anyone
to view and download?`,
question3Prompt: `
Name of the community, indigenous people, or individual providing the
information`,
information (Original language, English)`,
question4Prompt: `
If you are an individual, what is your relationship to the indigenous
people or community?`,
question5Prompt: `
Email address, phone number or address where we can contact you. We will
contact you to confirm we have received your information and to discuss
the information further where needed. We will also contact you periodically
Has the ICCA information been reviewed either by a peer-review process
(i.e., by other communities) or by a government body? (For more information on this topic,
please see the ICCA data manual: https://www.wcmc.io/iccadatamanual)`,
question6Prompt: `
Would you like to submit the ICCA as a protected area or an other effective
area-based conservation measure (OECM)? (For more information on this topic,
please see the ICCA data manual: https://www.wcmc.io/iccadatamanual)`,
question7Prompt: `
Email address where we can contact you. We will contact you
to confirm we have received your information and to discuss
the information further where needed. We will also contact you periodically
to make sure the information is up to date.`,
// Yes/no answers
answerYes: 'Yes',
Expand All @@ -69,8 +77,18 @@ const msgs = defineMessages({
'Representative or associate of the community/indigenous people',
question4Answer3: 'Representative of a non-governmental organisation',
question4Answer4: 'Other',
// Placeholder for question 5
question5Placeholder: 'Your contact information',
// Choices for question 5
question5Answer1: 'Yes - peer review',
question5Answer2: 'Yes - government review',
question5Answer3: 'No',
question5Answer4: 'Don’t know',
// Choices for question 6
question6Answer1: 'Yes - as a protected area',
question6Answer2: 'Yes - as an OECM',
question6Answer3: 'No - only as an ICCA',
question6Answer4: 'Don’t know',
// Placeholder for question 7
question7Placeholder: 'Your contact information',
// Helper texts
requiredAnswer: 'This answer is required.',
atLeastOneAnswer: 'Please fill in at least one field.',
Expand Down Expand Up @@ -131,11 +149,15 @@ const EditDialogContent = ({ onClose, onFormError }) => {
const [value3b, setValue3b] = useState('')
const [value4, setValue4] = useState('')
const [value5, setValue5] = useState('')
const [value6, setValue6] = useState('')
const [value7, setValue7] = useState('')
const [value1Error, setValue1Error] = useState(false)
const [value2Error, setValue2Error] = useState(false)
const [value3Error, setValue3Error] = useState(false)
const [value4Error, setValue4Error] = useState(false)
const [value5Error, setValue5Error] = useState(false)
const [value6Error, setValue6Error] = useState(false)
RainbowGiantSquid marked this conversation as resolved.
Show resolved Hide resolved
const [value7Error, setValue7Error] = useState(false)

useEffect(() => {
async function determineDialogState () {
Expand Down Expand Up @@ -179,6 +201,14 @@ const EditDialogContent = ({ onClose, onFormError }) => {
setValue5Error(true)
error = true
}
if (value6 === '') {
setValue6Error(true)
error = true
}
if (value7 === '') {
setValue7Error(true)
error = true
}

// Bail early if there's a required field missing
if (error === true) {
Expand All @@ -198,7 +228,9 @@ const EditDialogContent = ({ onClose, onFormError }) => {
communityOriginalName: value3a,
communityEnglishName: value3b,
relationship: value4,
contact: value5
information: value5,
protected: value6,
contact: value7
}

remote.dialog
Expand Down Expand Up @@ -425,9 +457,101 @@ const EditDialogContent = ({ onClose, onFormError }) => {
<FormLabel component='legend' className={classes.formLabel}>
5. {formatMessage(msgs.question5Prompt)}
</FormLabel>
<TextField
label={formatMessage(msgs.question5Placeholder)}
<RadioGroup
row
aria-label='question5'
name='question5'
value={value5}
onChange={e => {
setValue5(e.target.value)
setValue5Error(false)
}}
>
<FormControlLabel
value='Yes - peer review'
control={<Radio />}
label={formatMessage(msgs.question5Answer1)}
disabled={isSaving}
/>
<FormControlLabel
value='Yes - government review'
control={<Radio />}
label={formatMessage(msgs.question5Answer2)}
disabled={isSaving}
/>
<FormControlLabel
value='No'
control={<Radio />}
label={formatMessage(msgs.question5Answer3)}
disabled={isSaving}
/>
<FormControlLabel
value='Don’t know'
control={<Radio />}
label={formatMessage(msgs.question5Answer4)}
disabled={isSaving}
/>
</RadioGroup>
<FormHelperText>
{value5Error && formatMessage(msgs.requiredAnswer)}
</FormHelperText>
</FormControl>
</Box>

<Box my={1.5}>
<FormControl component='fieldset' error={value6Error}>
<FormLabel component='legend' className={classes.formLabel}>
6. {formatMessage(msgs.question6Prompt)}
</FormLabel>
<RadioGroup
row
aria-label='question6'
name='question6'
value={value6}
onChange={e => {
setValue6(e.target.value)
setValue6Error(false)
}}
>
<FormControlLabel
value='Yes - as a protected area'
control={<Radio />}
label={formatMessage(msgs.question6Answer1)}
disabled={isSaving}
/>
<FormControlLabel
value='Yes - as an OECM'
control={<Radio />}
label={formatMessage(msgs.question6Answer2)}
disabled={isSaving}
/>
<FormControlLabel
value='No - only as an ICCA'
control={<Radio />}
label={formatMessage(msgs.question6Answer3)}
disabled={isSaving}
/>
<FormControlLabel
value='Don’t know'
control={<Radio />}
label={formatMessage(msgs.question6Answer4)}
disabled={isSaving}
/>
</RadioGroup>
<FormHelperText>
{value6Error && formatMessage(msgs.requiredAnswer)}
</FormHelperText>
</FormControl>
</Box>

<Box my={1.5}>
<FormControl component='fieldset' error={value7Error}>
<FormLabel component='legend' className={classes.formLabel}>
7. {formatMessage(msgs.question7Prompt)}
</FormLabel>
<TextField
label={formatMessage(msgs.question7Placeholder)}
value={value7}
fullWidth
rows={3}
rowsMax={6}
Expand All @@ -436,12 +560,12 @@ const EditDialogContent = ({ onClose, onFormError }) => {
disabled={isSaving}
margin='dense'
onChange={e => {
setValue5(e.target.value)
setValue5Error(false)
setValue7(e.target.value)
setValue7Error(false)
}}
/>
<FormHelperText>
{value5Error && formatMessage(msgs.requiredAnswer)}
{value7Error && formatMessage(msgs.requiredAnswer)}
</FormHelperText>
</FormControl>
</Box>
Expand Down