From 313ab64831afee7c5f7241003b1abbe4ce14bdaf Mon Sep 17 00:00:00 2001 From: Martin Krulis Date: Tue, 12 Jul 2022 13:54:24 +0200 Subject: [PATCH] Adjusting labels and icons for comment threads. --- .../AssignmentsTable/AssignmentsTable.js | 6 +++ .../ReferenceSolutionDetail.js | 10 ++++- .../SolutionDetail/SolutionDetail.js | 10 ++++- .../EditAssignmentForm/EditAssignmentForm.js | 4 +- .../EditExerciseForm/EditExerciseForm.js | 4 +- .../widgets/Comments/AddComment/AddComment.js | 39 ++++++++++--------- .../widgets/Comments/Comment/Comment.js | 24 ++++++++---- .../Comments/CommentThread/CommentThread.js | 7 +++- src/components/widgets/Comments/comments.less | 4 ++ .../CommentThreadContainer.js | 3 ++ src/locales/cs.json | 11 ++++-- src/locales/en.json | 13 ++++--- src/pages/Assignment/Assignment.js | 6 +++ src/pages/AssignmentStats/AssignmentStats.js | 6 +++ 14 files changed, 104 insertions(+), 43 deletions(-) diff --git a/src/components/Assignments/Assignment/AssignmentsTable/AssignmentsTable.js b/src/components/Assignments/Assignment/AssignmentsTable/AssignmentsTable.js index f2e83e3fd..9e4d44451 100644 --- a/src/components/Assignments/Assignment/AssignmentsTable/AssignmentsTable.js +++ b/src/components/Assignments/Assignment/AssignmentsTable/AssignmentsTable.js @@ -205,6 +205,12 @@ class AssignmentsTable extends Component { /> } + additionalPublicSwitchNote={ + + } inModal /> )} diff --git a/src/components/ReferenceSolutions/ReferenceSolutionDetail/ReferenceSolutionDetail.js b/src/components/ReferenceSolutions/ReferenceSolutionDetail/ReferenceSolutionDetail.js index f8054462d..b1d8550f7 100644 --- a/src/components/ReferenceSolutions/ReferenceSolutionDetail/ReferenceSolutionDetail.js +++ b/src/components/ReferenceSolutions/ReferenceSolutionDetail/ReferenceSolutionDetail.js @@ -114,7 +114,15 @@ class ReferenceSolutionDetail extends Component { download={download} /> - + + } + /> {evaluations && ( diff --git a/src/components/Solutions/SolutionDetail/SolutionDetail.js b/src/components/Solutions/SolutionDetail/SolutionDetail.js index 8359e66b3..a1919fb58 100644 --- a/src/components/Solutions/SolutionDetail/SolutionDetail.js +++ b/src/components/Solutions/SolutionDetail/SolutionDetail.js @@ -254,7 +254,15 @@ class SolutionDetail extends Component { /> )} - + + } + /> {evaluations && ( diff --git a/src/components/forms/EditAssignmentForm/EditAssignmentForm.js b/src/components/forms/EditAssignmentForm/EditAssignmentForm.js index 350ce194c..ab9022bc4 100644 --- a/src/components/forms/EditAssignmentForm/EditAssignmentForm.js +++ b/src/components/forms/EditAssignmentForm/EditAssignmentForm.js @@ -577,7 +577,7 @@ class EditAssignmentForm extends Component { - + - {isPrivate ? : } + {isPrivate ? : } - {isPrivate && ( - {text}, - }} - /> - )} - {!isPrivate && ( - {text}, - }} - /> - )} + + + {isPrivate && ( + + )} + {!isPrivate && ( + + )} + + + {!isPrivate && additionalPublicSwitchNote && <> {additionalPublicSwitchNote}} @@ -135,6 +135,7 @@ class AddComment extends Component { AddComment.propTypes = { addComment: PropTypes.func, + additionalPublicSwitchNote: PropTypes.oneOfType([PropTypes.string, PropTypes.element]), intl: PropTypes.object.isRequired, }; diff --git a/src/components/widgets/Comments/Comment/Comment.js b/src/components/widgets/Comments/Comment/Comment.js index 58afaee09..ccd2ec80a 100644 --- a/src/components/widgets/Comments/Comment/Comment.js +++ b/src/components/widgets/Comments/Comment/Comment.js @@ -26,6 +26,7 @@ const Comment = ({ isToggling = false, togglePrivacy, deleteComment, + additionalPublicSwitchNote = null, links: { USER_URI_FACTORY }, }) => (
deleteComment(id)} - timid /> )} {isFromCurrentUser && togglePrivacy && ( @@ -77,19 +77,26 @@ const Comment = ({ defaultMessage="Only you can see this comment" /> ) : ( - + <> + + {additionalPublicSwitchNote && <> {additionalPublicSwitchNote}} + )} }> togglePrivacy(id)} - className={classnames({ 'float-right': true, [styles.iconButton]: true, [styles.iconButtonLock]: true })} + className={classnames({ + 'float-right': true, + [styles.iconButton]: true, + [styles.iconButtonLock]: !isPrivate, + [styles.iconButtonUnlock]: isPrivate, + })} spin={isToggling} - timid /> )} @@ -122,6 +129,7 @@ Comment.propTypes = { isToggling: PropTypes.bool, togglePrivacy: PropTypes.func, deleteComment: PropTypes.func, + additionalPublicSwitchNote: PropTypes.oneOfType([PropTypes.string, PropTypes.element]), links: PropTypes.object, }; diff --git a/src/components/widgets/Comments/CommentThread/CommentThread.js b/src/components/widgets/Comments/CommentThread/CommentThread.js index 03ba90412..86d207a3a 100644 --- a/src/components/widgets/Comments/CommentThread/CommentThread.js +++ b/src/components/widgets/Comments/CommentThread/CommentThread.js @@ -9,6 +9,7 @@ import { RefreshIcon } from '../../../icons'; const CommentThread = ({ title = , + additionalPublicSwitchNote = null, comments = [], currentUserId, addComment, @@ -21,7 +22,9 @@ const CommentThread = ({ } + footer={ + addComment && + } inModal={inModal}>
{comments.map((comment, i) => @@ -32,6 +35,7 @@ const CommentThread = ({ repost={repostComment} togglePrivacy={togglePrivacy} deleteComment={deleteComment} + additionalPublicSwitchNote={additionalPublicSwitchNote} /> ) : ( @@ -64,6 +68,7 @@ const CommentThread = ({ CommentThread.propTypes = { title: PropTypes.oneOfType([PropTypes.element, PropTypes.string]), + additionalPublicSwitchNote: PropTypes.oneOfType([PropTypes.string, PropTypes.element]), comments: PropTypes.array, currentUserId: PropTypes.string.isRequired, addComment: PropTypes.func, diff --git a/src/components/widgets/Comments/comments.less b/src/components/widgets/Comments/comments.less index 6a66aa142..b170f0182 100644 --- a/src/components/widgets/Comments/comments.less +++ b/src/components/widgets/Comments/comments.less @@ -10,6 +10,10 @@ color: #ff6; } +.iconButtonUnlock { + color: #28a745; +} + .iconButtonDelete { color: #f88; } diff --git a/src/containers/CommentThreadContainer/CommentThreadContainer.js b/src/containers/CommentThreadContainer/CommentThreadContainer.js index 8b2cb93b5..f917fdbdf 100644 --- a/src/containers/CommentThreadContainer/CommentThreadContainer.js +++ b/src/containers/CommentThreadContainer/CommentThreadContainer.js @@ -38,6 +38,7 @@ class CommentThreadContainer extends Component { render() { const { title = , + additionalPublicSwitchNote = null, thread, user, addComment, @@ -53,6 +54,7 @@ class CommentThreadContainer extends Component { {(thread, user) => ( a.postedAt - b.postedAt)} currentUserId={user.id} addComment={(text, isPrivate) => addComment(user, text, isPrivate)} @@ -71,6 +73,7 @@ class CommentThreadContainer extends Component { CommentThreadContainer.propTypes = { threadId: PropTypes.string.isRequired, title: PropTypes.oneOfType([PropTypes.element, PropTypes.string]), + additionalPublicSwitchNote: PropTypes.oneOfType([PropTypes.string, PropTypes.element]), inModal: PropTypes.bool, thread: PropTypes.object, user: PropTypes.object, diff --git a/src/locales/cs.json b/src/locales/cs.json index e574eae48..2960e8544 100644 --- a/src/locales/cs.json +++ b/src/locales/cs.json @@ -138,6 +138,7 @@ "app.assignmentStats.onlyBestSolutionsCheckbox": "Pouze nejlepší řešení", "app.assignmentStats.title": "Všechna řešení zadané úlohy", "app.assignments.deadline": "Termín odevzdání", + "app.assignments.discussionModal.additionalSwitchNote": "(vedoucí a studenti této skupiny)", "app.assignments.discussionModalTitle": "Veřejná diskuse", "app.assignments.group": "Zadáno ve skupině", "app.assignments.hidePastAssignments": "Celkem {count} {count, plural, one {zadaná úloha má} =2 {zadané úlohy mají} =3 {zadané úlohy mají} =4 {zadané úlohy mají} other {zadaných úloh má}} termín v minulosti. Skrýt staré úlohy.", @@ -198,15 +199,15 @@ "app.changePasswordForm.validation.passwordsDontMatch": "Hesla se neshodují.", "app.comments.addComment": "Odeslat", "app.comments.commentPlaceholder": "Váš komentář...", - "app.comments.everyoneCanSeeThisComment": "Tento komentář je veřejný.", + "app.comments.everyoneCanSeeThisComment": "Tento komentář vidí všichni uživatelé, kteří vidí toto vlákno.", "app.comments.loadingCommentThread": "Načítají se komentáře...", "app.comments.noCommentsYet": "V tomto vláknu zatím nejsou žádné komentáře.", - "app.comments.onlyYouCanSeeThisComment": "Pouze vy vidíte tento komentář.", + "app.comments.onlyYouCanSeeThisComment": "Tento komentář vidíte pouze vy.", "app.comments.publishing": "Publikuji...", "app.comments.publishingFailed": "Zveřejnění selhalo", "app.comments.title": "Komentáře a poznámky", - "app.comments.warnings.isPrivate": "Tento komentář uvidíte pouze vy - nebude veřejný.", - "app.comments.warnings.isPublic": "Tento komentář bude veřejný.", + "app.comments.warnings.isPrivate": "Tento komentář bude soukromý, takže jej uvidíte pouze vy.", + "app.comments.warnings.isPublic": "Tento komentář bude veřejný, takže jej uvidí každý, kdo může číst toto vlákno.", "app.confirm.no": "Ne", "app.confirm.yes": "Ano", "app.createExerciseForm.selectGroupFirst": "... nejprve vyberte domovskou skupinu ...", @@ -1311,6 +1312,7 @@ "app.referenceSolution.exerciseBroken": "Úloha je rozbitá, a proto není v tuto chvíli možné nechat toto vzorové řešení znovu vyhodnotit.", "app.referenceSolution.exerciseNoLongerHasEnvironment": "Úloha již nepodporuje běhové prostředí, pod kterým bylo toto řešení odevzdáno. Řešení není možné znovu vyhodnotit.", "app.referenceSolution.title": "Podrobnosti referenčního řešení", + "app.referenceSolutionDetail.comments.additionalSwitchNote": "(učitelé, kteří smí vidět toto referenční řešení)", "app.referenceSolutionDetail.exercise": "Úloha", "app.referenceSolutionDetail.title.details": "Detail referenčního řešení", "app.referenceSolutionTable.evaluationFailed": "Poslední vyhodnocení selhalo", @@ -1572,6 +1574,7 @@ "app.solution.submittedBeforeSecondDeadline": "Řešení bylo odevzdáno po prvním termínu, ale stále ještě před druhým termínem", "app.solution.title": "Řešení", "app.solutionArchiveInfoBox.description": "Všechny soubory v ZIPu", + "app.solutionDetail.comments.additionalSwitchNote": "(autor tohoto řešení a vedoucí této skupiny)", "app.solutionFiles.countLimitExceeded": "Celkový počet souborů řešení překročil výchozí limit ({limit}).", "app.solutionFiles.downloadButton": "Stáhnout soubor", "app.solutionFiles.entryPoint": "Vstupní bod (zaváděcí soubor aplikace)", diff --git a/src/locales/en.json b/src/locales/en.json index 46ac8d7a3..f4796f0db 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -138,6 +138,7 @@ "app.assignmentStats.onlyBestSolutionsCheckbox": "Best solutions only", "app.assignmentStats.title": "All Submissions of The Assignment", "app.assignments.deadline": "Deadline", + "app.assignments.discussionModal.additionalSwitchNote": "(supervisors and students of this group)", "app.assignments.discussionModalTitle": "Public Discussion", "app.assignments.group": "Assigned in group", "app.assignments.hidePastAssignments": "Total {count} {count, plural, one {assignment} other {assignments}} {count, plural, one {is past its} other {are past their}} deadline. Hide old assignments.", @@ -198,15 +199,15 @@ "app.changePasswordForm.validation.passwordsDontMatch": "Passwords do not match.", "app.comments.addComment": "Send", "app.comments.commentPlaceholder": "Your comment...", - "app.comments.everyoneCanSeeThisComment": "This comment is visible to everyone.", + "app.comments.everyoneCanSeeThisComment": "This comment is visible to everyone who can see this thread.", "app.comments.loadingCommentThread": "Loading comments...", "app.comments.noCommentsYet": "There are no comments in this thread yet.", "app.comments.onlyYouCanSeeThisComment": "Only you can see this comment", "app.comments.publishing": "Publishing...", "app.comments.publishingFailed": "Publishing Failed", "app.comments.title": "Comments and Notes", - "app.comments.warnings.isPrivate": "Only you will see this comment.", - "app.comments.warnings.isPublic": "Everyone on this page will see this comment.", + "app.comments.warnings.isPrivate": "This will be a private comment visible only to you.", + "app.comments.warnings.isPublic": "This will be a public comment visible to everyone who can see this thread.", "app.confirm.no": "No", "app.confirm.yes": "Yes", "app.createExerciseForm.selectGroupFirst": "... select group of residence first ...", @@ -383,8 +384,8 @@ "app.editExerciseForm.isPublic": "Exercise is public", "app.editExerciseForm.medium": "Medium", "app.editExerciseForm.mergeJudgeLogs": "Merge judge logs in one", - "app.editExerciseForm.solutionFilesLimit": "Soluition files limit:", - "app.editExerciseForm.solutionSizeLimit": "Soluition total size [KiB] limit:", + "app.editExerciseForm.solutionFilesLimit": "Solution files limit:", + "app.editExerciseForm.solutionSizeLimit": "Solution total size [KiB] limit:", "app.editExerciseForm.title": "Edit exercise {name}", "app.editExerciseForm.validation.difficulty": "Please select the difficulty of the exercise.", "app.editExerciseForm.validation.emptyName": "Please fill the name of the exercise.", @@ -1311,6 +1312,7 @@ "app.referenceSolution.exerciseBroken": "The exercise is broken. This reference solution may not be resubmitted at the moment.", "app.referenceSolution.exerciseNoLongerHasEnvironment": "The exercise no longer supports the environment for which this solution was evaluated. Resubmission is not possible.", "app.referenceSolution.title": "Reference Solution Detail", + "app.referenceSolutionDetail.comments.additionalSwitchNote": "(teachers who can see this reference solution)", "app.referenceSolutionDetail.exercise": "Exercise", "app.referenceSolutionDetail.title.details": "Reference Solution Detail", "app.referenceSolutionTable.evaluationFailed": "Last evaluation failed", @@ -1572,6 +1574,7 @@ "app.solution.submittedBeforeSecondDeadline": "The solution was submitted after the first but still before the second deadline", "app.solution.title": "The Solution", "app.solutionArchiveInfoBox.description": "All files in a ZIP archive", + "app.solutionDetail.comments.additionalSwitchNote": "(author of the solution and supervisors of this group)", "app.solutionFiles.countLimitExceeded": "The total number of submitted files exceeds the default solution files limit ({limit}).", "app.solutionFiles.downloadButton": "Download file", "app.solutionFiles.entryPoint": "Execution entry point (bootstrap)", diff --git a/src/pages/Assignment/Assignment.js b/src/pages/Assignment/Assignment.js index b7e247f2d..10c797c7d 100644 --- a/src/pages/Assignment/Assignment.js +++ b/src/pages/Assignment/Assignment.js @@ -216,6 +216,12 @@ class Assignment extends Component { defaultMessage="Public Discussion" /> } + additionalPublicSwitchNote={ + + } /> diff --git a/src/pages/AssignmentStats/AssignmentStats.js b/src/pages/AssignmentStats/AssignmentStats.js index 046e88de1..399758bce 100644 --- a/src/pages/AssignmentStats/AssignmentStats.js +++ b/src/pages/AssignmentStats/AssignmentStats.js @@ -355,6 +355,12 @@ class AssignmentStats extends Component { : } + additionalPublicSwitchNote={ + + } inModal />