Skip to content

Commit 39fe6cc

Browse files
feat(overmind-devtools): refactor to dork theme
1 parent 31be0c2 commit 39fe6cc

File tree

23 files changed

+119
-94
lines changed

23 files changed

+119
-94
lines changed

packages/node_modules/overmind-devtools/src/app/actions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Action, pipe, OnInitialize, Operator } from 'overmind'
1+
import { Action, pipe, OnInitialize, Operator, run } from 'overmind'
22
import {
33
Message,
44
Tab,
@@ -17,7 +17,6 @@ import {
1717
updateFlushWithDerived,
1818
addAction,
1919
addOperator,
20-
updateFlushWithReactionUpdate,
2120
updateOperator,
2221
updateAction,
2322
addMutations,
@@ -28,6 +27,7 @@ import {
2827
addState,
2928
ensureApp,
3029
addClientMessages,
30+
updateOperatorAsync,
3131
} from './operators'
3232

3333
export const onInitialize: OnInitialize = async ({
@@ -60,11 +60,11 @@ const handleClientMessage: Operator<Message, any> = pipe(
6060
[ExecutionType.COMPONENT_UPDATE]: updateComponent,
6161
[ExecutionType.COMPONENT_REMOVE]: removeComponent,
6262
[ExecutionType.DERIVED_DIRTY]: updateFlushWithDerived,
63-
[ExecutionType.REACTION_UPDATE]: updateFlushWithReactionUpdate,
6463
[ExecutionType.ACTION_START]: addAction,
6564
[ExecutionType.OPERATOR_START]: addOperator,
6665
[ExecutionType.OPERATOR_END]: updateOperator,
6766
[ExecutionType.ACTION_END]: updateAction,
67+
[ExecutionType.OPERATOR_ASYNC]: updateOperatorAsync,
6868
})
6969
)
7070

packages/node_modules/overmind-devtools/src/app/operators.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
MutationsMessage,
2121
EffectMessage,
2222
ExecutionType,
23+
AsyncOperatorMessage,
2324
} from './types'
2425
import {
2526
createApp,
@@ -161,16 +162,6 @@ export const updateFlushWithDerived = mutate<DirtyDerivedMessage>(
161162
}
162163
)
163164

164-
export const updateFlushWithReactionUpdate = mutate<ReactionUpdateMessage>(
165-
({ value: message, state }) => {
166-
ensureFlushExists(state.apps[message.appName].flushes, message.data.flushId)
167-
168-
state.apps[message.appName].flushes[message.data.flushId].reactions.push(
169-
message.data.path
170-
)
171-
}
172-
)
173-
174165
export const addAction = mutate<StartActionMessage>(
175166
({ value: message, state }) => {
176167
const app = state.apps[message.appName]
@@ -302,3 +293,5 @@ export const getMessages = map<Message, AppMessage<any>[]>(({ value }) =>
302293
export const forkEachMessage = (paths: {
303294
[key: string]: Operator<AppMessage<any>, AppMessage<any>>
304295
}) => forEach<AppMessage<any>[]>(fork(({ value }) => value.type, paths))
296+
297+
export const updateOperatorAsync = mutate<AsyncOperatorMessage>(() => {})

packages/node_modules/overmind-devtools/src/app/types.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ export type Flush = {
7676
mutations: Mutation[]
7777
components: string[]
7878
derived: string[]
79-
reactions: string[]
8079
isCollapsed: boolean
8180
}
8281

@@ -147,8 +146,8 @@ export enum ExecutionType {
147146
ACTION_START = 'action:start',
148147
OPERATOR_START = 'operator:start',
149148
OPERATOR_END = 'operator:end',
149+
OPERATOR_ASYNC = 'operator:async',
150150
ACTION_END = 'action:end',
151-
REACTION_UPDATE = 'reaction:update',
152151
}
153152

154153
export enum AppMessageType {
@@ -236,6 +235,18 @@ export type EndOperatorMessage = AppMessage<{
236235
result: any
237236
}>
238237

238+
export type AsyncOperatorMessage = AppMessage<{
239+
actionId: number
240+
actionName: string
241+
name: string
242+
executionId: number
243+
operatorId: number
244+
path: string[]
245+
type: string
246+
isAsync: boolean
247+
result: any
248+
}>
249+
239250
export type EndActionMessage = StartActionMessage
240251

241252
export type MutationsMessage = AppMessage<{

packages/node_modules/overmind-devtools/src/app/utils.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ export const ensureFlushExists = (flushes, flushId) => {
6363
mutations: [],
6464
components: [],
6565
derived: [],
66-
reactions: [],
6766
isCollapsed: true,
6867
}
6968
flushes[flushId] = flush

packages/node_modules/overmind-devtools/src/components/Action/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ const Action: Component = () => {
3434

3535
if (flush) {
3636
return (
37-
<div key={operator.actionId + '_' + operator.operatorId}>
37+
<div>
3838
<ActionOperator
39+
key={operator.actionId + '_' + operator.operatorId}
3940
prevOperator={prevOperator}
4041
operator={operator}
4142
value={value}

packages/node_modules/overmind-devtools/src/components/Action/styles.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { css } from 'emotion'
22

33
export const wrapper = css`
44
padding: var(--padding-4);
5-
background-color: var(--color-white-1);
5+
background-color: var(--color-dark-1);
66
overflow-y: scroll;
77
`
88

@@ -17,7 +17,7 @@ export const expandAll = css`
1717
justify-content: flex-end;
1818
font-size: var(--font-size-2);
1919
cursor: pointer;
20-
color: var(--color-black-1);
20+
color: var(--color-white-2);
2121
opacity: 0.5;
2222
:hover {
2323
opacity: 0.75;

packages/node_modules/overmind-devtools/src/components/ActionFlush/index.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ const ActionFlush: Component<Props> = ({ flush }) => {
2828
<span className={textStyles.hint}>
2929
<Icon>chain</Icon> {flush.derived.length}
3030
</span>
31-
<span className={textStyles.hint}>
32-
<Icon>flask</Icon> {flush.reactions.length}
33-
</span>
3431
<span className={textStyles.hint}>
3532
{isExpanded ? <Icon>chevron-down</Icon> : <Icon>chevron-up</Icon>}
3633
</span>
@@ -52,13 +49,6 @@ const ActionFlush: Component<Props> = ({ flush }) => {
5249
</span>
5350
</div>
5451
))}
55-
{flush.reactions.map((reactionPath) => (
56-
<div key={reactionPath}>
57-
<span className={textStyles.hint}>
58-
<Icon>flask</Icon> {reactionPath}
59-
</span>
60-
</div>
61-
))}
6252
</div>
6353
) : null}
6454
</div>

packages/node_modules/overmind-devtools/src/components/ActionFlush/styles.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ export const flush = css`
44
flex: 1;
55
display: flex;
66
flex-direction: column;
7-
padding: 0 var(--padding-3);
7+
padding: 0 var(--padding-4);
88
cursor: pointer;
9-
border: 1px solid var(--color-black-1);
10-
background-color: #fff;
9+
border: 1px solid var(--color-dark-1);
10+
background-color: var(--color-dark-2);
1111
border-radius: var(--border-radius-1);
1212
`
1313

@@ -20,6 +20,6 @@ export const flushHeader = css`
2020
> *:last-child {
2121
margin-left: auto;
2222
margin-right: 0;
23-
color: var(--color-black-2);
23+
color: var(--color-white-2);
2424
}
2525
`

packages/node_modules/overmind-devtools/src/components/ActionOperator/index.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ const ActionOperator: Component<Props> = ({
4545
Boolean(operator.path.length) &&
4646
prevOperator.path.join('.') !== operator.path.join('.')
4747
}
48-
borderColor={operator.type === 'mutate' ? 'red' : 'primary'}
4948
>
5049
{operator.path.length ? (
5150
<span className={textStyles.hint}>
@@ -57,7 +56,7 @@ const ActionOperator: Component<Props> = ({
5756
className={css(
5857
styles.operator(
5958
operator.type === 'mutate'
60-
? 'var(--color-red)'
59+
? 'var(--color-purple)'
6160
: 'var(--color-primary)'
6261
),
6362
operator.mutations.length ||
@@ -73,19 +72,23 @@ const ActionOperator: Component<Props> = ({
7372
<span
7473
className={css(
7574
textStyles.normal,
76-
operator.type === 'mutate'
77-
? textStyles.red
78-
: textStyles.primary,
79-
textStyles.denseNormal
75+
textStyles.denseNormal,
76+
styles.operatorType
8077
)}
8178
>
8279
{operator.type}
8380
</span>
84-
<span className={css(textStyles.normal, textStyles.denseNormal)}>
81+
<span
82+
className={css(
83+
textStyles.white,
84+
textStyles.normal,
85+
textStyles.denseNormal
86+
)}
87+
>
8588
{operator.name}
8689
</span>
8790
{operator.mutations.length || operator.effects.length ? (
88-
<span className={textStyles.hint}>
91+
<span className={css(textStyles.hint, styles.chevron)}>
8992
{isExpanded ? (
9093
<Icon>chevron-down</Icon>
9194
) : (
@@ -101,7 +104,7 @@ const ActionOperator: Component<Props> = ({
101104
<span
102105
className={css(
103106
textStyles.description,
104-
textStyles.primary,
107+
textStyles.purple,
105108
textStyles.monospace
106109
)}
107110
>
@@ -129,7 +132,7 @@ const ActionOperator: Component<Props> = ({
129132
<span
130133
className={css(
131134
textStyles.description,
132-
textStyles.red,
135+
textStyles.yellow,
133136
textStyles.monospace
134137
)}
135138
>

packages/node_modules/overmind-devtools/src/components/ActionOperator/styles.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,25 @@ export const operator = (borderColor: string) => css`
44
flex: 1;
55
display: flex;
66
flex-direction: column;
7-
padding: 0 var(--padding-3);
7+
padding: 0 var(--padding-4);
88
cursor: default;
9-
border: 1px solid ${borderColor};
10-
background-color: #fff;
9+
border: 1px solid var(--color-dark-1);
10+
background-color: var(--color-dark-2);
1111
border-radius: var(--border-radius-1);
1212
`
1313

1414
export const operatorClickable = css`
1515
cursor: pointer;
1616
`
1717

18+
export const operatorType = css`
19+
color: var(--color-white-4);
20+
`
21+
22+
export const chevron = css`
23+
color: var(--color-white-4);
24+
`
25+
1826
export const notVisible = css`
1927
visibility: hidden;
2028
`
@@ -27,14 +35,14 @@ export const operatorHeader = css`
2735
}
2836
> *:nth-child(3) {
2937
margin-left: auto;
30-
color: var(--color-black-2);
38+
color: var(--color-white-2);
3139
}
3240
`
3341

3442
export const operatorItem = css`
3543
display: flex;
3644
align-items: center;
37-
margin-bottom: var(--padding-2);
45+
margin-bottom: var(--padding-3);
3846
> * {
3947
margin-right: 10px;
4048
}

0 commit comments

Comments
 (0)