Skip to content

Commit eb424af

Browse files
docs(website): update with latest devtool experience
1 parent 3654382 commit eb424af

File tree

33 files changed

+261
-220
lines changed

33 files changed

+261
-220
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# react-overmind
1+
# overmind-angular
22

3-
To be filled
3+
[https://overmindjs.org](https://overmindjs.org)

packages/node_modules/overmind-devtools-vscode/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
"displayName": "Overmind Devtools VSCode",
44
"description": "Devtools for Overmind",
55
"publisher": "christianalfoni",
6-
"version": "0.0.10",
6+
"version": "0.0.11",
7+
"repository": {
8+
"type" : "git",
9+
"url" : "https://github.com/cerebral/overmind.git"
10+
},
711
"engines": {
812
"vscode": "^1.35.0"
913
},
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# react-overmind
1+
# overmind-react
22

3-
To be filled
3+
[https://overmindjs.org](https://overmindjs.org)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# react-overmind
1+
# overmind-vue
22

3-
To be filled
3+
[https://overmindjs.org](https://overmindjs.org)
Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,45 @@
1-
export default () => [
2-
{
3-
code: `
4-
const posts = state.userPosts(userId)
1+
export default (ts) =>
2+
ts
3+
? [
4+
{
5+
fileName: 'overmind/state.ts',
6+
code: `
7+
import { Derive } from 'overmind'
8+
9+
export type State = {
10+
counts: {
11+
[id: string]: number
12+
}
13+
totalCountBy: Derive<State, (ids: string[]) => number>
14+
}
15+
16+
export const state: State = {
17+
counts: {
18+
a: 2,
19+
b: 3,
20+
c: 5
21+
},
22+
totalCountBy: state => ids => ids.reduce((aggr, id) => aggr + state.counts[id], 0)
23+
}
24+
25+
// state.totalCountBy(['a', 'b'])
526
`,
27+
},
28+
]
29+
: [
30+
{
31+
fileName: 'overmind/state.js',
32+
code: `
33+
export const state = {
34+
counts: {
35+
a: 2,
36+
b: 3,
37+
c: 5
638
},
7-
]
39+
totalCountBy: state => ids => ids.reduce((aggr, id) => aggr + state.counts[id], 0)
40+
}
41+
42+
// state.totalCountBy(['a', 'b'])
43+
`,
44+
},
45+
]

packages/overmind-website/examples/guide/definingstate/objects.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,21 @@ export default () => [
22
{
33
code: `
44
{
5+
modes: ['issues', 'admin'],
6+
currentModeIndex: 0,
57
admin: {
6-
users: {},
7-
isLoadingUsers: false
8-
},
9-
home: {
10-
tabs: ['issues', 'admin'],
11-
currentTabIndex: 0
8+
currentUserId: null,
9+
users: {
10+
isLoading: false,
11+
data: {},
12+
error: null
13+
},
1214
},
1315
issues: {
1416
sortBy: 'name',
15-
list: []
17+
isLoading: false,
18+
data: {},
19+
error: null
1620
}
1721
}
1822
`,

packages/overmind-website/examples/guide/definingstate/strings.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@ export default () => [
22
{
33
code: `
44
{
5-
...
6-
home: {
7-
tabs: {
8-
issues: 0,
9-
admin: 1
10-
},
11-
currentTab: 'issues'
5+
modes: {
6+
issues: 0,
7+
admin: 1
128
},
9+
currentMode: 'issues'
1310
...
1411
}
1512
`,

packages/overmind-website/examples/guide/getstarted/changestate.ts

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ export default (ts) =>
88
code: `
99
import { Action } from 'overmind'
1010
11-
export const changeCount: Action<number> = ({ state }, countChange) => {
12-
state.count += countChange
11+
export const increaseCount: Action = ({ state }) => {
12+
state.count += 1
13+
}
14+
15+
export const decreaseCount: Action = ({ state }) => {
16+
state.count -= 1
1317
}
1418
`,
1519
},
@@ -29,18 +33,27 @@ export const config = {
2933
},
3034
]
3135
: [
36+
{
37+
fileName: 'overmind/actions.js',
38+
code: `
39+
export const increaseCount = ({ state }) => {
40+
state.count += 1
41+
}
42+
43+
export const decreaseCount = ({ state }) => {
44+
state.count -= 1
45+
}
46+
`,
47+
},
3248
{
3349
fileName: 'overmind/index.js',
3450
code: `
51+
import { state } from './state'
52+
import * as actions from './actions'
53+
3554
export const config = {
36-
state: {
37-
count: 0
38-
},
39-
actions: {
40-
changeCount({ state }, countChange) {
41-
state.count += countChange
42-
}
43-
}
55+
state,
56+
actions
4457
}
4558
`,
4659
},

packages/overmind-website/examples/guide/getstarted/connectapp.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
const javascript = {
22
react: [
33
{
4-
fileName: 'overmind/index.ts',
4+
fileName: 'overmind/index.js',
55
code: `
66
import { createHook } from 'overmind-react'
77
import { state } from './state'
88
import * as actions from './actions'
99
import * as effects from './effects'
1010
11-
const config = {
11+
export const config = {
1212
state,
1313
actions,
1414
effects
@@ -48,9 +48,9 @@ const Count = () => {
4848
4949
return (
5050
<div>
51-
<button onClick={() => actions.changeCount(-1)}>-1</button>
51+
<button onClick={() => actions.decreaseCount()}>-</button>
5252
{state.count}
53-
<button onClick={() => actions.changeCount(1)}>+1</button>
53+
<button onClick={() => actions.increaseCount()}>+</button>
5454
</div>
5555
)
5656
}
@@ -86,9 +86,9 @@ new Vue({
8686
target: 'markup',
8787
code: `
8888
<div>
89-
<button @click="actions.changeCount(-1)">-1</button>
89+
<button @click="actions.decreaseCount()">-</button>
9090
{{ state.count }}
91-
<button @click="actions.changeCount(1)">+1</button>
91+
<button @click="actions.increaseCount()">+</button>
9292
</div>
9393
`,
9494
},
@@ -149,9 +149,9 @@ const Count: React.FunctionComponent = () => {
149149
150150
return (
151151
<div>
152-
<button onClick={() => actions.changeCount(-1)}>-1</button>
152+
<button onClick={() => actions.decreaseCount()}>-</button>
153153
{state.count}
154-
<button onClick={() => actions.changeCount(1)}>+1</button>
154+
<button onClick={() => actions.increaseCount()}>+</button>
155155
</div>
156156
)
157157
}
@@ -215,9 +215,9 @@ import { Store } from '../overmind'
215215
selector: 'count-component',
216216
template: \`
217217
<div *track>
218-
<button (click)="actions.changeCount(-1)">-1</button>
218+
<button (click)="actions.decreaseCount()">-</button>
219219
{{ state.count }}
220-
<button (click)="actions.changeCount(1)">+1</button>
220+
<button (click)="actions.increaseCount()">+</button>
221221
</div>
222222
\`
223223
})

packages/overmind-website/examples/guide/getstarted/createapp.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,22 @@ const overmind = createOvermind(config)
3838
},
3939
]
4040
: [
41+
{
42+
fileName: 'overmind/state.js',
43+
code: `
44+
export const state = {
45+
count: 0
46+
}
47+
`,
48+
},
4149
{
4250
fileName: 'overmind/index.js',
4351
code: `
52+
import { state } from './state'
53+
4454
export const config = {
45-
state: {
46-
count: 0
47-
}
48-
})
55+
state
56+
}
4957
`,
5058
},
5159
{

0 commit comments

Comments
 (0)