Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/frontend/account/tours.tsx
6011 views
1
// cSpell:ignore fullpage
2
3
import { Space } from "antd";
4
import { ReactNode } from "react";
5
6
import { Panel, Switch } from "@cocalc/frontend/antd-bootstrap";
7
import { redux, useRedux } from "@cocalc/frontend/app-framework";
8
import { Icon } from "@cocalc/frontend/components/icon";
9
10
const TOUR_NAMES = {
11
projects: "Projects",
12
"chatgpt-title-bar-button": "ChatGPT Button",
13
explorer: "File Explorer",
14
"frame-terminal": "Linux Terminal",
15
"flyout-fullpage": "Fullpage Flyout",
16
} as const;
17
18
export type TourName = keyof typeof TOUR_NAMES;
19
20
export default function Tours() {
21
const tours = useRedux("account", "tours");
22
const v: ReactNode[] = [];
23
for (const name in TOUR_NAMES) {
24
v.push(
25
<Switch
26
key={name}
27
checked={tours?.includes(name) || tours?.includes("all")}
28
onChange={(e) => {
29
const actions = redux.getActions("account");
30
if (e.target.checked) {
31
actions.setTourDone(name);
32
} else {
33
actions.setTourNotDone(name);
34
}
35
}}
36
>
37
{TOUR_NAMES[name]}
38
</Switch>,
39
);
40
}
41
return (
42
<Panel
43
size={"small"}
44
header={
45
<span>
46
<Icon name="map" /> Completed Tours
47
</span>
48
}
49
>
50
<Space wrap>{v}</Space>
51
</Panel>
52
);
53
}
54
55