CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/components/licenses/menu.tsx
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { Icon } from "@cocalc/frontend/components/icon";
7
import { Menu, MenuProps, Typography } from "antd";
8
import { useRouter } from "next/router";
9
const { Text } = Typography;
10
11
type MenuItem = Required<MenuProps>["items"][number];
12
13
export default function ConfigMenu({ main }) {
14
const router = useRouter();
15
16
const items: MenuItem[] = [
17
{ label: <Text strong>Licenses</Text>, key: "" },
18
{ label: "Manage", key: "managed", icon: <Icon name={"key"} /> },
19
{ label: "Projects", key: "projects", icon: <Icon name={"edit"} /> },
20
{ label: "How Used", key: "how-used", icon: <Icon name={"graph"} /> },
21
];
22
23
function select(e) {
24
router.push(`/licenses/${e.keyPath[0]}`, undefined, {
25
scroll: false,
26
});
27
}
28
29
return (
30
<Menu
31
mode="horizontal"
32
selectedKeys={[main]}
33
style={{ height: "100%", marginBottom: "24px" }}
34
onSelect={select}
35
items={items}
36
/>
37
);
38
}
39
40