Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Commit d6096ff

Browse files
committed
remove chapters, pages only
1 parent 0ba8a5b commit d6096ff

File tree

35 files changed

+159
-355
lines changed

35 files changed

+159
-355
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## [0.9]
6+
- remove chapters, now only pages
7+
- bug fixes
8+
59
## [0.8.0] - 2016-04-27
610
- save tutorial progress to localStorage
711
- check for tutorial package updates

lib/actions/_types.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"use strict";
22
exports.ALERT_REPLAY = 'ALERT_REPLAY';
33
exports.ALERT_TOGGLE = 'ALERT_TOGGLE';
4-
exports.COMPLETE_CHAPTER = 'COMPLETE_CHAPTER';
54
exports.COMPLETE_PAGE = 'COMPLETE_PAGE';
65
exports.COMPLETE_TUTORIAL = 'COMPLETE_TUTORIAL';
76
exports.HINT_POSITION_SET = 'HINT_POSITION_SET';

lib/actions/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ exports.alertReplay = alert_1.alertReplay;
55
var progress_1 = require('./progress');
66
exports.progressLoad = progress_1.progressLoad;
77
exports.completePage = progress_1.completePage;
8-
exports.completeChapter = progress_1.completeChapter;
98
exports.completeTutorial = progress_1.completeTutorial;
109
var hint_1 = require('./hint');
1110
exports.hintShow = hint_1.hintShow;

