1
- import React from ' react'
2
- import Modal from ' react-modal'
3
- import { inject , observer } from ' mobx-react'
4
- import AppStyles from ' ../Theme/AppStyles'
5
- import Colors from ' ../Theme/Colors'
6
- import Checkbox from ' ../Shared/Checkbox'
1
+ import React from " react"
2
+ import Modal from " react-modal"
3
+ import { inject , observer } from " mobx-react"
4
+ import AppStyles from " ../Theme/AppStyles"
5
+ import Colors from " ../Theme/Colors"
6
+ import Checkbox from " ../Shared/Checkbox"
7
7
8
- const ESCAPE_HINT = ' Close'
9
- const ESCAPE_KEYSTROKE = ' ESC'
10
- const DIALOG_TITLE = ' Timeline Filter'
8
+ const ESCAPE_HINT = " Close"
9
+ const ESCAPE_KEYSTROKE = " ESC"
10
+ const DIALOG_TITLE = " Timeline Filter"
11
11
12
12
// all possible commands grouped by functionality
13
13
const GROUPS = [
14
14
{
15
- name : ' Informational' ,
15
+ name : " Informational" ,
16
16
items : [
17
- { value : ' log' , text : ' Log' } ,
18
- { value : ' image' , text : ' Image' } ,
19
- { value : ' display' , text : ' Custom Display' }
20
- ]
17
+ { value : " log" , text : " Log" } ,
18
+ { value : " image" , text : " Image" } ,
19
+ { value : " display" , text : " Custom Display" } ,
20
+ ] ,
21
21
} ,
22
22
{
23
- name : ' General' ,
23
+ name : " General" ,
24
24
items : [
25
- { value : ' client.intro' , text : ' Connection' } ,
26
- { value : ' benchmark.report' , text : ' Benchmark' } ,
27
- { value : ' api.response' , text : ' API' }
28
- ]
25
+ { value : " client.intro" , text : " Connection" } ,
26
+ { value : " benchmark.report" , text : " Benchmark" } ,
27
+ { value : " api.response" , text : " API" } ,
28
+ ] ,
29
29
} ,
30
30
{
31
- name : ' Async Storage' ,
32
- items : [ { value : ' asyncStorage.values.change' , text : ' Changes' } ]
31
+ name : " Async Storage" ,
32
+ items : [ { value : " asyncStorage.values.change" , text : " Changes" } ] ,
33
33
} ,
34
34
{
35
- name : ' State & Sagas' ,
35
+ name : " State & Sagas" ,
36
36
items : [
37
- { value : ' state.action.complete' , text : ' Action' } ,
38
- { value : ' saga.task.complete' , text : ' Saga' } ,
39
- { value : ' state.values.change' , text : ' Subscription Changed' }
40
- ]
41
- }
37
+ { value : " state.action.complete" , text : " Action" } ,
38
+ { value : " saga.task.complete" , text : " Saga" } ,
39
+ { value : " state.values.change" , text : " Subscription Changed" } ,
40
+ ] ,
41
+ } ,
42
42
]
43
43
44
44
const Styles = {
45
- dialog : {
46
- borderRadius : 4 ,
47
- padding : 4 ,
48
- backgroundColor : Colors . background ,
49
- color : Colors . foreground
50
- } ,
51
- examples : { } ,
52
- example : {
53
- padding : 0 ,
54
- margin : '0 0 0 40px' ,
55
- color : Colors . bold
56
- } ,
57
- container : {
58
- ...AppStyles . Layout . vbox
59
- } ,
60
- keystrokes : {
61
- ...AppStyles . Layout . hbox ,
62
- alignSelf : 'center' ,
63
- paddingTop : 10 ,
64
- paddingBottom : 20 ,
65
- fontSize : 13
66
- } ,
67
- hotkey : {
68
- padding : '0 10px'
69
- } ,
70
- keystroke : {
71
- backgroundColor : Colors . backgroundHighlight ,
72
- color : Colors . foreground ,
73
- padding : '4px 8px' ,
74
- borderRadius : 4
75
- } ,
76
- header : {
77
- ...AppStyles . Layout . vbox ,
78
- padding : '1em 2em 0em'
79
- } ,
80
- body : {
81
- ...AppStyles . Layout . vbox ,
82
- padding : '1em 2em 4em'
83
- } ,
84
- title : {
85
- margin : 0 ,
86
- padding : 0 ,
87
- textAlign : 'left' ,
88
- fontWeight : 'normal' ,
89
- fontSize : 24 ,
90
- color : Colors . heading
91
- } ,
92
- subtitle : {
93
- color : Colors . foreground ,
94
- textAlign : 'left' ,
95
- padding : 0 ,
96
- margin : 0
97
- } ,
98
- fieldLabel : {
99
- color : Colors . heading ,
100
- fontSize : 13 ,
101
- textTransform : 'uppercase'
102
- } ,
103
- textField : {
104
- borderTop : 0 ,
105
- borderLeft : 0 ,
106
- borderRight : 0 ,
107
- borderBottom : `1px solid ${ Colors . line } ` ,
108
- fontSize : 23 ,
109
- color : Colors . foregroundLight ,
110
- lineHeight : '40px' ,
111
- backgroundColor : 'inherit'
112
- } ,
113
- group : { } ,
114
45
groupName : {
115
46
fontSize : 18 ,
116
47
marginTop : 10 ,
117
48
marginBottom : 10 ,
118
49
color : Colors . foregroundLight ,
119
50
paddingBottom : 2 ,
120
- borderBottom : `1px solid ${ Colors . highlight } `
51
+ borderBottom : `1px solid ${ Colors . highlight } ` ,
121
52
} ,
122
- option : { } ,
123
-
124
53
numberContainer : {
125
- position : ' relative'
54
+ position : " relative" ,
126
55
} ,
127
-
128
56
inputStyle : {
129
- position : ' absolute' ,
57
+ position : " absolute" ,
130
58
top : 0 ,
131
59
right : 0 ,
132
60
backgroundColor : Colors . backgroundSubtleDark ,
133
61
color : Colors . foregroundDark ,
134
- border : ' none' ,
62
+ border : " none" ,
135
63
paddingLeft : 10 ,
136
64
paddingTop : 4 ,
137
65
paddingBottom : 4 ,
138
- paddingRight : 10
139
- }
66
+ paddingRight : 10 ,
67
+ } ,
140
68
}
141
69
142
- const FilterTimelineDialog = inject ( 'session' ) (
143
- observer ( ( { session } ) => {
70
+ @inject ( "session" )
71
+ @observer
72
+ class FilterTimelineDialog extends React . Component {
73
+ render ( ) {
74
+ const { session } = this . props
144
75
const { ui } = session
145
- if ( ! ui . showFilterTimelineDialog ) return null
146
76
147
77
const groups = GROUPS . map ( ( opt , optIdx ) => {
148
78
const options = opt . items . map ( ( itm , itmIdx ) => {
@@ -162,24 +92,28 @@ const FilterTimelineDialog = inject('session')(
162
92
163
93
return (
164
94
< Modal
165
- isOpen
95
+ isOpen = { ui . showFilterTimelineDialog }
166
96
onRequestClose = { ui . closeFilterTimelineDialog }
167
- style = { { content : Styles . dialog , overlay : { zIndex : 5 } } }
97
+ onAfterOpen = { this . onAfterOpenModal }
98
+ style = { {
99
+ content : AppStyles . Modal . content ,
100
+ overlay : AppStyles . Modal . overlay ,
101
+ } }
168
102
>
169
- < div style = { Styles . container } >
170
- < div style = { Styles . header } >
171
- < h1 style = { Styles . title } > { DIALOG_TITLE } </ h1 >
103
+ < div style = { AppStyles . Modal . container } >
104
+ < div style = { AppStyles . Modal . header } >
105
+ < h1 style = { AppStyles . Modal . title } > { DIALOG_TITLE } </ h1 >
172
106
</ div >
173
- < div style = { Styles . body } > { groups } </ div >
174
- < div style = { Styles . keystrokes } >
175
- < div style = { Styles . hotkey } >
176
- < span style = { Styles . keystroke } > { ESCAPE_KEYSTROKE } </ span > { ESCAPE_HINT }
107
+ < div style = { AppStyles . Modal . body } > { groups } </ div >
108
+ < div style = { AppStyles . Modal . keystrokes } >
109
+ < div style = { AppStyles . Modal . hotkey } >
110
+ < span style = { AppStyles . Modal . keystroke } > { ESCAPE_KEYSTROKE } </ span > { ESCAPE_HINT }
177
111
</ div >
178
112
</ div >
179
113
</ div >
180
114
</ Modal >
181
115
)
182
- } )
183
- )
116
+ }
117
+ }
184
118
185
119
export default FilterTimelineDialog
0 commit comments