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
70 lines (67 loc) · 2.16 KB
/
index.tsx
File metadata and controls
70 lines (67 loc) · 2.16 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
import * as React from 'react'
import { connect, Connect } from '../../app'
import { Flush as FlushType, FlushReference } from '../../app/state'
import { Pipe } from '../Action/elements'
import { Flush, FlushHeader } from './elements'
import Path from '../ActionPath'
import Text from '../common/Text'
import Icon from '../common/Icon'
type Props = {
flushReference: FlushReference
flush: FlushType
} & Connect
const ActionFlush: React.SFC<Props> = ({ flush, flushReference, app }) =>
flush.components.length || flush.computed.length || flush.derived.length ? (
<Pipe>
<Path />
<Flush>
<FlushHeader
onClick={() => app.actions.toggleCollapsed(flushReference)}
>
<Text variant="hint">
<Icon>code</Icon> {flush.components.length}
</Text>
<Text variant="hint">
<Icon>chain</Icon> {flush.derived.length}
</Text>
<Text variant="hint">
<Icon>calculator</Icon> {flush.computed.length}
</Text>
<Text variant="hint">
{flushReference.isCollapsed ? (
<Icon>chevron-up</Icon>
) : (
<Icon>chevron-down</Icon>
)}
</Text>
</FlushHeader>
{flushReference.isCollapsed ? null : (
<div>
{flush.components.map((componentId) => (
<div key={componentId}>
<Text variant="hint">
<Icon>code</Icon>{' '}
{app.state.currentApp.components[componentId].name}
</Text>
</div>
))}
{flush.derived.map((derivedPath) => (
<div key={derivedPath}>
<Text variant="hint">
<Icon>chain</Icon> {derivedPath}
</Text>
</div>
))}
{flush.computed.map((computedPath) => (
<div key={computedPath}>
<Text variant="hint">
<Icon>calculator</Icon> {computedPath}
</Text>
</div>
))}
</div>
)}
</Flush>
</Pipe>
) : null
export default connect(ActionFlush)