forked from cerebral/overmind
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.tsx
More file actions
80 lines (77 loc) · 2.57 KB
/
index.tsx
File metadata and controls
80 lines (77 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import * as React from 'react'
import { useActions, useAppState } from '../../overmind'
import * as styles from './styles'
import { colors } from '../../theme'
const RuntimeConfig: React.FunctionComponent = () => {
const state = useAppState()
const actions = useActions()
return (
<div
className={styles.wrapper}
onClick={() => actions.toggleRuntimeConfig()}
>
<div className={styles.contentWrapper}>
<div className={styles.configWrapper}>
<div className={styles.configDescription}>
<h4 className={styles.configTitle}>Status</h4>
<div>
<strong>Refresh</strong> your browser or <strong>run</strong> the
application in the devtool below.
</div>
</div>
<div className={styles.configValue}>
<strong
style={{
color: state.isConnecting ? colors.red : colors.green,
}}
>
{state.isConnecting ? 'Disconnected' : 'Connected'}
</strong>
</div>
</div>
<div className={styles.configWrapper}>
<div className={styles.configDescription}>
<h4 className={styles.configTitle}>Devtool port</h4>
<div>Application has to connect to this port.</div>
<pre className={styles.code}>
<span style={{ color: colors.purple }}>const</span> overmind ={' '}
{state.port === 3031 ? (
<>
<span style={{ color: colors.green }}>createOvermind</span>
(config)
</>
) : (
<>
<span style={{ color: colors.green }}>createOvermind</span>
(config, {'{'}
{`\n`}
{' '}devtools:{' '}
<span style={{ color: colors.yellow }}>
"localhost:{state.port}"
</span>
{`\n`}
{'}'})
</>
)}
</pre>
</div>
<div className={styles.configValue}>
<input
id="port-input"
className={styles.newPort}
defaultValue={String(state.port)}
onClick={(event) => event.stopPropagation()}
onKeyDown={(event) => {
if (event.keyCode === 13) {
// @ts-ignore
handleFormSubmit(event)
}
}}
/>
</div>
</div>
</div>
</div>
)
}
export default RuntimeConfig