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/account/config/system/behavior.tsx
Views: 687
1
import { Space } from "antd";
2
import Loading from "components/share/loading";
3
import register from "../register";
4
import useEditTable from "lib/hooks/edit-table";
5
6
const desc = {
7
confirm_close: `You can make CoCalc always ask for confirmation before closing a browser tab viewing a project.
8
Enable this if you have issues with accidentally closing the CoCalc browser tab.
9
This shouldn't be necessary, since it's unlikely you will loose work if you close
10
the tab; also when you reopen CoCalc everything should be exactly as you left it.`,
11
katex: `
12
The default is to always attempt to render formulas with KaTeX if possible, but you can
13
uncheck the box below to use MathJax version 2 by default when possible. KaTeX is faster than
14
MathJax v2, but there are edge cases that MathJax supports but KaTeX doesn't,
15
often only for historical reasons; also, MathJax has a useful context menu.
16
(Some parts of CoCalc only support KaTeX no matter what you select here.)
17
`,
18
standby_timeout_m: `
19
If you are not active for several minutes, you may see the gray and blue CoCalc splash screen
20
and your browser will minimize resource usage. The time until the splash screen appears is the
21
standby timeout, which you can adjust below. We use it to conserve resources, mainly network
22
bandwidth and browser CPU cycles. Execution of your code is NOT paused during standby.
23
`,
24
show_global_info2: `
25
Sometimes there are important announcements about CoCalc, e.g., if there is a major
26
update available. You can hide these if you do not want to see them at the top of
27
the screen for some reason.
28
`,
29
};
30
31
interface Data {
32
other_settings: {
33
standby_timeout_m: number;
34
katex: boolean;
35
confirm_close: boolean;
36
};
37
}
38
39
register({
40
path: "system/behavior",
41
title: "Behavior",
42
icon: "circle",
43
desc: "Configure general behavior of CoCalc, including idle timeout, math rendering, and whether to ask for confirmation before closing the browser window.",
44
search: desc,
45
Component: () => {
46
const { edited, original, Save, EditBoolean, EditNumber } =
47
useEditTable<Data>({
48
accounts: { other_settings: null },
49
});
50
if (original == null || edited == null) {
51
return <Loading />;
52
}
53
54
return (
55
<Space direction="vertical">
56
<Save />
57
<EditNumber
58
icon="ban"
59
path="other_settings.standby_timeout_m"
60
title="Standby Timeout"
61
desc={desc.standby_timeout_m}
62
min={1}
63
max={180}
64
units="minutes"
65
/>
66
<EditBoolean
67
path="other_settings.katex"
68
icon="tex"
69
title="Math Rendering: KaTeX versus MathJax"
70
desc={desc.katex}
71
label="Attempt to use KaTeX if at all possible"
72
/>
73
<EditBoolean
74
icon="times-circle"
75
path="other_settings.confirm_close"
76
title="Confirmation before closing browser tab"
77
desc={desc.confirm_close}
78
label="Ask for confirmation"
79
/>
80
</Space>
81
);
82
},
83
});
84
85