Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit48cdf61

Browse files
committed
cp store to containers
1 parentbb58add commit48cdf61

File tree

43 files changed

+1349
-21
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1349
-21
lines changed

‎containers/AccountEditor/store.js‎

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* AccountEditorStore store
3+
*
4+
*/
5+
6+
import{typesast,getParent}from'mobx-state-tree'
7+
importRfrom'ramda'
8+
9+
import{markStates,makeDebugger,stripMobx}from'../../utils'
10+
import{User}from'../../stores/SharedModel'
11+
12+
/* eslint-disable no-unused-vars */
13+
constdebug=makeDebugger('S:AccountEditorStore')
14+
/* eslint-enable no-unused-vars */
15+
16+
constAccountEditorStore=t
17+
.model('AccountEditorStore',{
18+
user:t.optional(User,{}),
19+
updating:t.optional(t.boolean,false),
20+
success:t.optional(t.boolean,false),
21+
error:t.optional(t.boolean,false),
22+
warn:t.optional(t.boolean,false),
23+
statusMsg:t.optional(t.string,''),
24+
})
25+
.views(self=>({
26+
getroot(){
27+
returngetParent(self)
28+
},
29+
getstatusClean(){
30+
const{ success, error, warn}=self
31+
return!success&&!error&&!warn
32+
},
33+
getaccountInfo(){
34+
return{
35+
...stripMobx(self.user),
36+
}
37+
},
38+
getaccountOrigin(){
39+
returnself.root.account.accountInfo
40+
},
41+
}))
42+
.actions(self=>({
43+
copyAccountInfo(){
44+
const{ accountInfo}=self.root.account
45+
if(accountInfo!=={}){
46+
self.user=accountInfo
47+
}
48+
},
49+
50+
updateOrign(user){
51+
self.root.account.updateAccount(user)
52+
},
53+
54+
updateUser(sobj){
55+
constuser=R.merge(self.user,{ ...sobj})
56+
self.markState({ user})
57+
},
58+
59+
markState(sobj){
60+
markStates(sobj,self)
61+
},
62+
}))
63+
64+
exportdefaultAccountEditorStore
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* AccountEditorStore store test
3+
*
4+
*/
5+
6+
// import R from 'ramda'
7+
8+
// import AccountEditorStore from '../index'
9+
10+
it('TODO: test AccountEditorStore',()=>{
11+
expect(1+1).toBe(2)
12+
})

‎containers/AccountViewer/store.js‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* AccountViewerStore store
3+
*
4+
*/
5+
6+
import{typesast,getParent}from'mobx-state-tree'
7+
// import R from 'ramda'
8+
9+
import{markStates,makeDebugger}from'../../utils'
10+
/* eslint-disable no-unused-vars */
11+
constdebug=makeDebugger('S:AccountViewerStore')
12+
/* eslint-enable no-unused-vars */
13+
14+
constAccountViewerStore=t
15+
.model('AccountViewerStore',{})
16+
.views(self=>({
17+
getroot(){
18+
returngetParent(self)
19+
},
20+
getthemeKeys(){
21+
returnself.root.theme.themeKeys
22+
},
23+
getsubscribedCommunities(){
24+
returnself.root.account.subscribedCommunities
25+
},
26+
getaccountInfo(){
27+
returnself.root.account.accountInfo
28+
},
29+
getcurTheme(){
30+
returnself.root.theme.curTheme
31+
},
32+
}))
33+
.actions(self=>({
34+
logout(){
35+
self.root.account.logout()
36+
},
37+
changeTheme(name){
38+
self.root.changeTheme(name)
39+
},
40+
updateAccount(data){
41+
self.root.account.updateAccount(data)
42+
},
43+
markState(sobj){
44+
markStates(sobj,self)
45+
},
46+
}))
47+
48+
exportdefaultAccountViewerStore
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* AccountViewerStore store test
3+
*
4+
*/
5+
6+
// import R from 'ramda'
7+
8+
// import AccountViewerStore from '../index'
9+
10+
it('TODO: test AccountViewerStore',()=>{
11+
expect(1+1).toBe(2)
12+
})

