Skip to content

Commit 6fa66c0

Browse files
committed
replace task checkbox with colors
1 parent d4c8ad0 commit 6fa66c0

File tree

113 files changed

+2700
-68
lines changed

Some content is hidden

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

113 files changed

+2700
-68
lines changed

lib/actions/_types.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"use strict";
2+
exports.ALERT_REPLAY = 'ALERT_REPLAY';
3+
exports.ALERT_TOGGLE = 'ALERT_TOGGLE';
4+
exports.COMPLETE_CHAPTER = 'COMPLETE_CHAPTER';
5+
exports.COMPLETE_PAGE = 'COMPLETE_PAGE';
6+
exports.COMPLETE_TUTORIAL = 'COMPLETE_TUTORIAL';
7+
exports.HINT_POSITION_SET = 'HINT_POSITION_SET';
8+
exports.HINT_SHOW = 'HINT_SHOW';
9+
exports.PACKAGE_SET = 'PACKAGE_SET';
10+
exports.PAGE_SET = 'PAGE_SET';
11+
exports.POSITION_SET = 'POSITION_SET';
12+
exports.PROGRESS_LOAD = 'PROGRESS_LOAD';
13+
exports.ROUTE_SET = 'ROUTE_SET';
14+
exports.SETUP_VERIFY = 'SETUP_VERIFY';
15+
exports.TEST_COMPLETE = 'TEST_COMPLETE';
16+
exports.TEST_RESULT = 'TEST_RESULT';
17+
exports.TEST_RUN = 'TEST_RUN';
18+
exports.TESTS_LOAD = 'TESTS_LOAD';
19+
exports.TUTORIAL_SET = 'TUTORIAL_SET';
20+
exports.TUTORIAL_UPDATE = 'TUTORIAL_UPDATE';
21+
exports.TUTORIALS_FIND = 'TUTORIALS_FIND';

lib/actions/alert.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"use strict";
2+
var store_1 = require('../store');
3+
var _types_1 = require('./_types');
4+
function alertToggle(alert) {
5+
var isOpen = store_1.store.getState().alert.open;
6+
if (!alert) {
7+
alert = {
8+
action: '',
9+
message: '',
10+
open: false,
11+
};
12+
}
13+
else {
14+
alert = Object.assign({}, { open: !isOpen }, alert);
15+
}
16+
return {
17+
payload: { alert: alert },
18+
type: _types_1.ALERT_TOGGLE,
19+
};
20+
}
21+
exports.alertToggle = alertToggle;
22+
function alertReplay() {
23+
return { type: _types_1.ALERT_REPLAY };
24+
}
25+
exports.alertReplay = alertReplay;

lib/actions/hint.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"use strict";
2+
var _types_1 = require('./_types');
3+
function hintPositionSet(hintPosition) {
4+
return {
5+
payload: { hintPosition: hintPosition },
6+
type: _types_1.HINT_POSITION_SET,
7+
};
8+
}
9+
exports.hintPositionSet = hintPositionSet;
10+
function hintShow() {
11+
return { type: _types_1.HINT_SHOW };
12+
}
13+
exports.hintShow = hintShow;

lib/actions/index.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"use strict";
2+
var alert_1 = require('./alert');
3+
exports.alertToggle = alert_1.alertToggle;
4+
exports.alertReplay = alert_1.alertReplay;
5+
var progress_1 = require('./progress');
6+
exports.progressLoad = progress_1.progressLoad;
7+
exports.completePage = progress_1.completePage;
8+
exports.completeChapter = progress_1.completeChapter;
9+
exports.completeTutorial = progress_1.completeTutorial;
10+
var hint_1 = require('./hint');
11+
exports.hintShow = hint_1.hintShow;
12+
exports.hintPositionSet = hint_1.hintPositionSet;
13+
var page_1 = require('./page');
14+
exports.pageSet = page_1.pageSet;
15+
exports.pageNext = page_1.pageNext;
16+
var position_1 = require('./position');
17+
exports.positionSet = position_1.positionSet;
18+
var route_1 = require('./route');
19+
exports.setRoute = route_1.setRoute;
20+
var setup_1 = require('./setup');
21+
exports.setupVerify = setup_1.setupVerify;
22+
var test_1 = require('./test');
23+
exports.testRun = test_1.testRun;
24+
exports.testComplete = test_1.testComplete;
25+
exports.testResult = test_1.testResult;
26+
exports.testsLoad = test_1.testsLoad;
27+
var tutorial_1 = require('./tutorial');
28+
exports.tutorialsFind = tutorial_1.tutorialsFind;
29+
exports.tutorialSet = tutorial_1.tutorialSet;

