Skip to content

Commit

Permalink
feat(overmind-devtools): show effect arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
christianalfoni committed Apr 5, 2019
1 parent 0c74225 commit 4b0e556
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createElement, FunctionComponent } from 'react'
import { createElement, FunctionComponent, Fragment } from 'react'
import {
Operator as OperatorType,
EventType,
Expand Down Expand Up @@ -73,14 +73,18 @@ const ActionOperator: FunctionComponent<Props> = ({
? effect.name + '.' + effect.method
: effect.method}
</span>
{effect.args.length ? (
<ValueInspector
small
value={
effect.args.length > 1 ? effect.args : effect.args[0]
}
/>
) : null}
<span className={styles.effectArgs}>
(
{effect.args.map((arg, argIndex) => (
<Fragment>
<ValueInspector small value={arg} />
{argIndex === effect.args.length - 1 ? null : (
<span>,</span>
)}
</Fragment>
))}
)
</span>
{effect.result === undefined && !effect.error ? null : (
<span
className={css(
Expand Down Expand Up @@ -123,14 +127,9 @@ const ActionOperator: FunctionComponent<Props> = ({
>
{mutation.path}
</span>
<ValueInspector
small
value={
mutation.args.length > 1
? mutation.args
: mutation.args[0]
}
/>
{mutation.args.map((arg) => (
<ValueInspector small value={arg} />
))}
</div>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@ export const operator = css({
cursor: 'default',
})

export const effectArgs = css({
display: 'flex',
alignItems: 'center',
'> span': {
marginRight: '0.5rem',
},
})

export const value = css({
marginLeft: 'auto',
paddingRight: '0.5rem',
display: 'flex',
alignItems: 'center',
})
Expand Down

0 comments on commit 4b0e556

Please sign in to comment.