Skip to content

Commit 37e2e70

Browse files
committed
move store out of reducers into actions, material-ui@0.15
1 parent 9c18bfe commit 37e2e70

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
function alertReplay() {

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
function hintPositionSet(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
function hintShow() {

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+
var store_1 = require('../store');
34
function packageSet() {
4-
return { type: _types_1.PACKAGE_SET };
5+
var dir = 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
var pagePosition = store_1.default.getState().pagePosition;
77
var pages = 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 () { return store_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
function pageSet(pagePosition) {
2519
if (pagePosition === void 0) { 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
function pagePositionLoad() {
39-
return { type: _types_1.PAGE_POSITION_LOAD };
31+
var progress = store_1.default.getState().progress;
32+
return { type: _types_1.PAGE_POSITION_LOAD, payload: { progress: progress } };
4033
}
4134
exports.pagePositionLoad = pagePositionLoad;
4235
function pagePositionSet(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
var page_1 = require('./page');
44
var store_1 = require('../store');
55
function progressLoad() {
6-
setTimeout(function () {
7-
store_1.default.dispatch(page_1.pagePositionLoad());
8-
});
9-
return { type: _types_1.PROGRESS_LOAD };
6+
setTimeout(function () { return store_1.default.dispatch(page_1.pagePositionLoad()); });
7+
var tutorial = store_1.default.getState().tutorial;
8+
return { type: _types_1.PROGRESS_LOAD, payload: { tutorial: tutorial } };
109
}
1110
exports.progressLoad = progressLoad;
12-
function isTrue(x) {
13-
return x === true;
14-
}
1511
function completePage() {
16-
var pagePosition = store_1.default.getState().pagePosition;
17-
var progress = 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) { return x.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
function completeTutorial() {

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
function testResult(result) {
99
var actions = 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
function testComplete() {
@@ -22,6 +19,7 @@ function testSave() {
2219
}
2320
exports.testSave = testSave;
2421
function testsLoad(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+
var store_1 = require('../store');
34
function tutorialSet(name) {
4-
return {
5-
payload: { name: name },
6-
type: _types_1.TUTORIAL_SET,
7-
};
5+
var dir = store_1.default.getState().dir;
6+
return { type: _types_1.TUTORIAL_SET, payload: { name: name, dir: dir } };
87
}
98
exports.tutorialSet = tutorialSet;
109
function tutorialUpdate(name) {
1110
return { type: _types_1.TUTORIAL_UPDATE, payload: { name: name } };
1211
}
1312
exports.tutorialUpdate = tutorialUpdate;
1413
function tutorialsFind() {
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
var play_circle_filled_1 = require('material-ui/svg-icons/av/play-circle-filled');
66
var check_box_outline_blank_1 = require('material-ui/svg-icons/toggle/check-box-outline-blank');
77
function progressIcon(pages, index, pagePosition) {
8-
console.log(index, pagePosition);
98
switch (true) {
109
case pages[pagePosition]:
1110
return React.createElement(check_box_1.default, {style: { fill: colors_1.green300 }});

0 commit comments

Comments
 (0)