Path: blob/master/src/packages/next/pages/pricing/courses.tsx
1450 views
/*1* This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import { Layout, List } from "antd";67import { Icon, IconName } from "@cocalc/frontend/components/icon";8import { LicenseIdleTimeouts, Uptime } from "@cocalc/util/consts/site-license";9import { compute_cost } from "@cocalc/util/licenses/purchase/compute-cost";10import { discount_pct } from "@cocalc/util/licenses/purchase/consts";11import { PurchaseInfo } from "@cocalc/util/licenses/purchase/types";12import { money } from "@cocalc/util/licenses/purchase/utils";13import { COLORS } from "@cocalc/util/theme";14import Footer from "components/landing/footer";15import Head from "components/landing/head";16import Header from "components/landing/header";17import PricingItem, { Line } from "components/landing/pricing-item";18import { Paragraph, Title } from "components/misc";19import A from "components/misc/A";20import { listedPrices } from "components/share/pricing";21import { LinkToStore, StoreConf } from "components/store/link";22import { encodeRange } from "components/store/quota-query-params";23import { MAX_WIDTH } from "lib/config";24import { Customize } from "lib/customize";25import withCustomize from "lib/with-customize";2627import type { JSX } from "react";2829interface Item {30title: string;31icon: IconName;32teachers: number;33students: number;34duration: string;35disk: number;36shared_ram: number;37shared_cores: number;38academic: boolean;39retail?: number;40online: number;41uptime?: string;42conf: StoreConf;43}4445const training: Item = (() => {46const students = 10;47const days = 5;48const conf = {49run_limit: students + 1,50user: "business",51days,52ram: 5,53disk: 5,54cpu: 1,55uptime: "medium" as Uptime,56start: new Date(),57end: new Date(new Date().getTime() + days * 24 * 60 * 60 * 1000),58} as const;5960const profPrice = compute_cost({61type: "quota",62user: conf.user,63upgrade: "custom",64quantity: conf.run_limit,65subscription: "no",66start: conf.start,67end: conf.end,68custom_ram: conf.ram,69custom_cpu: conf.cpu,70custom_disk: conf.disk,71custom_member: true,72custom_dedicated_ram: 0,73custom_dedicated_cpu: 0,74custom_uptime: conf.uptime,75} as PurchaseInfo);7677return {78title: `${conf.days} Day Professional Training`,79icon: "battery-quarter",80teachers: 1,81students,82duration: `${conf.days} days`,83disk: conf.disk,84uptime: LicenseIdleTimeouts[conf.uptime].labelShort,85shared_ram: conf.ram,86dedicated_ram: 0,87shared_cores: conf.cpu,88dedicated_cores: 0,89academic: false,90online: profPrice.cost,91conf,92};93})();9495const courseSmall: Item = (() => {96const students = 10;97const days = 30;98const conf = {99run_limit: students + 1,100days,101ram: 2,102disk: 3,103cpu: 1,104uptime: "short",105user: "academic",106start: new Date(),107end: new Date(new Date().getTime() + days * 24 * 60 * 60 * 1000),108} as const;109110const price = compute_cost({111type: "quota",112user: conf.user,113upgrade: "custom",114quantity: conf.run_limit,115subscription: "no",116start: conf.start,117end: conf.end,118custom_ram: conf.ram,119custom_cpu: conf.cpu,120custom_disk: conf.disk,121custom_member: true,122custom_dedicated_ram: 0,123custom_dedicated_cpu: 0,124custom_uptime: conf.uptime,125} as PurchaseInfo);126127return {128title: `${students} students for ${conf.days} days`,129icon: "battery-half",130teachers: 1,131students,132duration: `${conf.days} days`,133disk: conf.disk,134uptime: LicenseIdleTimeouts[conf.uptime].labelShort,135shared_ram: conf.ram,136shared_cores: conf.cpu,137academic: true,138retail: price.cost,139online: price.cost,140conf,141};142})();143144const courseLarge: Item = (() => {145const students = 150;146const months = 4;147const days = months * 30;148const conf = {149run_limit: students + 1,150days,151user: "academic",152ram: 2,153disk: 3,154cpu: 1,155uptime: "short",156start: new Date(),157end: new Date(new Date().getTime() + days * 24 * 60 * 60 * 1000),158} as const;159160const price = compute_cost({161type: "quota",162user: conf.user,163upgrade: "custom",164quantity: conf.run_limit,165subscription: "no",166start: conf.start,167end: conf.end,168custom_ram: conf.ram,169custom_cpu: conf.cpu,170custom_disk: conf.disk,171custom_member: true,172custom_dedicated_ram: 0,173custom_dedicated_cpu: 0,174custom_uptime: conf.uptime,175} as PurchaseInfo);176177return {178title: `${students} Students for ${months} Months`,179icon: "battery-full",180teachers: 1,181students,182duration: `${days} days`,183disk: conf.disk,184uptime: LicenseIdleTimeouts[conf.uptime].labelShort,185shared_ram: conf.ram,186shared_cores: conf.cpu,187academic: true,188retail: price.cost,189online: price.cost,190conf,191};192})();193194const data: Item[] = [training, courseSmall, courseLarge];195196export default function Courses({ customize }) {197const { siteName } = customize;198return (199<Customize value={customize}>200<Head title={`${siteName} – Pricing – Course Licenses`} />201<Layout>202<Header page="pricing" subPage="courses" />203<Layout.Content style={{ backgroundColor: "white" }}>204<Body />205<Footer />206</Layout.Content>207</Layout>208</Customize>209);210}211212function Body(): JSX.Element {213return (214<div215style={{216maxWidth: MAX_WIDTH,217margin: "15px auto",218padding: "15px",219backgroundColor: "white",220}}221>222<div style={{ textAlign: "center" }}>223<Title level={1}>224<Icon name="graduation-cap" style={{ marginRight: "30px" }} />225CoCalc – Course Licenses226</Title>227</div>228<Paragraph>229You{" "}230<A href="https://doc.cocalc.com/teaching-instructors.html">231teach a course232</A>{" "}233on <span>CoCalc</span> by creating one project for each student, sending234your students assignments and handouts, then guiding their progress235using collaboration and chat. You can then collect, grade, comment on,236and return their work.237</Paragraph>238<Paragraph>239You will need to purchase an appropriate license for your course, or240have the students pay the one-time fee, since CoCalc is not funded by241advertisers or other intrusive methods.242</Paragraph>243244<h2>How to get started?</h2>245<Paragraph>246You can{" "}247<A href="/store/site-license" external>248purchase a license for your course249</A>{" "}250in the{" "}251<A href="/store" external>252store253</A>254.255</Paragraph>256<Paragraph>257Minimal upgrades might be okay for beginner courses, but we find that258many data and computational science courses run better with additional259RAM and CPU. <A href="mailto:[email protected]">Contact us</A> if you have260questions or need a trial license to test out different possibilities.261</Paragraph>262<Paragraph>263Once you obtain a license key,{" "}264<A href="https://doc.cocalc.com/teaching-upgrade-course.html">265apply it to all your student projects266</A>267.268</Paragraph>269<Paragraph>270You can acquire several licenses, e.g., to partition a semester into271smaller parts with different requirements, or to keep upgrades separate272between certain groups of courses or instructors.273</Paragraph>274275<Title level={2}>Payment options</Title>276<Paragraph>277<ul style={{ paddingLeft: "20px" }}>278<li>279<b>280<A href="https://doc.cocalc.com/teaching-upgrade-course.html#teacher-or-institution-pays-for-upgrades">281You or your institution pays282</A>283</b>{" "}284for one or more license upgrades. You distribute the license285upgrades to all projects of the course via the course configuration286tab of the course management interface.287</li>288<li>289<b>290<A href="https://doc.cocalc.com/teaching-upgrade-course.html#students-pay-for-upgrades">291Students pay a one-time fee.292</A>293</b>{" "}294In the configuration frame of the course management file, you opt to295require all students to pay a one-time fee to upgrade their own296projects. You can decide on the exact parameters of the license the297students will purchase, depending on the needs for your course.298</li>299</ul>300</Paragraph>301302<Title level={2}>Examples</Title>303<Paragraph>304Here are three typical configurations, which you can{" "}305<A href="/store/site-license" external>306modify and purchase here307</A>308. All parameters can be adjusted to fit your needs. Listed upgrades are309for each project. Exact prices may vary. Only self-service online310purchases are available below $100.311</Paragraph>312313<List314grid={{ gutter: 15, column: 3, xs: 1, sm: 1 }}315dataSource={data}316renderItem={(item) => {317const conf = {318...item.conf,319period: "range" as "range",320range: encodeRange([item.conf.start, item.conf.end]),321};322return (323<PricingItem title={item.title} icon={item.icon}>324<Line amount={item.teachers} desc="Teacher" />325<Line amount={item.students} desc="Students" />326<Line amount={item.duration} desc="Duration" />327<Line amount={item.uptime} desc="Idle timeout" />328<Line amount={item.shared_ram} desc="Shared RAM" />329<Line amount={item.shared_cores} desc="Shared CPU" />330<Line amount={item.disk} desc="Disk space" />331{item.academic && (332<Line amount={`${discount_pct}%`} desc="Academic discount" />333)}334<br />335<br />336<div>337<span338style={{339fontWeight: "bold",340fontSize: "18pt",341color: COLORS.GRAY_DD,342}}343>344{money(item.online, true)}345</span>{" "}346</div>347<LinkToStore conf={conf} />348</PricingItem>349);350}}351/>352353{listedPrices()}354355<Title level={2}>Contact us</Title>356<Paragraph>357To learn more about your teaching options, email us at{" "}358<A href="mailto:[email protected]">[email protected]</A> with a description359of your specific requirements.360</Paragraph>361</div>362);363}364365export async function getServerSideProps(context) {366return await withCustomize({ context });367}368369370