‎containers/ArticleViwer/store.js‎

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* ArticleViwerStore store
3+
*
4+
*/
5+
6+
import{typesast,getParent}from'mobx-state-tree'
7+
importRfrom'ramda'
8+
9+
import{markStates,makeDebugger,TYPE}from'../../utils'
10+
/* eslint-disable no-unused-vars */
11+
constdebug=makeDebugger('S:ArticleViwerStore')
12+
/* eslint-enable no-unused-vars */
13+
14+
constPost=t.model('Post',{
15+
id:t.optional(t.string,''),
16+
title:t.optional(t.string,''),
17+
body:t.optional(t.string,''),
18+
digest:t.optional(t.string,''),
19+
views:t.optional(t.number,0),
20+
// author: Author,
21+
tags:t.optional(t.string,''),// TODO: ArrayOf Tag
22+
comments:t.optional(t.string,''),// TODO: ArrayOf comments
23+
favoritedCount:t.optional(t.number,0),
24+
starredCount:t.optional(t.number,0),
25+
viewerHasFavorited:t.optional(t.boolean,false),
26+
viewerHasStarred:t.optional(t.boolean,false),
27+
insertedAt:t.optional(t.string,''),
28+
updatedAt:t.optional(t.string,''),
29+
})
30+
31+
constArticleViwerStore=t
32+
.model('ArticleViwerStore',{
33+
type:t.optional(
34+
t.enumeration('type',[
35+
TYPE.POST,
36+
TYPE.JOB,
37+
// ...
38+
]),
39+
TYPE.POST
40+
),
41+
post:t.optional(Post,{}),
42+
postLoading:t.optional(t.boolean,false),
43+
})
44+
.views(self=>({
45+
getroot(){
46+
returngetParent(self)
47+
},
48+
getcurPost(){
49+
returnself.post.toJSON()
50+
},
51+
}))
52+
.actions(self=>({
53+
load(upperType,data){
54+
consttype=R.toLower(upperType)
55+
self.markState({
56+
type:upperType,
57+
[type]:R.merge(self[type],data),
58+
})
59+
},
60+
markState(sobj){
61+
markStates(sobj,self)
62+
},
63+
}))
64+
65+
exportdefaultArticleViwerStore
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* ArticleViwerStore store test
3+
*
4+
*/
5+
6+
// import R from 'ramda'
7+
8+
// import ArticleViwerStore from '../index'
9+
10+
it('TODO: test ArticleViwerStore',()=>{
11+
expect(1+1).toBe(2)
12+
})

‎containers/Banner/store.js‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* BannerStore store
3+
*
4+
*/
5+
6+
import{typesast,getParent}from'mobx-state-tree'
7+
// import R from 'ramda'
8+
9+
import{markStates,makeDebugger}from'../../utils'
10+
/* eslint-disable no-unused-vars */
11+
constdebug=makeDebugger('S:BannerStore')
12+
/* eslint-enable no-unused-vars */
13+
14+
constBannerStore=t
15+
.model('BannerStore',{})
16+
.views(self=>({
17+
getroot(){
18+
returngetParent(self)
19+
},
20+
getcurRoute(){
21+
returnself.root.curRoute
22+
},
23+
}))
24+
.actions(self=>({
25+
markState(sobj){
26+
markStates(sobj,self)
27+
},
28+
loadCurCommunity(data){
29+
self.root.curCommunity.load(data)
30+
},
31+
}))
32+
33+
exportdefaultBannerStore
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* BannerStore store test
3+
*
4+
*/
5+
6+
// import R from 'ramda'
7+
// import BannerStore from '../index'
8+
9+
it('BannerStore 1 + 1 = 2',()=>{
10+
expect(1+1).toBe(2)
11+
})

‎containers/CategoryEditor/store.js‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* CategoryEditorStore store
3+
*
4+
*/
5+
6+
import{typesast,getParent}from'mobx-state-tree'
7+
importRfrom'ramda'
8+
9+
import{Category}from'../../stores/SharedModel'
10+
import{markStates,makeDebugger,stripMobx}from'../../utils'
11+
/* eslint-disable no-unused-vars */
12+
constdebug=makeDebugger('S:CategoryEditorStore')
13+
/* eslint-enable no-unused-vars */
14+
15+
constCategoryEditorStore=t
16+
.model('CategoryEditorStore',{
17+
category:t.optional(Category,{}),
18+
isEdit:t.optional(t.boolean,false),
19+
20+
// statusBox
21+
success:t.optional(t.boolean,false),
22+
error:t.optional(t.boolean,false),
23+
warn:t.optional(t.boolean,false),
24+
statusMsg:t.optional(t.string,''),
25+
})
26+
.views(self=>({
27+
getroot(){
28+
returngetParent(self)
29+
},
30+
getcategoryData(){
31+
returnstripMobx(self.category)
32+
},
33+
}))
34+
.actions(self=>({
35+
updateCategory(sobj){
36+
constcategory=R.merge(self.category,{ ...sobj})
37+
self.markState({ category})
38+
},
39+
markState(sobj){
40+
markStates(sobj,self)
41+
},
42+
}))
43+
44+
exportdefaultCategoryEditorStore
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* CategoryEditorStore store test
3+
*
4+
*/
5+
6+
// import R from 'ramda'
7+
8+
// import CategoryEditorStore from '../index'
9+
10+
it('TODO: test CategoryEditorStore',()=>{
11+
expect(1+1).toBe(2)
12+
})

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp