Path: blob/master/src/packages/frontend/course/common/course-step-messages.tsx
10799 views
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import type { IntlShape } from "react-intl";67import { unreachable } from "@cocalc/util/misc";89import type { AssignmentStep, CopyStep } from "../types";1011export function actionsLegend(intl: IntlShape): string {12return intl.formatMessage({13id: "course.student-assignment-info-header.actions_legend",14defaultMessage: "Actions",15description:16"Section title in the column info popover for explaining action icons",17});18}1920export function columnInfoAria(intl: IntlShape, title: string): string {21return intl.formatMessage(22{23id: "course.student-assignment-info-header.column_info.aria_label",24defaultMessage: "Column info: {title}",25description:26"Aria label for the info popover trigger button in a course workflow column header",27},28{ title },29);30}3132const runAllDescription =33"Legend text in the column info popover: run this workflow step for all eligible students";34const runOneDescription =35"Legend text in the column info popover: run this workflow step for one student";36const redoOneDescription =37"Legend text in the column info popover: run this workflow step again for one student";38const openOneDescription =39"Legend text in the column info popover: open this student's files for this workflow step";40const skipInfoDescription =41"Legend text in the column info popover: allow skipping this workflow step for run-all flow";42const editOneDescription =43"Legend text in the column info popover: edit grade and comments for one student";44const infoTitleDescription = "Title of a column info popover";4546export function columnLabel(intl: IntlShape, key: AssignmentStep): string {47switch (key) {48case "assignment":49return intl.formatMessage({50id: "course.student-assignment-info-header.assign.label",51defaultMessage: "Assign",52description:53"Column title in course workflow table. Use a short verb meaning 'assign to students'. Prefer verb/action wording, not a noun.",54});55case "distribution":56return intl.formatMessage({57id: "course.handouts.distribute.label",58defaultMessage: "Distribute",59description:60"Column title in handout workflow table. Use a short verb meaning 'distribute handout to students'. Prefer verb/action wording, not a noun.",61});62case "collect":63return intl.formatMessage({64id: "course.student-assignment-info-header.collect.label",65defaultMessage: "Collect",66description:67"Column title in course workflow table. Use a short verb meaning 'collect student work'. Prefer verb/action wording, not a noun.",68});69case "grade":70return intl.formatMessage({71id: "course.student-assignment-info-header.grade.label",72defaultMessage: "Grade",73description:74"Column title in course workflow table. Use a short verb meaning 'grade submissions'. Prefer verb/action wording, not a noun.",75});76case "peer_assignment":77return intl.formatMessage({78id: "course.student-assignment-info-header.peer_assignment.label",79defaultMessage: "Peer Assign",80description:81"Column title in peer-grading workflow. Use a short verb phrase meaning 'assign for peer grading'. Prefer verb/action wording, not a noun.",82});83case "peer_collect":84return intl.formatMessage({85id: "course.student-assignment-info-header.peer_collect.label",86defaultMessage: "Peer Collect",87description:88"Column title in peer-grading workflow. Use a short verb phrase meaning 'collect peer feedback'. Prefer verb/action wording, not a noun.",89});90case "return_graded":91return intl.formatMessage({92id: "course.student-assignment-info-header.return.label",93defaultMessage: "Return",94description:95"Column title in course workflow table. Use a short verb meaning 'return graded work to students'. Prefer verb/action wording, not a noun.",96});97default:98unreachable(key);99return "";100}101}102103export function copyStepMsg(intl: IntlShape, key: CopyStep) {104switch (key) {105case "assignment":106return {107title: intl.formatMessage({108id: "course.student-assignment-info-header.assign.info_title",109defaultMessage: "Assign: From Instructor to Students",110description: infoTitleDescription,111}),112tip: intl.formatMessage({113id: "course.student-assignment-info-header.assign.tooltip",114defaultMessage:115"Copy all assignment files from your project to each student's project, creating independent copies.",116}),117actions: actionsLegend(intl),118runAll: intl.formatMessage({119id: "course.student-assignment-info-header.assign.run_all",120defaultMessage: "Assign to all students",121description: runAllDescription,122}),123skipInfo: intl.formatMessage({124id: "course.student-assignment-info-header.assign.skip_info",125defaultMessage: "Allow proceeding without assigning",126description: skipInfoDescription,127}),128runOne: intl.formatMessage({129id: "course.student-assignment-info-header.assign.run_one",130defaultMessage: "Assign to this student",131description: runOneDescription,132}),133redoOne: intl.formatMessage({134id: "course.student-assignment-info-header.assign.redo_one",135defaultMessage: "Assign again to this student",136description: redoOneDescription,137}),138openOne: intl.formatMessage({139id: "course.student-assignment-info-header.assign.open_one",140defaultMessage: "Open the student's copy in the student's project",141description: openOneDescription,142}),143};144case "distribution":145return {146title: intl.formatMessage({147id: "course.student-assignment-info-header.distribute.info_title",148defaultMessage: "Distribute: From Instructor to Students",149description: infoTitleDescription,150}),151tip: intl.formatMessage({152id: "course.handouts.distribute.tooltip",153defaultMessage:154"Copy all handout files from your project to each student's project, creating independent copies.",155}),156actions: actionsLegend(intl),157runAll: intl.formatMessage({158id: "course.student-assignment-info-header.distribute.run_all",159defaultMessage: "Distribute to all students",160description: runAllDescription,161}),162runOne: intl.formatMessage({163id: "course.student-assignment-info-header.distribute.run_one",164defaultMessage: "Distribute to this student",165description: runOneDescription,166}),167redoOne: intl.formatMessage({168id: "course.student-assignment-info-header.distribute.redo_one",169defaultMessage: "Distribute again to this student",170description: redoOneDescription,171}),172openOne: intl.formatMessage({173id: "course.student-assignment-info-header.distribute.open_one",174defaultMessage:175"Open the student's copy of this handout in their project",176description: openOneDescription,177}),178};179case "collect":180return {181title: intl.formatMessage({182id: "course.student-assignment-info-header.collect.info_title",183defaultMessage: "Collect: From Students to Instructor",184description: infoTitleDescription,185}),186tip: intl.formatMessage({187id: "course.student-assignment-info-header.collect.tooltip",188defaultMessage:189"Copy all assignment files from each student's project to your project, in their current state. Students can keep editing their copies. New changes will appear in your project only if you collect again.",190}),191actions: actionsLegend(intl),192runAll: intl.formatMessage({193id: "course.student-assignment-info-header.collect.run_all",194defaultMessage: "Collect from all students",195description: runAllDescription,196}),197skipInfo: intl.formatMessage({198id: "course.student-assignment-info-header.collect.skip_info",199defaultMessage: "Allow proceeding without collecting",200description: skipInfoDescription,201}),202runOne: intl.formatMessage({203id: "course.student-assignment-info-header.collect.run_one",204defaultMessage: "Collect from this student",205description: runOneDescription,206}),207redoOne: intl.formatMessage({208id: "course.student-assignment-info-header.collect.redo_one",209defaultMessage: "Collect again from this student",210description: redoOneDescription,211}),212openOne: intl.formatMessage({213id: "course.student-assignment-info-header.collect.open_one",214defaultMessage: "Open this student's collected work in your project",215description: openOneDescription,216}),217};218case "peer_assignment":219return {220title: intl.formatMessage({221id: "course.student-assignment-info-header.peer_assign.info_title",222defaultMessage: "Peer Assign: From Instructor to Peer Graders",223description: infoTitleDescription,224}),225tip: intl.formatMessage(226{227id: "course.student-assignment-info-header.peer_assignment.tooltip",228defaultMessage:229"Distribute collected submissions for peer grading: each submission is copied to {count} randomly selected peer graders, where {count} is set in Peer Grading. You must complete Collect step for all students first.",230description: "Peer Assign tooltip text in column info popover",231},232{233count: "N",234},235),236actions: actionsLegend(intl),237runAll: intl.formatMessage({238id: "course.student-assignment-info-header.peer_assign.run_all",239defaultMessage: "Peer assign for all students",240description: runAllDescription,241}),242runOne: intl.formatMessage({243id: "course.student-assignment-info-header.peer_assign.run_one",244defaultMessage: "Peer assign for this student",245description: runOneDescription,246}),247redoOne: intl.formatMessage({248id: "course.student-assignment-info-header.peer_assign.redo_one",249defaultMessage: "Peer assign again for this student",250description: redoOneDescription,251}),252openOne: intl.formatMessage({253id: "course.student-assignment-info-header.peer_assign.open_one",254defaultMessage:255"Open the student's peer-grading copy in their project",256description: openOneDescription,257}),258};259case "peer_collect":260return {261title: intl.formatMessage({262id: "course.student-assignment-info-header.peer_collect.info_title",263defaultMessage: "Peer Collect: From Peer Graders to Instructor",264description: infoTitleDescription,265}),266tip: intl.formatMessage({267id: "course.student-assignment-info-header.peer_collect.tooltip",268defaultMessage:269"Copy peer-graded submissions with peer feedback from student projects to your project. You must complete Peer Assign step for all students first.",270}),271actions: actionsLegend(intl),272runAll: intl.formatMessage({273id: "course.student-assignment-info-header.peer_collect.run_all",274defaultMessage: "Peer collect for all students",275description: runAllDescription,276}),277runOne: intl.formatMessage({278id: "course.student-assignment-info-header.peer_collect.run_one",279defaultMessage: "Peer collect for this student",280description: runOneDescription,281}),282redoOne: intl.formatMessage({283id: "course.student-assignment-info-header.peer_collect.redo_one",284defaultMessage: "Peer collect again for this student",285description: redoOneDescription,286}),287openOne: intl.formatMessage({288id: "course.student-assignment-info-header.peer_collect.open_one",289defaultMessage:290"Open this student's collected peer grading in your project",291description: openOneDescription,292}),293};294case "return_graded":295return {296title: intl.formatMessage({297id: "course.student-assignment-info-header.return.info_title",298defaultMessage: "Return: From Instructor to Students",299description: infoTitleDescription,300}),301tip: intl.formatMessage({302id: "course.student-assignment-info-header.return.tooltip",303defaultMessage:304"Copy grades, comments, and assignment files with feedback from your project to student projects.",305}),306actions: actionsLegend(intl),307runAll: intl.formatMessage({308id: "course.student-assignment-info-header.return.run_all",309defaultMessage: "Return to all students",310description: runAllDescription,311}),312runOne: intl.formatMessage({313id: "course.student-assignment-info-header.return.run_one",314defaultMessage: "Return to this student",315description: runOneDescription,316}),317redoOne: intl.formatMessage({318id: "course.student-assignment-info-header.return.redo_one",319defaultMessage: "Return again to this student",320description: redoOneDescription,321}),322openOne: intl.formatMessage({323id: "course.student-assignment-info-header.return.open_one",324defaultMessage: "Open the returned copy in the student's project",325description: openOneDescription,326}),327};328default:329unreachable(key);330return undefined as never;331}332}333334export function gradeMsg(intl: IntlShape) {335return {336title: intl.formatMessage({337id: "course.student-assignment-info-header.grade.info_title",338defaultMessage: "Grade: Scores & Comments",339description: infoTitleDescription,340}),341tip: intl.formatMessage({342id: "course.student-assignment-info-header.grade.tooltip",343defaultMessage:344"Record the student's grade and comments for this assignment. The grade can be either numeric or text.",345}),346actions: actionsLegend(intl),347runnbgrader: intl.formatMessage(348{349id: "course.student-assignment-info-header.grade.run_automated_full",350defaultMessage:351"Run <docLink>automated grading</docLink> for all students (if available)",352description: "Grade popover action line with link to nbgrader docs",353},354{355docLink: (chunks) => (356<a357href="https://doc.cocalc.com/teaching-nbgrader.html"358target="_blank"359rel="noopener noreferrer"360>361{chunks}362</a>363),364},365),366skipInfo: intl.formatMessage({367id: "course.student-assignment-info-header.grade.skip_info",368defaultMessage: "Allow proceeding without grading",369description: skipInfoDescription,370}),371editOne: intl.formatMessage({372id: "course.student-assignment-info-header.grade.edit_one",373defaultMessage: "Edit grade and comments for this student",374description: editOneDescription,375}),376};377}378379380