Skip to content

Commit f47a850

Browse files
fix(website): force bump for initial release
1 parent ac0be85 commit f47a850

File tree

4 files changed

+290
-0
lines changed

4 files changed

+290
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
export default (ts) =>
2+
ts
3+
? [
4+
{
5+
fileName: 'app/actions.ts',
6+
code: `
7+
import { Action } from 'overmind'
8+
import * as mutations from './mutations'
9+
import * as operations from './operations'
10+
11+
...
12+
13+
export const showUser: Action<string> = action =>
14+
action()
15+
.compose(showUsersPage) // <-- WE ADD COMPOSE
16+
.mutate(mutations.setModalUserId)
17+
.mutate(mutations.setLoadingUserWithDetails(true))
18+
.map(operations.getUserWithDetails)
19+
.mutate(mutations.updateUserWithDetails)
20+
.mutate(mutations.setLoadingUserWithDetails(false))
21+
22+
...
23+
`,
24+
},
25+
]
26+
: [
27+
{
28+
fileName: 'app/actions.js',
29+
code: `
30+
import * as mutations from './mutations'
31+
import * as operations from './operations'
32+
33+
...
34+
35+
export const showUser = action =>
36+
action()
37+
.compose(showUsersPage) // <-- WE ADD COMPOSE
38+
.mutate(mutations.setModalUserId)
39+
.mutate(mutations.setLoadingUserWithDetails(true))
40+
.map(operations.getUserWithDetails)
41+
.mutate(mutations.updateUserWithDetails)
42+
.mutate(mutations.setLoadingUserWithDetails(false))
43+
44+
...
45+
`,
46+
},
47+
]
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
export default (ts) =>
2+
ts
3+
? [
4+
{
5+
fileName: 'app/actions.ts',
6+
code: `
7+
import { Action } from 'overmind'
8+
import * as mutations from './mutations'
9+
import * as operations from './operations'
10+
11+
...
12+
13+
export const showUsersPage: Action<any> = action =>
14+
action()
15+
.mutate(mutations.unsetModalUserId)
16+
.mutate(mutations.setPage('users'))
17+
.mutate(mutations.setLoadingUsers(true))
18+
.map(operations.getUsers)
19+
.mutate(mutations.setUsers)
20+
.mutate(mutations.setLoadingUsers(false))
21+
22+
const getUserWithDetails: Action<string> = action =>
23+
action()
24+
.mutate(mutations.setModalUserId)
25+
.mutate(mutations.setLoadingUserWithDetails(true))
26+
.map(operations.getUserWithDetails)
27+
.mutate(mutations.updateUserWithDetails)
28+
.mutate(mutations.setLoadingUserWithDetails(false))
29+
30+
export const showUser: Action<string> = action =>
31+
action()
32+
.parallel([
33+
showUsersPage,
34+
getUserWithDetails
35+
])
36+
37+
...
38+
`,
39+
},
40+
]
41+
: [
42+
{
43+
fileName: 'app/actions.js',
44+
code: `
45+
import * as mutations from './mutations'
46+
import * as operations from './operations'
47+
48+
...
49+
50+
export const showUsersPage = action =>
51+
action()
52+
.mutate(mutations.unsetModalUserId)
53+
.mutate(mutations.setPage('users'))
54+
.mutate(mutations.setLoadingUsers(true))
55+
.map(operations.getUsers)
56+
.mutate(mutations.setUsers)
57+
.mutate(mutations.setLoadingUsers(false))
58+
59+
const getUserWithDetails = action =>
60+
action()
61+
.mutate(mutations.setModalUserId)
62+
.mutate(mutations.setLoadingUserWithDetails(true))
63+
.map(operations.getUserWithDetails)
64+
.mutate(mutations.updateUserWithDetails)
65+
.mutate(mutations.setLoadingUserWithDetails(false))
66+
67+
export const showUser = action =>
68+
action()
69+
.parallel([
70+
showUsersPage,
71+
getUserWithDetails
72+
])
73+
74+
...
75+
`,
76+
},
77+
]
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
export default (ts, view) =>
2+
ts
3+
? [
4+
{
5+
fileName: 'app/index.ts',
6+
code: `
7+
import App, { TConnect } from 'overmind-${view}'
8+
import queryString from 'query-string'
9+
import * as page from 'page'
10+
import * as state from './state'
11+
import * as actions from './actions'
12+
import * as effects from './effects'
13+
14+
...
15+
16+
const app = new App(config)
17+
18+
function parseQuery (action) {
19+
return (context) {
20+
action({
21+
params: context.params,
22+
query: queryString.parse(context.querystring)
23+
})
24+
}
25+
}
26+
27+
page('/', parseQuery(app.actions.showHomePage))
28+
page('/users', parseQuery(app.actions.showUsersPage))
29+
page('/users/:id', parseQuery(app.actions.showUserModal))
30+
31+
...
32+
`,
33+
},
34+
]
35+
: [
36+
{
37+
fileName: 'app/index.js',
38+
code: `
39+
import App from 'overmind-${view}'
40+
import queryString from 'query-string'
41+
import page from 'page'
42+
import * as state from './state'
43+
import * as actions from './actions'
44+
import * as effects from './effects'
45+
46+
const app = new App({
47+
state,
48+
actions,
49+
effects
50+
})
51+
52+
function parseQuery (action) {
53+
return (context) {
54+
action({
55+
params: context.params,
56+
query: queryString.parse(context.querystring)
57+
})
58+
}
59+
}
60+
61+
page('/', parseQuery(app.actions.showHomePage))
62+
page('/users', parseQuery(app.actions.showUsersPage))
63+
page('/users/:id', parseQuery(app.actions.showUserModal))
64+
65+
...
66+
`,
67+
},
68+
]
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
const javascript = {
2+
react: [
3+
{
4+
fileName: 'components/App.js',
5+
target: 'jsx',
6+
code: `
7+
import React from 'react'
8+
import app from '../app'
9+
import Users from './Users'
10+
11+
const App = ({ app }) => (
12+
<div class="container">
13+
<nav>
14+
<a href="/">Home</a>
15+
<a href="/users">Users</a>
16+
</nav>
17+
{app.state.currentPage === 'home' ? <h1>Hello world!</h1> : null}
18+
{app.state.currentPage === 'users' ? <Users /> : null}
19+
</div>
20+
)
21+
22+
export default app.connect(App)
23+
`,
24+
},
25+
{
26+
fileName: 'components/Users.js',
27+
target: 'jsx',
28+
code: `
29+
import React from 'react'
30+
import app from '../app'
31+
import UserModal from './UserModal'
32+
33+
const Users = ({ app }) => (
34+
<div class="content">
35+
{app.state.isLoadingUsers ? (
36+
<h4>Loading users...</h4>
37+
) : (
38+
<ul>
39+
{app.state.users.map(user => (
40+
<li key={user.id}>
41+
<a href={"/users/" + user.id}>{user.name}</a>
42+
</li>
43+
))}
44+
</ul>
45+
)}
46+
{app.state.modalUser ? <UserModal /> : null}
47+
</div>
48+
)
49+
50+
export default app.connect(Users)
51+
`,
52+
},
53+
{
54+
fileName: 'components/UserModal.js',
55+
target: 'jsx',
56+
code: `
57+
import React from 'react'
58+
import app from '../app'
59+
60+
const UserModal = ({ app }) => {
61+
const modalUser = app.state.modalUser
62+
const currentUserModalTabIndex = app.state.currentUserModalTabIndex
63+
64+
return (
65+
<a href="/users" class="backdrop">
66+
<div class="modal">
67+
{app.state.isLoadingUserDetails ? (
68+
<h4>Loading user details...</h4>
69+
) : (
70+
<>
71+
<h4>{modalUser.name}</h4>
72+
<h6>{modalUser.details.email}</h6>
73+
<nav>
74+
<a href={"/users/" + modalUser.id + "?tab=0"}>bio</a>
75+
<a href={"/users/" + modalUser.id + "?tab=1"}>address</a>
76+
</nav>
77+
{currentUserModalTabIndex === 0 ? (
78+
<div class="tab-content">{modalUser.details.bio}</div>
79+
) : null}
80+
{currentUserModalTabIndex === 1 ? (
81+
<div class="tab-content">{modalUser.details.address}</div>
82+
) : null}
83+
</>
84+
)}
85+
</div>
86+
</a>
87+
)
88+
}
89+
90+
export default app.connect(UserModal)
91+
`,
92+
},
93+
],
94+
}
95+
96+
const typescript = {}
97+
98+
export default (ts, view) => (ts ? typescript[view] : javascript[view])

0 commit comments

Comments
 (0)