Skip to content

Commit d32b813

Browse files
committed
final page with styles
1 parent 49137bd commit d32b813

File tree

27 files changed

+65
-55
lines changed

27 files changed

+65
-55
lines changed

lib/actions/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ exports.pageNext = page_1.pageNext;
1616
var position_1 = require('./position');
1717
exports.positionSet = position_1.positionSet;
1818
var route_1 = require('./route');
19-
exports.setRoute = route_1.setRoute;
19+
exports.routeSet = route_1.routeSet;
2020
var setup_1 = require('./setup');
2121
exports.setupVerify = setup_1.setupVerify;
2222
var test_1 = require('./test');

lib/actions/page.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"use strict";
22
var _types_1 = require('./_types');
3-
var index_1 = require('./index');
43
var store_1 = require('../store');
54
var _position = {
65
chapter: 0,
@@ -17,20 +16,21 @@ function pageNext() {
1716
};
1817
}
1918
else if (chapter < chapters.length - 1) {
20-
store_1.store.dispatch(index_1.completePage());
2119
position = {
2220
chapter: chapter + 1,
2321
page: 0,
2422
};
2523
}
2624
else {
27-
store_1.store.dispatch(index_1.completeTutorial());
28-
position = {
29-
chapter: chapter,
30-
page: page
25+
return {
26+
payload: { route: 'final' },
27+
type: _types_1.ROUTE_SET,
3128
};
3229
}
33-
return { type: _types_1.PAGE_SET, payload: { position: position } };
30+
return {
31+
payload: { position: position },
32+
type: _types_1.PAGE_SET,
33+
};
3434
}
3535
exports.pageNext = pageNext;
3636
function pageSet(position) {

lib/actions/progress.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function completePage() {
99
var position = store_1.store.getState().position;
1010
var pageLength = store_1.store.getState().progress.chapters[position.chapter].pages.length;
1111
if (position.page >= pageLength - 1) {
12-
return completeChapter();
12+
store_1.store.dispatch(completeChapter());
1313
}
1414
return {
1515
payload: { position: position },
@@ -21,7 +21,7 @@ function completeChapter() {
2121
var chapter = store_1.store.getState().position.chapter;
2222
var chapterLength = store_1.store.getState().progress.chapters.length;
2323
if (chapter >= chapterLength - 1) {
24-
return completeTutorial();
24+
store_1.store.dispatch(completeTutorial());
2525
}
2626
return {
2727
payload: { chapter: chapter },

lib/actions/route.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var store_1 = require('../store');
33
var _types_1 = require('./_types');
44
var tutorial_1 = require('./tutorial');
55
var previous = null;
6-
function setRoute(route) {
6+
function routeSet(route) {
77
if (route && route !== previous) {
88
switch (route) {
99
case 'tutorials':
@@ -16,4 +16,4 @@ function setRoute(route) {
1616
};
1717
}
1818
}
19-
exports.setRoute = setRoute;
19+
exports.routeSet = routeSet;

lib/components/App.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ var App = (function (_super) {
3535
_super.apply(this, arguments);
3636
}
3737
App.prototype.render = function () {
38+
console.log(this.props.store);
3839
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))));
3940
};
4041
App = __decorate([

lib/components/AppMenu/MenuLink.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ var MenuLink = (function (_super) {
2929
MenuLink = __decorate([
3030
react_redux_1.connect(null, function (dispatch) {
3131
return {
32-
routeTo: function (route) { return dispatch(actions_1.setRoute(route)); },
32+
routeTo: function (route) { return dispatch(actions_1.routeSet(route)); },
3333
};
3434
}),
3535
__metadata('design:paramtypes', [])

lib/components/Common/RouteButton.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ var RouteButton = (function (_super) {
2929
RouteButton = __decorate([
3030
react_redux_1.connect(null, function (dispatch) {
3131
return {
32-
routeTo: function (route) { return dispatch(actions_1.setRoute(route)); },
32+
routeTo: function (route) { return dispatch(actions_1.routeSet(route)); },
3333
};
3434
}),
3535
__metadata('design:paramtypes', [])

lib/components/FinalPage/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
"use strict";
22
var React = require('react');
3-
var Paper_1 = require('material-ui/Paper');
43
var Card_1 = require('material-ui/Card');
54
var FlatButton_1 = require('material-ui/FlatButton');
6-
exports.FinalPage = function () { return (React.createElement(Paper_1.default, null, React.createElement(Card_1.Card, null, React.createElement(Card_1.CardTitle, {title: 'Congratulations!', subtitle: 'Tutorial Complete!'}), React.createElement(Card_1.CardText, null, "What's next?"), React.createElement(Card_1.CardActions, null, React.createElement("a", {href: 'https://coderoad.github.io/#tutorials'}, React.createElement(FlatButton_1.default, {label: 'See More Tutorials', disabled: true})), React.createElement("a", {href: 'https://coderoad.github.io/build'}, React.createElement(FlatButton_1.default, {label: 'Learn how to Create a Tutorial'})))))); };
5+
var styles = {
6+
margin: '5px',
7+
padding: '10px',
8+
};
9+
exports.FinalPage = function () { return (React.createElement(Card_1.Card, {style: styles}, React.createElement(Card_1.CardTitle, {title: 'Congratulations!', subtitle: 'Tutorial Complete!'}), React.createElement(Card_1.CardText, null, "What's next?", React.createElement("br", null), React.createElement("br", null), React.createElement("a", {href: 'https://coderoad.github.io/#tutorials'}, React.createElement(FlatButton_1.default, {label: 'See More Tutorials', disabled: true})), React.createElement("span", null, " (coming soon)"), React.createElement("br", null), React.createElement("br", null), React.createElement("a", {href: 'https://coderoad.github.io/build'}, React.createElement(FlatButton_1.default, {label: 'Learn how to Create a Tutorial'}))))); };

lib/components/Page/PageToolbar/Continue.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ var Continue = (function (_super) {
2828
Continue = __decorate([
2929
react_redux_1.connect(null, function (dispatch, state) {
3030
return {
31-
callNextPage: function () { return dispatch(actions_1.pageNext()); },
31+
callNextPage: function () {
32+
dispatch(actions_1.pageNext());
33+
dispatch(actions_1.testsLoad());
34+
}
3235
};
3336
}),
3437
__metadata('design:paramtypes', [])

lib/components/Page/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ var Page = (function (_super) {
3636
var _a = this.props, page = _a.page, taskPosition = _a.taskPosition, hintPosition = _a.hintPosition, tasks = _a.tasks, testRun = _a.testRun;
3737
var task = taskPosition <= tasks.length ? tasks[taskPosition] : null;
3838
var allComplete = taskPosition >= tasks.length;
39-
console.log('page', page);
4039
return (React.createElement("section", {className: 'cr-page'}, React.createElement(PageContent_1.PageContent, __assign({}, this.props)), React.createElement(Tasks_1.Tasks, __assign({}, this.props, {completed: page.completed})), React.createElement("div", {className: 'listEnd', ref: 'listEnd'}), React.createElement(PageComplete_1.PageComplete, __assign({}, this.props)), React.createElement(Hints_1.Hints, {task: task, hintPosition: hintPosition}), React.createElement(PageToolbar_1.PageToolbar, __assign({}, this.props), React.createElement(ProgressBar_1.ProgressBar, {taskPosition: taskPosition, taskCount: tasks.length, completed: page.completed}))));
4140
};
4241
return Page;

lib/components/Progress/ProgressPage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ var ProgressPage = (function (_super) {
5050
selectPage: function (position) {
5151
dispatch(actions_1.pageSet(position));
5252
dispatch(actions_1.testsLoad());
53-
dispatch(actions_1.setRoute('page'));
53+
dispatch(actions_1.routeSet('page'));
5454
}
5555
};
5656
}),

lib/components/Tutorials/SelectTutorial.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ var SelectTutorial = (function (_super) {
4343
dispatch(actions_1.tutorialSet(name));
4444
dispatch(actions_1.positionSet({ chapter: 0, page: 0 }));
4545
dispatch(actions_1.progressLoad());
46-
dispatch(actions_1.setRoute('progress'));
46+
dispatch(actions_1.routeSet('progress'));
4747
},
4848
};
4949
}),

lib/reducers/test-run/test-result.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
var store_1 = require('../../store');
33
var actions_1 = require('../../actions');
44
function handleResult(result) {
5-
console.log('handleRes', result);
65
store_1.store.dispatch(actions_1.testComplete());
76
if (result.completed) {
87
store_1.store.dispatch(actions_1.testResult(result));

src/actions/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export {
55
export {hintShow, hintPositionSet} from './hint';
66
export {pageSet, pageNext} from './page';
77
export {positionSet} from './position';
8-
export {setRoute} from './route';
8+
export {routeSet} from './route';
99
export {setupVerify} from './setup';
1010
export {
1111
testRun, testComplete, testResult, testsLoad

src/actions/page.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {ROUTE_SET, PAGE_SET} from './_types';
2-
import {completePage, completeTutorial} from './index';
32
import {store} from '../store';
43

54
const _position = {
@@ -17,19 +16,20 @@ export function pageNext(): Action {
1716
page: page + 1,
1817
};
1918
} else if (chapter < chapters.length - 1) {
20-
store.dispatch(completePage());
2119
position = {
2220
chapter: chapter + 1,
2321
page: 0,
2422
};
2523
} else {
26-
store.dispatch(completeTutorial());
27-
position = {
28-
chapter,
29-
page
24+
return {
25+
payload: { route: 'final' },
26+
type: ROUTE_SET,
3027
};
3128
}
32-
return { type: PAGE_SET, payload: { position } };
29+
return {
30+
payload: { position },
31+
type: PAGE_SET,
32+
};
3333
}
3434

3535
export function pageSet(

src/actions/progress.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function completePage(): Action {
1111
const position: CR.Position = store.getState().position;
1212
const pageLength: number = store.getState().progress.chapters[position.chapter].pages.length;
1313
if (position.page >= pageLength - 1) {
14-
return completeChapter();
14+
store.dispatch(completeChapter());
1515
}
1616
return {
1717
payload: { position },
@@ -23,7 +23,7 @@ export function completeChapter(): Action {
2323
const chapter: number = store.getState().position.chapter;
2424
const chapterLength: number = store.getState().progress.chapters.length;
2525
if (chapter >= chapterLength - 1) {
26-
return completeTutorial();
26+
store.dispatch(completeTutorial());
2727
}
2828
return {
2929
payload: { chapter },

src/actions/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {tutorialsFind} from './tutorial';
55
let previous = null;
66

77
/* Navigation */
8-
export function setRoute(route: string): Action {
8+
export function routeSet(route: string): Action {
99
if (route && route !== previous) {
1010

1111
// preloading for routes

src/components/AppMenu/MenuLink.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import * as React from 'react';
22
import {connect} from 'react-redux';
33
import MenuItem from 'material-ui/MenuItem';
4-
import {pageSet, setRoute} from '../../actions';
4+
import {pageSet, routeSet} from '../../actions';
55

66
@connect(null, (dispatch) => {
77
return {
8-
routeTo: (route: string) => dispatch(setRoute(route)),
8+
routeTo: (route: string) => dispatch(routeSet(route)),
99
};
1010
})
1111
export class MenuLink extends React.Component<{

src/components/Common/RouteButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import * as React from 'react';
22
import {connect} from 'react-redux';
3-
import {setRoute} from '../../actions';
3+
import {routeSet} from '../../actions';
44
import FlatButton from 'material-ui/FlatButton';
55

66
@connect(null, (dispatch) => {
77
return {
8-
routeTo: (route: string) => dispatch(setRoute(route)),
8+
routeTo: (route: string) => dispatch(routeSet(route)),
99
};
1010
})
1111
export class RouteButton extends React.Component<{

src/components/FinalPage/index.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,32 @@ import Divider from 'material-ui/Divider';
55
import {Card, CardTitle, CardText, CardActions} from 'material-ui/Card';
66
import FlatButton from 'material-ui/FlatButton';
77

8+
const styles = {
9+
margin: '5px',
10+
padding: '10px',
11+
};
12+
813
export const FinalPage: React.StatelessComponent<{}> = () => (
9-
<Paper>
10-
<Card>
14+
<Card style={styles}>
1115
<CardTitle
1216
title='Congratulations!'
1317
subtitle='Tutorial Complete!'
1418
/>
1519
<CardText>
1620
What's next?
17-
</CardText>
18-
<CardActions>
21+
<br /><br />
1922
<a href='https://coderoad.github.io/#tutorials'>
2023
<FlatButton
2124
label='See More Tutorials'
2225
disabled={true}
2326
/>
2427
</a>
28+
<span> (coming soon)</span>
29+
<br /><br />
2530
<a href='https://coderoad.github.io/build'>
2631
<FlatButton label='Learn how to Create a Tutorial' />
2732
</a>
28-
</CardActions>
33+
</CardText>
34+
2935
</Card>
30-
</Paper>
3136
);

src/components/Page/PageToolbar/Continue.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import * as React from 'react';
22
import {connect} from 'react-redux';
33
import FlatButton from 'material-ui/FlatButton';
4-
import {pageNext} from '../../../actions';
4+
import {pageNext, testsLoad} from '../../../actions';
55

66
@connect(null, (dispatch, state) => {
77
return {
8-
callNextPage: () => dispatch(pageNext()),
8+
callNextPage: () => {
9+
dispatch(pageNext());
10+
dispatch(testsLoad());
11+
}
912
};
1013
})
1114
export class Continue extends React.Component<{

src/components/Page/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ render() {
2929
const {page, taskPosition, hintPosition, tasks, testRun} = this.props;
3030
const task = taskPosition <= tasks.length ? tasks[taskPosition] : null;
3131
const allComplete = taskPosition >= tasks.length;
32-
console.log('page', page);
3332
return (
3433
<section className='cr-page'>
3534
<PageContent {...this.props} />

src/components/Progress/ProgressPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import {connect} from 'react-redux';
3-
import {pageSet, setRoute, testsLoad} from '../../actions';
3+
import {pageSet, routeSet, testsLoad} from '../../actions';
44
import * as classnames from 'classnames';
55
import {ListItem} from 'material-ui/List';
66
import {progressIcon} from './progressIcon';
@@ -11,7 +11,7 @@ import {grey400} from 'material-ui/styles/colors';
1111
selectPage: (position: CR.Position) => {
1212
dispatch(pageSet(position));
1313
dispatch(testsLoad());
14-
dispatch(setRoute('page'));
14+
dispatch(routeSet('page'));
1515
}
1616
};
1717
})

src/components/Tutorials/SelectTutorial.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as React from 'react';
22
import {connect} from 'react-redux';
33
import FlatButton from 'material-ui/FlatButton';
44
import {
5-
positionSet, tutorialSet, progressLoad, setRoute
5+
positionSet, tutorialSet, progressLoad, routeSet
66
} from '../../actions';
77

88
function displayName(name: string): string {
@@ -20,12 +20,12 @@ function displayName(name: string): string {
2020
dispatch(tutorialSet(name));
2121
dispatch(positionSet({chapter: 0, page: 0}));
2222
dispatch(progressLoad());
23-
dispatch(setRoute('progress'));
23+
dispatch(routeSet('progress'));
2424
},
2525
};
2626
})
2727
export class SelectTutorial extends React.Component<{
28-
tutorial: Tutorial.Info, selectTutorial?: any
28+
tutorial: CR.Tutorial, selectTutorial?: any
2929
}, {}> {
3030
render() {
3131
const {tutorial, selectTutorial} = this.props;

src/components/app.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ window.onresize = function() {
1313
})
1414
export class App extends React.Component<{store?: CR.State}, {}> {
1515
render(): React.ReactElement<{}> {
16+
console.log(this.props.store);
1617
return (
1718
<section
1819
className='cr'

src/reducers/route/route.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ describe('route', () => {
66

77
describe('ROUTE_SET', () => {
88
it('changes the store path', () => {
9-
const action: Action = Action.setRoute('page');
9+
const action: Action = Action.routeSet('page');
1010
expect(reducer({}, action).route).to.equal('page');
1111
});
1212

1313
it('updates an existing store path', () => {
1414
const state = {route: 'page'};
15-
const action: Action = Action.setRoute('progress');
15+
const action: Action = Action.routeSet('progress');
1616
expect(reducer(state, action).route).to.equal('progress');
1717
});
1818
});

src/reducers/test-run/test-result.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ import {store} from '../../store';
22
import {testResult, completePage, testComplete} from '../../actions';
33

44
export function handleResult(result: Test.Result): void {
5-
6-
console.log('handleRes', result);
7-
85
store.dispatch(testComplete());
96

107
if (result.completed) {

0 commit comments

Comments
 (0)