Format report prompts without using FormattedHTMLMessage

This commit is contained in:
seotts 2020-04-01 15:49:53 -04:00
parent ab71f6020a
commit ccb5fa444c
4 changed files with 196 additions and 175 deletions

View file

@ -15,7 +15,7 @@ const TextArea = require('../../forms/textarea.jsx');
const previewActions = require('../../../redux/preview.js'); const previewActions = require('../../../redux/preview.js');
const Progression = require('../../progression/progression.jsx'); const Progression = require('../../progression/progression.jsx');
const FormStep = require('./form-step.jsx'); const FormStep = require('./form-step.jsx');
const {reportOptionsShape, REPORT_OPTIONS} = require('./report-options.js'); const {reportOptionsShape, REPORT_OPTIONS} = require('./report-options.jsx');
require('../../forms/button.scss'); require('../../forms/button.scss');
require('./modal.scss'); require('./modal.scss');
@ -163,7 +163,7 @@ class ReportModal extends React.Component {
<div className="instructions-header"> <div className="instructions-header">
<FormattedMessage {...category.label} /> <FormattedMessage {...category.label} />
</div> </div>
<FormattedHTMLMessage {...category.prompt} /> {category.prompt}
</div> </div>
<Select <Select
required required
@ -191,7 +191,7 @@ class ReportModal extends React.Component {
<div className="instructions-header"> <div className="instructions-header">
<FormattedMessage {...finalCategory.label} /> <FormattedMessage {...finalCategory.label} />
</div> </div>
<FormattedHTMLMessage {...finalCategory.prompt} /> {finalCategory.prompt}
</div> </div>
<TextArea <TextArea
autoFocus autoFocus
@ -236,19 +236,7 @@ class ReportModal extends React.Component {
<div className="instructions-header"> <div className="instructions-header">
<FormattedMessage {...finalCategory.label} /> <FormattedMessage {...finalCategory.label} />
</div> </div>
<p> {finalCategory.prompt}
<FormattedMessage {...finalCategory.prompt} />
</p>
{finalCategory.prompt2 && (
<p>
<FormattedMessage {...finalCategory.prompt2} />
</p>
)}
{promptList && (
<ul>
{promptList}
</ul>
)}
</div> </div>
</FormStep> </FormStep>
</Progression> </Progression>

View file

@ -1,152 +0,0 @@
const PropTypes = require('prop-types');
const {
arrayOf,
string,
shape,
bool
} = PropTypes;
/**
* Define both the PropType shape and default value for report options
* to ensure structure is validated by PropType checking going forward.
*/
const messageShape = shape({
id: string.isRequired
});
const subcategoryShape = shape({
value: string.isRequired,
label: messageShape.isRequired,
prompt: messageShape.isRequired,
prompt2: messageShape,
list: arrayOf(messageShape),
preventSubmission: bool
});
const categoryShape = shape({
value: string.isRequired,
label: messageShape.isRequired,
prompt: messageShape.isRequired,
subcategories: arrayOf(subcategoryShape)
});
const reportOptionsShape = arrayOf(categoryShape);
const REPORT_OPTIONS = [
{
value: '',
label: {id: 'report.reasonPlaceHolder'},
prompt: {id: 'report.promptPlaceholder'}
},
{
value: '0',
label: {id: 'report.reasonCopy'},
prompt: {id: 'report.promptCopy'}
},
{
value: '1',
label: {id: 'report.reasonUncredited'},
prompt: {id: 'report.promptUncredited'}
},
{
value: '2',
label: {id: 'report.reasonScary'},
prompt: {id: 'report.promptScary'}
},
{
value: '3',
label: {id: 'report.reasonLanguage'},
prompt: {id: 'report.promptLanguage'}
},
{
value: '4',
label: {id: 'report.reasonMusic'},
prompt: {id: 'report.promptMusic'}
},
{
value: '8',
label: {id: 'report.reasonImage'},
prompt: {id: 'report.promptImage'}
},
{
value: '5',
label: {id: 'report.reasonPersonal'},
prompt: {id: 'report.promptPersonal'}
},
{
value: '6',
label: {id: 'general.other'},
prompt: {id: 'report.promptGuidelines'},
subcategories: [
{
value: '',
label: {id: 'report.reasonPlaceHolder'},
prompt: {id: 'report.promptPlaceholder'}
},
{
value: 'report.reasonDontLikeIt',
label: {id: 'report.reasonDontLikeIt'},
prompt: {id: 'report.promptDontLikeIt'},
prompt2: {id: 'report.promptDontLikeIt'},
list: [
{id: 'report.itemSupportive'},
{id: 'report.itemConstructive'},
{id: 'report.itemSpecific'}
],
preventSubmission: true
},
{
value: 'report.reasonDoesntWork',
label: {id: 'report.reasonDoesntWork'},
prompt: {id: 'report.promptDoesntWork'},
preventSubmission: true
},
{
value: 'report.reasonCouldImprove',
label: {id: 'report.reasonCouldImprove'},
prompt: {id: 'report.promptCouldImprove'},
preventSubmission: true
},
{
value: 'report.reasonTooHard',
label: {id: 'report.reasonTooHard'},
prompt: {id: 'report.promptTooHard'},
preventSubmission: true
},
{
value: '9',
label: {id: 'report.reasonMisleading'},
prompt: {id: 'report.promptMisleading'}
},
{
value: '10',
label: {id: 'report.reasonFaceReveal'},
prompt: {id: 'report.promptFaceReveal'}
},
{
value: '11',
label: {id: 'report.reasonNoRemixingAllowed'},
prompt: {id: 'report.promptNoRemixingAllowed'}
},
{
value: '12',
label: {id: 'report.reasonCreatorsSafety'},
prompt: {id: 'report.promptCreatorsSafety'}
},
{
value: '13',
label: {id: 'report.reasonSomethingElse'},
prompt: {id: 'report.promptSomethingElse'}
}
]
}
];
module.exports = {
reportOptionsShape,
REPORT_OPTIONS
};

View file

@ -0,0 +1,184 @@
const React = require('react');
const FormattedMessage = require('react-intl').FormattedMessage;
const PropTypes = require('prop-types');
const {
arrayOf,
node,
string,
shape,
bool
} = PropTypes;
/**
* Define both the PropType shape and default value for report options
* to ensure structure is validated by PropType checking going forward.
*/
const messageShape = shape({
id: string.isRequired
});
const subcategoryShape = shape({
value: string.isRequired,
label: messageShape.isRequired,
prompt: node.isRequired,
preventSubmission: bool
});
const categoryShape = shape({
value: string.isRequired,
label: messageShape.isRequired,
prompt: node.isRequired,
subcategories: arrayOf(subcategoryShape)
});
const reportOptionsShape = arrayOf(categoryShape);
const REPORT_OPTIONS = [
{
value: '',
label: {id: 'report.reasonPlaceHolder'},
prompt: <FormattedMessage id="report.promptPlaceholder" />
},
{
value: '0',
label: {id: 'report.reasonCopy'},
prompt: <FormattedMessage id="report.promptCopy" />
},
{
value: '1',
label: {id: 'report.reasonUncredited'},
prompt: <FormattedMessage id="report.promptUncredited" />
},
{
value: '2',
label: {id: 'report.reasonScary'},
prompt: <FormattedMessage id="report.promptScary" />
},
{
value: '3',
label: {id: 'report.reasonLanguage'},
prompt: <FormattedMessage id="report.promptLanguage" />
},
{
value: '4',
label: {id: 'report.reasonMusic'},
prompt: <FormattedMessage id="report.promptMusic" />
},
{
value: '8',
label: {id: 'report.reasonImage'},
prompt: <FormattedMessage id="report.promptImage" />
},
{
value: '5',
label: {id: 'report.reasonPersonal'},
prompt: <FormattedMessage id="report.promptPersonal" />
},
{
value: '6',
label: {id: 'general.other'},
prompt: <FormattedMessage id="report.promptGuidelines" />,
subcategories: [
{
value: '',
label: {id: 'report.reasonPlaceHolder'},
prompt: <FormattedMessage id="report.promptPlaceholder" />
},
{
value: 'report.reasonDontLikeIt',
label: {id: 'report.reasonDontLikeIt'},
prompt: (
<div>
<p><FormattedMessage id="report.promptDontLikeIt" /></p>
<p><FormattedMessage id="report.promptTips" /></p>
<ul>
<li><FormattedMessage id="report.tipsSupportive" /></li>
<li><FormattedMessage id="report.tipsConstructive" /></li>
<li><FormattedMessage id="report.tipsSpecific" /></li>
</ul>
</div>
),
preventSubmission: true
},
{
value: 'report.reasonDoesntWork',
label: {id: 'report.reasonDoesntWork'},
prompt: (
<div>
<p><FormattedMessage id="report.promptDoesntWork" /></p>
<p><FormattedMessage id="report.promptDoesntWorkTips" /></p>
</div>
),
preventSubmission: true
},
{
value: 'report.reasonCouldImprove',
label: {id: 'report.reasonCouldImprove'},
prompt: (
<div>
<p><FormattedMessage id="report.promptDontLikeIt" /></p>
<p><FormattedMessage id="report.promptTips" /></p>
<ul>
<li><FormattedMessage id="report.tipsSupportive" /></li>
<li><FormattedMessage id="report.tipsConstructive" /></li>
<li><FormattedMessage id="report.tipsSpecific" /></li>
</ul>
</div>
),
preventSubmission: true
},
{
value: 'report.reasonTooHard',
label: {id: 'report.reasonTooHard'},
prompt: <FormattedMessage id="report.promptTooHard" />,
preventSubmission: true
},
{
value: '9',
label: {id: 'report.reasonMisleading'},
prompt: <FormattedMessage id="report.promptMisleading" />
},
{
value: '10',
label: {id: 'report.reasonFaceReveal'},
prompt: <FormattedMessage id="report.promptFaceReveal" />
},
{
value: '11',
label: {id: 'report.reasonNoRemixingAllowed'},
prompt: <FormattedMessage id="report.promptNoRemixingAllowed" />
},
{
value: '12',
label: {id: 'report.reasonCreatorsSafety'},
prompt: <FormattedMessage id="report.promptCreatorsSafety" />
},
{
value: '13',
label: {id: 'report.reasonSomethingElse'},
prompt: (
<FormattedMessage
id={`report.promptSomethingElse`}
values={{
CommunityGuidelinesLink: (
<a href="/community_guidelines">
<FormattedMessage id="report.CommunityGuidelinesLinkText" />
</a>
)
}}
/>
)
}
]
}
];
module.exports = {
reportOptionsShape,
REPORT_OPTIONS
};

View file

@ -279,18 +279,19 @@
"report.promptGuidelines": "Please be specific about why this project does not follow our Community Guidelines", "report.promptGuidelines": "Please be specific about why this project does not follow our Community Guidelines",
"report.promptImage": "Please say the name of the sprite or the backdrop with the inappropriate image", "report.promptImage": "Please say the name of the sprite or the backdrop with the inappropriate image",
"report.promptDontLikeIt": "Scratch projects are made by people of all ages and levels of experience. If you don't like this project because you feel it can be improved upon, we encourage you to share constructive feedback directly with the creator.", "report.promptDontLikeIt": "Scratch projects are made by people of all ages and levels of experience. If you don't like this project because you feel it can be improved upon, we encourage you to share constructive feedback directly with the creator.",
"report.prompt2DontLikeIt": "Here are tips on sharing constructive feedback:", "report.promptTips": "Here are tips on sharing constructive feedback:",
"report.itemSupportive": "Be supportive and encouraging.", "report.tipsSupportive": "Be supportive and encouraging.",
"report.itemConstructive": "Leave a comment telling them what you like, but also what they could do to make the project better.", "report.tipsConstructive": "Leave a comment telling them what you like, but also what they could do to make the project better.",
"report.itemSpecific": "Try to be specific with your feedback. For instance: The controls to move the character did not work.", "report.tipsSpecific": "Try to be specific with your feedback. For instance: The controls to move the character did not work.",
"report.promptDoesntWork": "<p>A Scratch project, like any other application, may contain a few bugs. That is expected and completely okay!</p> <p>We encourage you to share any issues you discover directly with the creator of the project. It's also helpful to provide suggestions on how they may improve their project, if possible.</p>", "report.promptDoesntWork": "A Scratch project, like any other application, may contain a few bugs. That is expected and completely okay!",
"report.promptCouldImprove": "Scratch projects are made by people of all ages and levels of experience. If you don't like this project because you feel it can be improved upon, we encourage you to share constructive feedback directly with the creator.<br />Here are tips on sharing constructive feedback: <ul><li>Be supportive and encouraging.</li><li>Leave a comment telling them what you like, but also what they could do to make the project better.</li><li>Try to be specific with your feedback. For instance: The controls to move the character did not work.</li>", "report.promptDoesntWorkTips": "We encourage you to share any issues you discover directly with the creator of the project. It's also helpful to provide suggestions on how they may improve their project, if possible.",
"report.promptCouldImprove": "Scratch projects are made by people of all ages and levels of experience. If you don't like this project because you feel it can be improved upon, we encourage you to share constructive feedback directly with the creator.",
"report.promptTooHard": "If you feel a project could be easier, we encourage you to share that feedback directly with the creator of the project. Or remix it yourself and make it as easy or hard as you like!", "report.promptTooHard": "If you feel a project could be easier, we encourage you to share that feedback directly with the creator of the project. Or remix it yourself and make it as easy or hard as you like!",
"report.promptMisleading": "Tell us more about how it's tricking or misleading people", "report.promptMisleading": "Tell us more about how it's tricking or misleading people",
"report.promptFaceReveal": "Scratch allows people to use pictures of their face in creative projects like games, stories, or animations. However, projects that are just a picture of their face, or which focus entirely on their physical appearance, aren't allowed on Scratch. If this is a 'face reveal', or the project focuses on the person's appearance, please click report.", "report.promptFaceReveal": "Scratch allows people to use pictures of their face in creative projects like games, stories, or animations. However, projects that are just a picture of their face, or which focus entirely on their physical appearance, aren't allowed on Scratch. If this is a 'face reveal', or the project focuses on the person's appearance, please click report.",
"report.promptNoRemixingAllowed": "Please let us know where the project says it is not okay to remix — such as in the Notes & Credits, project title, etc. ", "report.promptNoRemixingAllowed": "Please let us know where the project says it is not okay to remix — such as in the Notes & Credits, project title, etc. ",
"report.promptCreatorsSafety": "It's important that everyone on Scratch remains safe online and in real life. Please let us know why you are worried about the safety of this user.", "report.promptCreatorsSafety": "It's important that everyone on Scratch remains safe online and in real life. Please let us know why you are worried about the safety of this user.",
"report.promptSomethingElse": "We encourage you to double check if your report fits any of the other available categories. If you strongly feel it does not, please explain why this project breaks the Community Guidelines.", "report.promptSomethingElse": "We encourage you to double check if your report fits any of the other available categories. If you strongly feel it does not, please explain why this project breaks the {communityGuidelinesLink}.",
"report.tooLongError": "That's too long! Please find a way to shorten your text.", "report.tooLongError": "That's too long! Please find a way to shorten your text.",
"report.tooShortError": "That's too short. Please describe in detail what's inappropriate or disrespectful about the project.", "report.tooShortError": "That's too short. Please describe in detail what's inappropriate or disrespectful about the project.",
"report.send": "Send", "report.send": "Send",