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/next/components/licenses/layout.tsx
Views: 687
/*1* This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import { Alert, Layout } from "antd";67import { COLORS } from "@cocalc/util/theme";8import InPlaceSignInOrUp from "components/auth/in-place-sign-in-or-up";9import Anonymous from "components/misc/anonymous";10import Loading from "components/share/loading";11import { MAX_WIDTH } from "lib/config";12import useProfile from "lib/hooks/profile";13import Error from "next/error";14import { useRouter } from "next/router";15import HowUsed from "./how-used";16import LicensedProjects from "./licensed-projects";17import ManagedLicenses from "./managed";18import Menu from "./menu";19import Overview from "./overview";2021const { Content } = Layout;2223interface Props {24page: ("projects" | "how-used" | "managed" | undefined)[];25}2627export default function LicensesLayout({ page }: Props) {28const router = useRouter();29const profile = useProfile({ noCache: true });30if (!profile) {31return <Loading large center />;32}33const { account_id, is_anonymous } = profile;3435if (!account_id) {36return (37<Alert38style={{ margin: "15px auto" }}39type="warning"40message={41<InPlaceSignInOrUp42title="Account Configuration"43why="to see information about your licenses"44onSuccess={() => {45router.reload();46}}47/>48}49/>50);51}5253if (is_anonymous) {54return <Anonymous />;55}5657const [main] = page;5859function body() {60if (main == null) return <Overview />;61switch (main) {62case "projects":63return <LicensedProjects />;64case "managed":65return <ManagedLicenses />;66case "how-used":67return <HowUsed account_id={account_id} />;68default:69return <Error statusCode={404} />;70}71}7273// this is layout the same way as ../store/index.tsx74return (75<Layout76style={{77padding: "0 24px 24px",78backgroundColor: "white",79color: COLORS.GRAY_D,80}}81>82<Content83style={{84margin: 0,85minHeight: "60vh",86}}87>88<div style={{ maxWidth: MAX_WIDTH, margin: "auto" }}>89<Menu main={main} />90{body()}91</div>92</Content>93</Layout>94);95}969798