Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/frontend/account/messages.tsx
5979 views
1
import { Button } from "antd";
2
3
import { Panel, Switch } from "@cocalc/frontend/antd-bootstrap";
4
import { redux, useTypedRedux } from "@cocalc/frontend/app-framework";
5
import { Icon } from "@cocalc/frontend/components/icon";
6
7
export default function Messages() {
8
const other_settings = useTypedRedux("account", "other_settings");
9
const email_address_verified = useTypedRedux(
10
"account",
11
"email_address_verified",
12
);
13
const email_address = useTypedRedux("account", "email_address");
14
15
const isVerified = !!email_address_verified?.get(email_address ?? "");
16
return (
17
<Panel
18
size={"small"}
19
style={{ marginTop: "10px" }}
20
header={
21
<Button
22
onClick={() => {
23
redux.getActions("page").set_active_tab("notifications");
24
redux
25
.getActions("mentions")
26
.set_filter("messages-inbox" as "messages-inbox");
27
}}
28
type="link"
29
style={{ fontSize: "16px", marginLeft: "-15px" }}
30
>
31
<Icon name="mail" /> Message Settings
32
</Button>
33
}
34
>
35
<Switch
36
checked={other_settings?.get("no_email_new_messages")}
37
onChange={(e) => {
38
const actions = redux.getActions("account");
39
actions.set_other_settings("no_email_new_messages", e.target.checked);
40
}}
41
>
42
Do NOT send email when you get new internal messages
43
</Switch>
44
{!isVerified && !other_settings?.get("no_email_new_messages") && (
45
<>
46
(NOTE: You must also verify your email address above to get emails
47
about new messages.)
48
</>
49
)}
50
</Panel>
51
);
52
}
53
54