Skip to content

Commit fcd2084

Browse files
committed
update system notifications to not use bootstrap
1 parent 8b3bac5 commit fcd2084

File tree

1 file changed

+41
-38
lines changed

1 file changed

+41
-38
lines changed

src/packages/frontend/admin/system-notifications.tsx

Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,9 @@
44
*/
55

66
import { Map } from "immutable";
7-
8-
import {
9-
Button,
10-
ButtonToolbar,
11-
FormControl,
12-
FormGroup,
13-
Well,
14-
} from "@cocalc/frontend/antd-bootstrap";
7+
import { Alert, Button, Card, Input, Popconfirm, Space } from "antd";
158
import {
169
Component,
17-
ReactDOM,
18-
Rendered,
1910
rclass,
2011
redux,
2112
rtypes,
@@ -44,7 +35,7 @@ class SystemNotifications extends Component<Props, State> {
4435
};
4536
}
4637

47-
render_mark_done(): Rendered {
38+
render_mark_done() {
4839
if (!this.props.notifications) return;
4940
let open = 0;
5041
this.props.notifications.map((mesg: Map<string, any>) => {
@@ -63,43 +54,55 @@ class SystemNotifications extends Component<Props, State> {
6354
}
6455
}
6556

66-
render_buttons(): Rendered {
57+
render_buttons() {
6758
return (
68-
<ButtonToolbar>
59+
<Space>
6960
<Button onClick={() => this.setState({ state: "edit", mesg: "" })}>
7061
Compose...
7162
</Button>
7263
{this.render_mark_done()}
73-
</ButtonToolbar>
64+
</Space>
7465
);
7566
}
7667

77-
render_editor(): Rendered {
68+
render_editor() {
7869
return (
79-
<Well>
80-
<FormGroup>
81-
<FormControl
82-
autoFocus
83-
value={this.state.mesg}
84-
ref="input"
85-
rows={3}
86-
componentClass="textarea"
87-
onChange={() =>
88-
this.setState({
89-
mesg: ReactDOM.findDOMNode(this.refs.input)?.value,
90-
})
91-
}
92-
/>
93-
</FormGroup>
94-
<ButtonToolbar>
95-
<Button onClick={() => this.send()} bsStyle="danger">
96-
<Icon name="paper-plane" /> Send
97-
</Button>
70+
<Card>
71+
<Input.TextArea
72+
autoFocus
73+
value={this.state.mesg}
74+
rows={3}
75+
onChange={(e) =>
76+
this.setState({
77+
mesg: e.target.value,
78+
})
79+
}
80+
/>
81+
<Space style={{ marginTop: "15px" }}>
9882
<Button onClick={() => this.setState({ state: "view" })}>
9983
Cancel
10084
</Button>
101-
</ButtonToolbar>
102-
</Well>
85+
<Popconfirm
86+
title="Send notification?"
87+
description={
88+
<div style={{ width: "400px" }}>
89+
Everyone that uses CoCalc will see the following notification
90+
once in the upper right until you explicitly mark it done (they
91+
can dismiss it).
92+
<hr />
93+
<Alert message={this.state.mesg} />
94+
</div>
95+
}
96+
onConfirm={() => {
97+
this.send();
98+
}}
99+
>
100+
<Button danger>
101+
<Icon name="paper-plane" /> Send
102+
</Button>
103+
</Popconfirm>
104+
</Space>
105+
</Card>
103106
);
104107
}
105108

@@ -116,7 +119,7 @@ class SystemNotifications extends Component<Props, State> {
116119
(redux.getActions("system_notifications") as any).mark_all_done();
117120
}
118121

119-
render_body(): Rendered {
122+
render_body() {
120123
if (this.props.notifications == null) {
121124
return <Loading />;
122125
}
@@ -128,7 +131,7 @@ class SystemNotifications extends Component<Props, State> {
128131
}
129132
}
130133

131-
render(): Rendered {
134+
render() {
132135
return (
133136
<div>
134137
<Title level={4}>System Notifications</Title>

0 commit comments

Comments
 (0)