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/pay-banner.tsx
Views: 687
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45/*6A banner across the top of a course that appears if the instructor is not paying7in any way, so they know they should.89This banner only shows up if commerical is set for hub configuration.10*/1112import { CSS, useTypedRedux } from "../app-framework";13import { Alert } from "antd";14import { CourseSettingsRecord } from "./store";15import { Icon } from "../components";1617interface PayBannerProps {18settings: CourseSettingsRecord;19num_students: number;20show_config: () => void;21}2223export function PayBanner({24settings,25num_students,26show_config,27}: PayBannerProps) {28const is_commercial = useTypedRedux("customize", "is_commercial");2930if (!is_commercial) {31return <></>;32}3334function paid(): boolean {35if ((num_students != null ? num_students : 0) <= 3) {36// don't bother at first37return true;38}39if (settings.get("student_pay")) {40return true;41}42if (settings.get("institute_pay")) {43return true;44}45return false;46}4748if (paid()) {49return <span />;50}5152let style, linkStyle: CSS;53if ((num_students != null ? num_students : 0) >= 20) {54// Show a harsh error.55style = {56background: "red",57color: "white",58fontSize: "16pt",59fontWeight: "bold",60margin: "15px",61};62linkStyle = { color: "white" };63} else {64style = {65fontSize: "12pt",66color: "#666",67margin: "15px",68};69linkStyle = {};70}7172return (73<Alert74type="warning"75style={style}76message={77<div style={{ display: "flex" }}>78<Icon name="exclamation-triangle" />79<div style={{ flex: 1, textAlign: "center" }}>80<a onClick={show_config} style={linkStyle}>81Configure either the student or institute pay option...82</a>83</div>84<Icon name="exclamation-triangle" />85</div>86}87/>88);89}909192