Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/src/packages/frontend/course/assignments/skip.tsx
Views: 687
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45/*6Skip assigning or collecting an assignment, so next step can be attempted.7*/89import { CourseActions } from "../actions";10import { AssignmentRecord } from "../store";11import { Icon, Gap, Tip } from "../../components";12import { Button } from "antd";1314interface SkipCopyProps {15assignment: AssignmentRecord;16step: string;17actions: CourseActions;18}1920export function SkipCopy({ assignment, step, actions }: SkipCopyProps) {21function click() {22actions.assignments.set_skip(23assignment.get("assignment_id"),24step,25!assignment.get(`skip_${step}` as any),26);27}2829function icon_extra() {30let icon;31let extra: JSX.Element | undefined = undefined;32if (assignment.get(`skip_${step}` as any)) {33icon = "check-square-o";34if (assignment.getIn(["peer_grade", "enabled"])) {35// don't bother even trying to implement skip and peer grading at once.36extra = (37<span>38<Gap /> (Please disable this or peer grading.)39</span>40);41}42} else {43icon = "square-o";44}45return { icon, extra };46}4748const { icon, extra } = icon_extra();4950return (51<Tip52placement="left"53title="Skip step in workflow"54tip="Click this checkbox to enable doing the next step after this step, e.g., you can try to collect assignments that you never explicitly assigned (maybe the students put them in place some other way)."55>56<Button onClick={click}>57<Icon name={icon} /> Skip {step} {extra}58</Button>59</Tip>60);61}626364