lib/actions/page.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,18 @@ var test_1 = require('./test');
33
var _types_1 = require('./_types');
44
var store_1 = require('../store');
55
var _position = {
6-
chapter: 0,
76
page: 0,
87
};
98
function pageNext() {
109
var position = null;
11-
var _a = store_1.default.getState().position, page = _a.page, chapter = _a.chapter;
12-
var chapters = store_1.default.getState().tutorial.chapters;
13-
if (page < chapters[chapter].pages.length - 1) {
10+
var page = store_1.default.getState().position.page;
11+
var pages = store_1.default.getState().tutorial.pages;
12+
if (page < pages.length - 1) {
1413
store_1.default.dispatch(test_1.testsLoad());
1514
position = {
16-
chapter: chapter,
1715
page: page + 1,
1816
};
1917
}
20-
else if (chapter < chapters.length - 1) {
21-
store_1.default.dispatch(test_1.testsLoad());
22-
position = {
23-
chapter: chapter + 1,
24-
page: 0,
25-
};
26-
}
2718
else {
2819
return {
2920
payload: { route: 'final' },

lib/actions/progress.js

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,16 @@ function isTrue(x) {
1414
}
1515
function completePage() {
1616
var position = store_1.default.getState().position;
17-
var chapter = store_1.default.getState().progress.chapters[position.chapter];
18-
if (chapter.pages.every(function (x) { return x; })) {
19-
store_1.default.dispatch(completeChapter());
17+
var progress = store_1.default.getState().progress;
18+
if (progress.pages.every(function (x) { return x.completed; })) {
19+
store_1.default.dispatch(completeTutorial());
2020
}
2121
return {
2222
payload: { position: position },
2323
type: _types_1.COMPLETE_PAGE,
2424
};
2525
}
2626
exports.completePage = completePage;
27-
function completeChapter() {
28-
var chapter = store_1.default.getState().position.chapter;
29-
var progress = store_1.default.getState().progress;
30-
if (progress.chapters.every(function (x) { return x.completed; })) {
31-
store_1.default.dispatch(completeTutorial());
32-
}
33-
return {
34-
payload: { chapter: chapter },
35-
type: _types_1.COMPLETE_CHAPTER,
36-
};
37-
}
38-
exports.completeChapter = completeChapter;
3927
function completeTutorial() {
4028
return { type: _types_1.COMPLETE_TUTORIAL };
4129
}

lib/components/App.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ var App = (function (_super) {
3535
_super.apply(this, arguments);
3636
}
3737
App.prototype.render = function () {
38-
return (React.createElement("section", {className: 'cr', key: 'main', style: { height: height }}, React.createElement(index_1.AppMenu, __assign({}, this.props.store)), React.createElement(Routes_1.Routes, __assign({}, this.props.store)), React.createElement(index_1.Alert, __assign({}, this.props.store))));
38+
var store = this.props.store;
39+
console.log(store);
40+
return (React.createElement("section", {className: 'cr', key: 'main', style: { height: height }}, React.createElement(index_1.AppMenu, __assign({}, store)), React.createElement(Routes_1.Routes, __assign({}, store)), React.createElement(index_1.Alert, __assign({}, store))));
3941
};
4042
App = __decorate([
4143
react_redux_1.connect(function (store) {

lib/components/Page/Chapter/index.js

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

lib/components/Progress/ProgressChapter/index.js

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

lib/components/Progress/ProgressPage/index.js

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,19 @@ var ProgressPage = (function (_super) {
2929
_super.apply(this, arguments);
3030
}
3131
ProgressPage.prototype.canActivate = function (isActive) {
32-
var _a = this.props, chapterIndex = _a.chapterIndex, pageIndex = _a.pageIndex, position = _a.position, progress = _a.progress;
33-
var completed = progress.chapters[chapterIndex].pages[pageIndex];
34-
var currentChapter = chapterIndex === position.chapter;
35-
var earlierOrCurrentPage = pageIndex <= position.page;
36-
return isActive || completed ||
37-
(currentChapter && earlierOrCurrentPage);
32+
var _a = this.props, index = _a.index, position = _a.position, progress = _a.progress;
33+
var completed = progress.pages[index];
34+
return isActive || completed;
3835
};
3936
ProgressPage.prototype.render = function () {
40-
var _a = this.props, page = _a.page, position = _a.position, chapterIndex = _a.chapterIndex, pageIndex = _a.pageIndex, progress = _a.progress, selectPage = _a.selectPage;
41-
var isActive = chapterIndex === position.chapter && pageIndex === position.page;
37+
console.log(this.props);
38+
var _a = this.props, page = _a.page, position = _a.position, index = _a.index, progress = _a.progress, selectPage = _a.selectPage;
39+
var isActive = index === position.page;
4240
var canActivate = this.canActivate(isActive);
43-
var completed = progress.chapters[chapterIndex].pages[pageIndex];
44-
return (React.createElement(List_1.ListItem, {key: pageIndex, style: Object.assign({}, styles, !canActivate ? { color: colors_1.grey400 } : {}), primaryText: (pageIndex + 1) + ". " + page.title, secondaryText: canActivate ? page.description : '', leftIcon: progressIcon_1.progressIcon(completed, isActive), onClick: canActivate
41+
var completed = progress.pages[index];
42+
return (React.createElement(List_1.ListItem, {key: index, style: Object.assign({}, styles, !canActivate ? { color: colors_1.grey400 } : {}), primaryText: (index + 1) + ". " + page.title, secondaryText: canActivate ? page.description : '', leftIcon: progressIcon_1.progressIcon(completed, isActive), onClick: canActivate
4543
? selectPage.bind(this, {
46-
chapter: chapterIndex,
47-
page: pageIndex
44+
page: index
4845
})
4946
: function () { return; }}));
5047
};

lib/components/Progress/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ var React = require('react');
33
var Paper_1 = require('material-ui/Paper');
44
var List_1 = require('material-ui/List');
55
var Subheader_1 = require('material-ui/Subheader');
6-
var ProgressChapter_1 = require('./ProgressChapter');
6+
var ProgressPage_1 = require('./ProgressPage');
77
var pageStyle = {
88
width: '100%',
99
margin: '0px',
1010
};
1111
exports.Progress = function (_a) {
1212
var progress = _a.progress, position = _a.position, info = _a.info, tutorial = _a.tutorial;
13-
return (React.createElement(Paper_1.default, {style: pageStyle}, React.createElement(List_1.List, null, React.createElement(Subheader_1.default, null, info.name), tutorial.chapters.map(function (chapter, chapterIndex) { return (React.createElement(ProgressChapter_1.ProgressChapter, {key: chapterIndex, chapter: chapter, chapterIndex: chapterIndex, position: position, progress: progress})); }))));
13+
return (React.createElement(Paper_1.default, {style: pageStyle}, React.createElement(List_1.List, null, React.createElement(Subheader_1.default, null, info.name), tutorial.pages.map(function (page, index) { return (React.createElement(ProgressPage_1.ProgressPage, {key: index, index: index, page: page, position: position, progress: progress})); }))));
1414
};

0 commit comments

Comments
 (0)