4
4
*/
5
5
6
6
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" ;
15
8
import {
16
9
Component ,
17
- ReactDOM ,
18
- Rendered ,
19
10
rclass ,
20
11
redux ,
21
12
rtypes ,
@@ -44,7 +35,7 @@ class SystemNotifications extends Component<Props, State> {
44
35
} ;
45
36
}
46
37
47
- render_mark_done ( ) : Rendered {
38
+ render_mark_done ( ) {
48
39
if ( ! this . props . notifications ) return ;
49
40
let open = 0 ;
50
41
this . props . notifications . map ( ( mesg : Map < string , any > ) => {
@@ -63,43 +54,55 @@ class SystemNotifications extends Component<Props, State> {
63
54
}
64
55
}
65
56
66
- render_buttons ( ) : Rendered {
57
+ render_buttons ( ) {
67
58
return (
68
- < ButtonToolbar >
59
+ < Space >
69
60
< Button onClick = { ( ) => this . setState ( { state : "edit" , mesg : "" } ) } >
70
61
Compose...
71
62
</ Button >
72
63
{ this . render_mark_done ( ) }
73
- </ ButtonToolbar >
64
+ </ Space >
74
65
) ;
75
66
}
76
67
77
- render_editor ( ) : Rendered {
68
+ render_editor ( ) {
78
69
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" } } >
98
82
< Button onClick = { ( ) => this . setState ( { state : "view" } ) } >
99
83
Cancel
100
84
</ 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 >
103
106
) ;
104
107
}
105
108
@@ -116,7 +119,7 @@ class SystemNotifications extends Component<Props, State> {
116
119
( redux . getActions ( "system_notifications" ) as any ) . mark_all_done ( ) ;
117
120
}
118
121
119
- render_body ( ) : Rendered {
122
+ render_body ( ) {
120
123
if ( this . props . notifications == null ) {
121
124
return < Loading /> ;
122
125
}
@@ -128,7 +131,7 @@ class SystemNotifications extends Component<Props, State> {
128
131
}
129
132
}
130
133
131
- render ( ) : Rendered {
134
+ render ( ) {
132
135
return (
133
136
< div >
134
137
< Title level = { 4 } > System Notifications</ Title >
0 commit comments