Path: blob/master/src/packages/next/components/store/apply-license-to-project.tsx
1450 views
/*1* This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import { Icon } from "@cocalc/frontend/components/icon";6import { Alert, Button, Popconfirm } from "antd";7import { NextRouter } from "next/router";8import { useLicenseProject } from "./util";9import Project from "components/project/link";1011import type { JSX } from "react";1213interface ApplyLicenseToProjectProps {14router: NextRouter;15}1617export const ApplyLicenseToProject: React.FC<ApplyLicenseToProjectProps> = (18props: ApplyLicenseToProjectProps19) => {20const { router } = props;21const { upgradeProjectId, upgradeProjectDelete } = useLicenseProject(router);2223function body(): JSX.Element {24if (!upgradeProjectId) throw new Error("should never happen");25return (26<div>27After purchase, this license will applied to project{" "}28<Project project_id={upgradeProjectId} /> automatically.29</div>30);31}3233if (!upgradeProjectId) return null;3435return (36<Alert37type="info"38message={body()}39style={{ marginBottom: "20px" }}40action={41<Popconfirm42placement="bottomRight"43title={44<div style={{ maxWidth: "400px" }}>45Are you sure you want to cancel automatically applying the license46to the project after purchasing it? Don't forget to apply the47license manually.48</div>49}50onConfirm={upgradeProjectDelete}51okText="Yes, cancel"52cancelText="No"53>54<Button size="small" type="link">55<Icon name="times" />56</Button>57</Popconfirm>58}59/>60);61};626364