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/billing/util.tsx
Views: 687
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import { Rendered } from "../app-framework";6import { Icon } from "../components/icon";7import { PROJECT_UPGRADES } from "@cocalc/util/schema";8import { Tip } from "../components/tip";9import { Gap } from "../components/gap";10import { round1, plural } from "@cocalc/util/misc";11import { stripeAmount } from "@cocalc/util/misc";1213export function powered_by_stripe(): Rendered {14return (15<span>16Powered by{" "}17<a18href="https://stripe.com/"19rel="noopener"20target="_blank"21style={{ top: "7px", position: "relative", fontSize: "23pt" }}22>23<Icon name="cc-stripe" />24</a>25</span>26);27}2829export function render_project_quota(name: string, value: number): Rendered {30const data = PROJECT_UPGRADES.params[name];31if (data == null) {32throw Error(`unknown quota ${name}`);33}34let amount: number = value * data.pricing_factor;35let unit: string = data.pricing_unit;36if (unit === "day" && amount < 2) {37amount = 24 * amount;38unit = "hour";39}40return (41<div key={name} style={{ marginBottom: "5px", marginLeft: "10px" }}>42<Tip title={data.display} tip={data.desc}>43<span style={{ fontWeight: "bold", color: "#666" }}>44{round1(amount)} {plural(amount, unit)}45</span>46<Gap />47<span style={{ color: "#999" }}>{data.display}</span>48</Tip>49</div>50);51}5253export function render_amount(amount: number, currency: string) {54return (55<div style={{ float: "right" }}>{stripeAmount(amount, currency)}</div>56);57}585960