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/common/progress.tsx
Views: 687
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45/*6Progress indicator for assigning/collecting/etc. a particular assignment or handout.7*/89import { Icon, Gap } from "@cocalc/frontend/components";10import { COLORS } from "@cocalc/util/theme";1112const progress_info = {13color: COLORS.GRAY_D,14marginLeft: "10px",15whiteSpace: "normal",16} as const;1718const progress_info_done = {19...progress_info,20color: COLORS.BS_GREEN_DD,21} as const;2223interface ProgressProps {24done: number;25not_done: number;26step: string;27skipped?: boolean;28}2930export function Progress({ done, not_done, step, skipped }: ProgressProps) {31function render_checkbox() {32if (not_done === 0) {33return (34<span style={{ fontSize: "12pt" }}>35<Icon name="check-circle" />36<Gap />37</span>38);39}40}4142function render_status() {43if (!skipped) {44return (45<>46({done} / {not_done + done} {step})47</>48);49} else {50return <>Skipped</>;51}52}5354function style() {55if (not_done === 0) {56return progress_info_done;57} else {58return progress_info;59}60}6162if (done == null || not_done == null || step == null) {63return <span />;64} else {65return (66<div style={style()}>67{render_checkbox()}68{render_status()}69</div>70);71}72}737475