Skip to content

Commit

Permalink
Merge 7abaf1c into e4f24b2
Browse files Browse the repository at this point in the history
  • Loading branch information
MrOrz committed Dec 12, 2021
2 parents e4f24b2 + 7abaf1c commit c17c376
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 99 deletions.
43 changes: 28 additions & 15 deletions components/NewReplySection/ReplyForm/ReasonEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,27 @@ const StickerIcon = props => (

const { BULLETED, NUMBERED } = LIST_STYLES;

/**
* @param {'NOT_ARTICLE' | 'NOT_RUMOR' | 'OPINIONATED' | 'RUMOR'} replyType
* @returns {string}
*/
function getReasonHint(replyType) {
switch (replyType) {
case 'NOT_ARTICLE':
return t`Please briefly explain why this message should not be processed in Cofacts.`;
case 'NOT_RUMOR':
return t`As a brief intro for the references, please point out which part of the message is correct.`;
case 'OPINIONATED':
return t`Please briefly
1. explain which part of the message contains personal opinion
2. remind the audience that this is not factual`;
case 'RUMOR':
return t`As a brief intro for the references, please point out which part of the message is incorrect.`;
default:
return '';
}
}

const ReasonEditor = ({
value,
onSuggestionAdd,
Expand Down Expand Up @@ -220,6 +241,12 @@ const ReasonEditor = ({
setSearch('');
};

const multipleReplyHint =
existingReplyIds.length === 0
? ''
: '\n\n' +
t`Note: This is not a comment section! Please write your reply in response to the reported message above, NOT to other editors' replies below. Please use the thumb-down button below each reply if you find it not good enough.`;

return (
<div className={classes.editor}>
{showHelp && (
Expand Down Expand Up @@ -257,21 +284,7 @@ const ReasonEditor = ({
required
className={classes.inputArea}
ref={editorRef}
placeholder={(() => {
if (replyType === 'NOT_ARTICLE') {
return t`Please briefly explain why this message should not be processed in Cofacts.`;
} else if (replyType === 'NOT_RUMOR') {
return t`As a brief intro for the references, please point out which part of the message is correct.`;
} else if (replyType === 'OPINIONATED') {
return t`Please briefly
1. explain which part of the message contains personal opinion
2. remind the audience that this is not factual`;
} else if (replyType === 'RUMOR') {
return t`As a brief intro for the references, please point out which part of the message is incorrect.`;
} else {
return '';
}
})()}
placeholder={getReasonHint(replyType) + multipleReplyHint}
onChange={handleChange}
onKeyDown={handleKeyPress}
value={value}
Expand Down
Loading

0 comments on commit c17c376

Please sign in to comment.