lib/actions/package.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"use strict";
2+
var _types_1 = require('./_types');
3+
function packageSet() {
4+
return { type: _types_1.PACKAGE_SET };
5+
}
6+
exports.packageSet = packageSet;

lib/actions/page.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
"use strict";
2+
var _types_1 = require('./_types');
3+
var index_1 = require('./index');
4+
var store_1 = require('../store');
5+
var _position = {
6+
chapter: 0,
7+
page: 0,
8+
};
9+
function pageNext() {
10+
var position = null;
11+
var _a = store_1.store.getState().position, page = _a.page, chapter = _a.chapter;
12+
var chapters = store_1.store.getState().tutorial.chapters;
13+
if (page < chapters[chapter].pages.length - 1) {
14+
position = {
15+
chapter: chapter,
16+
page: page + 1,
17+
};
18+
}
19+
else if (chapter < chapters.length - 1) {
20+
store_1.store.dispatch(index_1.completePage());
21+
position = {
22+
chapter: chapter + 1,
23+
page: 0,
24+
};
25+
}
26+
else {
27+
store_1.store.dispatch(index_1.completeTutorial());
28+
position = {
29+
chapter: chapter,
30+
page: page
31+
};
32+
}
33+
return { type: _types_1.PAGE_SET, payload: { position: position } };
34+
}
35+
exports.pageNext = pageNext;
36+
function pageSet(position) {
37+
if (position === void 0) { position = _position; }
38+
if (position.completed) {
39+
return {
40+
payload: { route: 'final' },
41+
type: _types_1.ROUTE_SET,
42+
};
43+
}
44+
return {
45+
payload: { position: position },
46+
type: _types_1.PAGE_SET,
47+
};
48+
}
49+
exports.pageSet = pageSet;

lib/actions/position.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"use strict";
2+
var _types_1 = require('./_types');
3+
function positionSet(position) {
4+
return {
5+
payload: { position: position },
6+
type: _types_1.POSITION_SET,
7+
};
8+
}
9+
exports.positionSet = positionSet;

lib/actions/progress.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"use strict";
2+
var _types_1 = require('./_types');
3+
var store_1 = require('../store');
4+
function progressLoad() {
5+
return { type: _types_1.PROGRESS_LOAD };
6+
}
7+
exports.progressLoad = progressLoad;
8+
function completePage() {
9+
var position = store_1.store.getState().position;
10+
var pageLength = store_1.store.getState().progress.chapters[position.chapter].pages.length;
11+
if (position.page >= pageLength - 1) {
12+
return completeChapter();
13+
}
14+
return {
15+
payload: { position: position },
16+
type: _types_1.COMPLETE_PAGE,
17+
};
18+
}
19+
exports.completePage = completePage;
20+
function completeChapter() {
21+
var chapter = store_1.store.getState().position.chapter;
22+
var chapterLength = store_1.store.getState().progress.chapters.length;
23+
if (chapter >= chapterLength - 1) {
24+
return completeTutorial();
25+
}
26+
return {
27+
payload: { chapter: chapter },
28+
type: _types_1.COMPLETE_CHAPTER,
29+
};
30+
}
31+
exports.completeChapter = completeChapter;
32+
function completeTutorial() {
33+
return { type: _types_1.COMPLETE_TUTORIAL };
34+
}
35+
exports.completeTutorial = completeTutorial;

lib/actions/route.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"use strict";
2+
var store_1 = require('../store');
3+
var _types_1 = require('./_types');
4+
var tutorial_1 = require('./tutorial');
5+
var previous = null;
6+
function setRoute(route) {
7+
if (route && route !== previous) {
8+
switch (route) {
9+
case 'tutorials':
10+
store_1.store.dispatch(tutorial_1.tutorialsFind());
11+
}
12+
previous = route;
13+
return {
14+
payload: { route: route },
15+
type: _types_1.ROUTE_SET,
16+
};
17+
}
18+
}
19+
exports.setRoute = setRoute;

lib/actions/setup.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"use strict";
2+
var _types_1 = require('./_types');
3+
var package_1 = require('./package');
4+
var store_1 = require('../store');
5+
function setupVerify() {
6+
store_1.store.dispatch(package_1.packageSet());
7+
return { type: _types_1.SETUP_VERIFY };
8+
}
9+
exports.setupVerify = setupVerify;

0 commit comments

Comments
 (0)