Skip to content

Commit 6ccfeab

Browse files
committed
🐛 Standardizes modals and also removes standard js
1 parent 1382435 commit 6ccfeab

22 files changed

+631
-1651
lines changed
Lines changed: 53 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,148 +1,78 @@
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"
77

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"
1111

1212
// all possible commands grouped by functionality
1313
const GROUPS = [
1414
{
15-
name: 'Informational',
15+
name: "Informational",
1616
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+
],
2121
},
2222
{
23-
name: 'General',
23+
name: "General",
2424
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+
],
2929
},
3030
{
31-
name: 'Async Storage',
32-
items: [{ value: 'asyncStorage.values.change', text: 'Changes' }]
31+
name: "Async Storage",
32+
items: [{ value: "asyncStorage.values.change", text: "Changes" }],
3333
},
3434
{
35-
name: 'State & Sagas',
35+
name: "State & Sagas",
3636
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+
},
4242
]
4343

4444
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: {},
11445
groupName: {
11546
fontSize: 18,
11647
marginTop: 10,
11748
marginBottom: 10,
11849
color: Colors.foregroundLight,
11950
paddingBottom: 2,
120-
borderBottom: `1px solid ${Colors.highlight}`
51+
borderBottom: `1px solid ${Colors.highlight}`,
12152
},
122-
option: {},
123-
12453
numberContainer: {
125-
position: 'relative'
54+
position: "relative",
12655
},
127-
12856
inputStyle: {
129-
position: 'absolute',
57+
position: "absolute",
13058
top: 0,
13159
right: 0,
13260
backgroundColor: Colors.backgroundSubtleDark,
13361
color: Colors.foregroundDark,
134-
border: 'none',
62+
border: "none",
13563
paddingLeft: 10,
13664
paddingTop: 4,
13765
paddingBottom: 4,
138-
paddingRight: 10
139-
}
66+
paddingRight: 10,
67+
},
14068
}
14169

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
14475
const { ui } = session
145-
if (!ui.showFilterTimelineDialog) return null
14676

14777
const groups = GROUPS.map((opt, optIdx) => {
14878
const options = opt.items.map((itm, itmIdx) => {
@@ -162,24 +92,28 @@ const FilterTimelineDialog = inject('session')(
16292

16393
return (
16494
<Modal
165-
isOpen
95+
isOpen={ui.showFilterTimelineDialog}
16696
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+
}}
168102
>
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>
172106
</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}
177111
</div>
178112
</div>
179113
</div>
180114
</Modal>
181115
)
182-
})
183-
)
116+
}
117+
}
184118

185119
export default FilterTimelineDialog

packages/reactotron-app/App/Dialogs/HelpDialog.js

Lines changed: 0 additions & 132 deletions
This file was deleted.

0 commit comments

Comments
 (0)