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

Commit37e2e70

Browse files
committed
move store out of reducers into actions, material-ui@0.15
1 parent9c18bfe commit37e2e70

File tree

48 files changed

+110
-224
lines changed

Some content is hidden

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

48 files changed

+110
-224
lines changed

‎lib/actions/alert.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ function alertToggle(alert) {
1313
else{
1414
alert=Object.assign({},{open:!isOpen},alert);
1515
}
16-
return{
17-
payload:{alert:alert},
18-
type:_types_1.ALERT_TOGGLE,
19-
};
16+
return{type:_types_1.ALERT_TOGGLE,payload:{alert:alert}};
2017
}
2118
exports.alertToggle=alertToggle;
2219
functionalertReplay(){

‎lib/actions/hint.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
"use strict";
22
var_types_1=require('./_types');
33
functionhintPositionSet(hintPosition){
4-
return{
5-
payload:{hintPosition:hintPosition},
6-
type:_types_1.HINT_POSITION_SET,
7-
};
4+
return{type:_types_1.HINT_POSITION_SET,payload:{hintPosition:hintPosition}};
85
}
96
exports.hintPositionSet=hintPositionSet;
107
functionhintShow(){

‎lib/actions/package.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"use strict";
22
var_types_1=require('./_types');
3+
varstore_1=require('../store');
34
functionpackageSet(){
4-
return{type:_types_1.PACKAGE_SET};
5+
vardir=store_1.default.getState().dir;
6+
return{type:_types_1.PACKAGE_SET,payload:{dir:dir}};
57
}
68
exports.packageSet=packageSet;

‎lib/actions/page.js

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,33 @@ function pageNext() {
66
varpagePosition=store_1.default.getState().pagePosition;
77
varpages=store_1.default.getState().tutorial.pages;
88
if(pagePosition>=pages.length-1){
9-
return{
10-
payload:{route:'final'},
11-
type:_types_1.ROUTE_SET,
12-
};
9+
return{type:_types_1.ROUTE_SET,payload:{route:'final'}};
1310
}
1411
else{
1512
pagePosition=pagePosition+1;
1613
setTimeout(function(){returnstore_1.default.dispatch(test_1.testsLoad(pagePosition));});
17-
return{
18-
payload:{pagePosition:pagePosition},
19-
type:_types_1.PAGE_SET,
20-
};
14+
return{type:_types_1.PAGE_SET,payload:{pagePosition:pagePosition}};
2115
}
2216
}
2317
exports.pageNext=pageNext;
2418
functionpageSet(pagePosition){
2519
if(pagePosition===void0){pagePosition=0;}
26-
if(pagePosition>=store_1.default.getState().progress.pages.length){
20+
var_a=store_1.default.getState(),progress=_a.progress,tutorial=_a.tutorial;
21+
if(pagePosition>=progress.pages.length){
2722
return{
2823
payload:{route:'final'},
2924
type:_types_1.ROUTE_SET,
3025
};
3126
}
32-
return{
33-
payload:{pagePosition:pagePosition},
34-
type:_types_1.PAGE_SET,
35-
};
27+
return{type:_types_1.PAGE_SET,payload:{pagePosition:pagePosition,tutorial:tutorial}};
3628
}
3729
exports.pageSet=pageSet;
3830
functionpagePositionLoad(){
39-
return{type:_types_1.PAGE_POSITION_LOAD};
31+
varprogress=store_1.default.getState().progress;
32+
return{type:_types_1.PAGE_POSITION_LOAD,payload:{progress:progress}};
4033
}
4134
exports.pagePositionLoad=pagePositionLoad;
4235
functionpagePositionSet(pagePosition){
43-
return{
44-
payload:{pagePosition:pagePosition},
45-
type:_types_1.PAGE_POSITION_SET,
46-
};
36+
return{type:_types_1.PAGE_POSITION_SET,payload:{pagePosition:pagePosition}};
4737
}
4838
exports.pagePositionSet=pagePositionSet;

‎lib/actions/progress.js

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,17 @@ var _types_1 = require('./_types');
33
varpage_1=require('./page');
44
varstore_1=require('../store');
55
functionprogressLoad(){
6-
setTimeout(function(){
7-
store_1.default.dispatch(page_1.pagePositionLoad());
8-
});
9-
return{type:_types_1.PROGRESS_LOAD};
6+
setTimeout(function(){returnstore_1.default.dispatch(page_1.pagePositionLoad());});
7+
vartutorial=store_1.default.getState().tutorial;
8+
return{type:_types_1.PROGRESS_LOAD,payload:{tutorial:tutorial}};
109
}
1110
exports.progressLoad=progressLoad;
12-
functionisTrue(x){
13-
returnx===true;
14-
}
1511
functioncompletePage(){
16-
varpagePosition=store_1.default.getState().pagePosition;
17-
varprogress=store_1.default.getState().progress;
12+
var_a=store_1.default.getState(),pagePosition=_a.pagePosition,progress=_a.progress;
1813
if(progress.pages.every(function(x){returnx.completed;})){
1914
store_1.default.dispatch(completeTutorial());
2015
}
21-
return{
22-
payload:{pagePosition:pagePosition},
23-
type:_types_1.COMPLETE_PAGE,
24-
};
16+
return{type:_types_1.COMPLETE_PAGE,payload:{pagePosition:pagePosition}};
2517
}
2618
exports.completePage=completePage;
2719
functioncompleteTutorial(){

‎lib/actions/route.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ function routeSet(route) {
1010
store_1.default.dispatch(tutorial_1.tutorialsFind());
1111
}
1212
previous=route;
13-
return{
14-
payload:{route:route},
15-
type:_types_1.ROUTE_SET,
16-
};
13+
return{type:_types_1.ROUTE_SET,payload:{route:route}};
1714
}
1815
}
1916
exports.routeSet=routeSet;

‎lib/actions/test.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ function testRun() {
77
exports.testRun=testRun;
88
functiontestResult(result){
99
varactions=store_1.default.getState().taskActions;
10-
return{
11-
payload:{result:result,actions:actions},
12-
type:_types_1.TEST_RESULT,
13-
};
10+
return{type:_types_1.TEST_RESULT,payload:{result:result,actions:actions}};
1411
}
1512
exports.testResult=testResult;
1613
functiontestComplete(){
@@ -22,6 +19,7 @@ function testSave() {
2219
}
2320
exports.testSave=testSave;
2421
functiontestsLoad(pagePosition){
25-
return{type:_types_1.TESTS_LOAD,payload:{pagePosition:pagePosition}};
22+
var_a=store_1.default.getState(),tasks=_a.tasks,progress=_a.progress;
23+
return{type:_types_1.TESTS_LOAD,payload:{pagePosition:pagePosition,tasks:tasks,progress:progress}};
2624
}
2725
exports.testsLoad=testsLoad;

‎lib/actions/tutorial.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
"use strict";
22
var_types_1=require('./_types');
3+
varstore_1=require('../store');
34
functiontutorialSet(name){
4-
return{
5-
payload:{name:name},
6-
type:_types_1.TUTORIAL_SET,
7-
};
5+
vardir=store_1.default.getState().dir;
6+
return{type:_types_1.TUTORIAL_SET,payload:{name:name,dir:dir}};
87
}
98
exports.tutorialSet=tutorialSet;
109
functiontutorialUpdate(name){
1110
return{type:_types_1.TUTORIAL_UPDATE,payload:{name:name}};
1211
}
1312
exports.tutorialUpdate=tutorialUpdate;
1413
functiontutorialsFind(){
15-
return{type:_types_1.TUTORIALS_FIND};
14+
var_a=store_1.default.getState(),packageJson=_a.packageJson,dir=_a.dir;
15+
return{type:_types_1.TUTORIALS_FIND,payload:{packageJson:packageJson,dir:dir}};
1616
}
1717
exports.tutorialsFind=tutorialsFind;

‎lib/actions/window.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

‎lib/components/Progress/progressIcon.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ var check_box_1 = require('material-ui/svg-icons/toggle/check-box');
55
varplay_circle_filled_1=require('material-ui/svg-icons/av/play-circle-filled');
66
varcheck_box_outline_blank_1=require('material-ui/svg-icons/toggle/check-box-outline-blank');
77
functionprogressIcon(pages,index,pagePosition){
8-
console.log(index,pagePosition);
98
switch(true){
109
casepages[pagePosition]:
1110
returnReact.createElement(check_box_1.default,{style:{fill:colors_1.green300}});

‎lib/components/index.js

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +0,0 @@
1-
"use strict";
2-
varAlert_1=require('./Alert');
3-
exports.Alert=Alert_1.default;
4-
varAppMenu_1=require('./AppMenu');
5-
exports.AppMenu=AppMenu_1.default;
6-
varFinalPage_1=require('./FinalPage');
7-
exports.FinalPage=FinalPage_1.default;
8-
varPage_1=require('./Page');
9-
exports.Page=Page_1.default;
10-
varProgress_1=require('./Progress');
11-
exports.Progress=Progress_1.default;
12-
varRoutes_1=require('./Routes');
13-
exports.Routes=Routes_1.default;
14-
varStart_1=require('./Start');
15-
exports.Start=Start_1.default;
16-
varTutorials_1=require('./Tutorials');
17-
exports.Tutorials=Tutorials_1.default;
18-
varMarkdown_1=require('./common/Markdown');
19-
exports.Markdown=Markdown_1.default;
20-
varRouteButton_1=require('./common/RouteButton');
21-
exports.RouteButton=RouteButton_1.default;
22-
varContentCard_1=require('./common/ContentCard');
23-
exports.ContentCard=ContentCard_1.default;

‎lib/reducers/package-json/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ var _types_1 = require('../../actions/_types');
33
varpath_1=require('path');
44
varfs_1=require('fs');
55
varexists_1=require('../../services/exists');
6-
varstore_1=require('../../store');
76
functionpackageJsonReducer(pj,action){
87
if(pj===void0){pj=null;}
98
switch(action.type){
109
case_types_1.PACKAGE_SET:
11-
vardir=store_1.default.getState().dir;
12-
varpathToPackageJson=path_1.join(dir,'package.json');
10+
varpathToPackageJson=path_1.join(action.payload.dir,'package.json');
1311
if(exists_1.fileExists(pathToPackageJson)){
1412
returnJSON.parse(fs_1.readFileSync(pathToPackageJson,'utf8'));
1513
}

‎lib/reducers/page-position/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
"use strict";
22
var_types_1=require('../../actions/_types');
3-
varstore_1=require('../../store');
43
functionpagePositionReducer(pagePosition,action){
54
if(pagePosition===void0){pagePosition=0;}
65
switch(action.type){
76
case_types_1.PAGE_POSITION_LOAD:
8-
varpages=store_1.default.getState().progress.pages;
7+
varpages=action.payload.progress.pages;
98
varfirstFail=pages.indexOf(false);
109
returnfirstFail<0 ?pages.length-1 :firstFail;
1110
case_types_1.PAGE_SET:

‎lib/reducers/page/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"use strict";
22
var_types_1=require('../../actions/_types');
3-
varstore_1=require('../../store');
43
vareditor_1=require('../../atom/editor');
54
var_page={
65
title:'',
@@ -12,7 +11,7 @@ function pageReducer(p, action) {
1211
switch(action.type){
1312
case_types_1.PAGE_SET:
1413
varpagePosition=action.payload.pagePosition;
15-
var_a=store_1.default.getState().tutorial.pages[pagePosition],title=_a.title,description=_a.description,onPageComplete=_a.onPageComplete,completed=_a.completed;
14+
var_a=action.payload.tutorial.pages[pagePosition],title=_a.title,description=_a.description,onPageComplete=_a.onPageComplete,completed=_a.completed;
1615
editor_1.clearConsole();
1716
return{
1817
title:title,

‎lib/reducers/progress/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"use strict";
22
var_types_1=require('../../actions/_types');
33
varlocal_storage_1=require('./local-storage');
4-
varstore_1=require('../../store');
54
var_progress={
65
completed:false,
76
pages:[]
@@ -16,7 +15,7 @@ function progressReducer(progress, action) {
1615
}
1716
return{
1817
completed:false,
19-
pages:store_1.default.getState().tutorial.pages.map(function(){returnfalse;})
18+
pages:action.payload.tutorial.pages.map(function(){returnfalse;})
2019
};
2120
case_types_1.COMPLETE_PAGE:
2221
varpagePosition=action.payload.pagePosition;

‎lib/reducers/task-actions/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"use strict";
22
var_types_1=require('../../actions/_types');
33
vareditor_reducer_1=require('./editor-reducer');
4-
varstore_1=require('../../store');
54
functionhandleTaskActions(actions){
65
varnext=actions.shift();
76
if(next&&next.length){
@@ -16,9 +15,8 @@ function taskActionsReducer(taskActions, action) {
1615
varactions=null;
1716
switch(action.type){
1817
case_types_1.TESTS_LOAD:
19-
vartasks=store_1.default.getState().tasks||[];
20-
varpagePosition=store_1.default.getState().pagePosition;
21-
varisCompleted=store_1.default.getState().progress.pages[pagePosition];
18+
var_a=action.payload,tasks=_a.tasks,pagePosition=_a.pagePosition,progress=_a.progress;
19+
varisCompleted=progress.pages[pagePosition];
2220
if(!isCompleted){
2321
actions=tasks.map(function(task){returntask.actions||[];});
2422
}

‎lib/reducers/task-tests/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
"use strict";
22
varfs_1=require('fs');
33
var_types_1=require('../../actions/_types');
4-
varstore_1=require('../../store');
54
functiontaskTestsReducer(taskTests,action){
65
if(taskTests===void0){taskTests='';}
76
switch(action.type){
87
case_types_1.TESTS_LOAD:
9-
return[].concat.apply([],store_1.default.getState().tasks.map(function(task){returntask.tests||[];})).reduce(function(output,file){
8+
return[].concat.apply([],action.payload.tasks.map(function(task){returntask.tests||[];})).reduce(function(output,file){
109
try{
1110
output+=fs_1.readFileSync(file,'utf8')+'\n';
1211
}

‎lib/reducers/tasks/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"use strict";
22
var_types_1=require('../../actions/_types');
3-
varstore_1=require('../../store');
43
varconfig_task_tests_1=require('../task-tests/config-task-tests');
54
var_tasks=[{
65
actions:[],
@@ -13,8 +12,8 @@ function tasksReducer(tasks, action) {
1312
if(tasks===void0){tasks=_tasks;}
1413
switch(action.type){
1514
case_types_1.PAGE_SET:
16-
varpagePosition=action.payload.pagePosition;
17-
returnconfig_task_tests_1.default(store_1.default.getState().tutorial.pages[pagePosition].tasks||[]);
15+
var_a=action.payload,tutorial=_a.tutorial,pagePosition=_a.pagePosition;
16+
returnconfig_task_tests_1.default(tutorial.pages[pagePosition].tasks||[]);
1817
default:
1918
returntasks;
2019
}

‎lib/reducers/tutorial-list/check.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@ var path_1 = require('path');
33
varfs_1=require('fs');
44
varexists_1=require('../../services/exists');
55
varis_tutorial_1=require('./is-tutorial');
6-
varstore_1=require('../../store');
76
varupdate_1=require('./update');
8-
functionsearchForTutorials(deps){
7+
functionsearchForTutorials(dir,deps){
98
if(!!deps&&Object.keys(deps).length>0){
10-
vardir_1=store_1.default.getState().dir;
119
return(Object.keys(deps)
12-
.filter(function(name){returnis_tutorial_1.isTutorial(name);})
10+
.filter(function(name){returnis_tutorial_1.isTutorial(dir,name);})
1311
.map(function(name){
14-
varpathToTutorialPackageJson=path_1.join(dir_1,'node_modules',name,'package.json');
12+
varpathToTutorialPackageJson=path_1.join(dir,'node_modules',name,'package.json');
1513
if(!exists_1.fileExists(pathToTutorialPackageJson)){
1614
console.log("Error with "+name+": no package.json file found. "+is_tutorial_1.tutorialError);
1715
return{

‎lib/reducers/tutorial-list/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
"use strict";
22
var_types_1=require('../../actions/_types');
3-
varstore_1=require('../../store');
43
varcheck_1=require('./check');
54
functiontutorialListReducer(tutorialList,action){
65
if(tutorialList===void0){tutorialList=[];}
76
switch(action.type){
87
case_types_1.TUTORIALS_FIND:
9-
varpackageJson=store_1.default.getState().packageJson;
8+
var_a=action.payload,packageJson=_a.packageJson,dir=_a.dir;
109
return([]
11-
.concat(check_1.searchForTutorials(packageJson.dependencies))
12-
.concat(check_1.searchForTutorials(packageJson.devDependencies)));
10+
.concat(check_1.searchForTutorials(dir,packageJson.dependencies))
11+
.concat(check_1.searchForTutorials(dir,packageJson.devDependencies)));
1312
default:
1413
returntutorialList;
1514
}

‎lib/reducers/tutorial-list/is-tutorial.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
varpath_1=require('path');
33
varfs_1=require('fs');
44
varexists_1=require('../../services/exists');
5-
varstore_1=require('../../store');
65
exports.tutorialError='This is an error with the tutorial itself';
7-
functionisTutorial(name){
8-
vardir=store_1.default.getState().dir;
6+
functionisTutorial(dir,name){
97
varpathToTutorialPackageJson=path_1.join(dir,'node_modules',name,'package.json');
108
if(!exists_1.fileExists(pathToTutorialPackageJson)){
119
console.log("Error with "+name+": no package.json file found. "+exports.tutorialError);

‎lib/reducers/tutorial/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
var_types_1=require('../../actions/_types');
33
varpath_1=require('path');
44
vartutorial_config_1=require('./tutorial-config');
5-
varstore_1=require('../../store');
65
var_tutorial={
76
name:null,
87
info:null,
@@ -14,12 +13,11 @@ function tutorialReducer(tutorial, action) {
1413
if(tutorial===void0){tutorial=_tutorial;}
1514
switch(action.type){
1615
case_types_1.TUTORIAL_SET:
17-
varname_1=action.payload.name;
18-
vardir=store_1.default.getState().dir;
16+
var_a=action.payload,name_1=_a.name,dir=_a.dir;
1917
varpackagePath=path_1.join(dir,'node_modules',name_1);
2018
varpackageJson=require(path_1.join(packagePath,'package.json'));
2119
varconfig=tutorial_config_1.tutorialConfig(packageJson);
22-
var_a=require(path_1.join(packagePath,packageJson.main)),info=_a.info,pages=_a.pages;
20+
var_b=require(path_1.join(packagePath,packageJson.main)),info=_b.info,pages=_b.pages;
2321
return{
2422
name:packageJson.name,
2523
info:info,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp