Skip to content

Commit 4f58b21

Browse files
committed
type fixes
1 parent 1e7c3d7 commit 4f58b21

File tree

19 files changed

+106
-133
lines changed

19 files changed

+106
-133
lines changed

lib/actions/tutorials.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function loadRootPackageJson() {
2929
if (exists_1.fileExists(pathToPackageJson)) {
3030
return JSON.parse(fs.readFileSync(pathToPackageJson, 'utf8'));
3131
}
32-
return false;
32+
return null;
3333
}
3434
function isTutorial(name) {
3535
var pathToTutorialPackageJson = path.join(window.coderoad.dir, 'node_modules', name, 'package.json');

lib/components/account/account.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ var default_1 = (function (_super) {
1111
_super.apply(this, arguments);
1212
}
1313
default_1.prototype.render = function () {
14-
return (React.createElement("section", {className: 'cr-account'},
15-
React.createElement("h3", null, "Account")
16-
));
14+
return (React.createElement("section", {className: 'cr-account'}, React.createElement("h3", null, "Account")));
1715
};
1816
return default_1;
1917
}(React.Component));

lib/components/app/app.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ var default_1 = (function (_super) {
3030
};
3131
default_1.prototype.render = function () {
3232
var state = this.props.state;
33-
return (React.createElement("section", {className: 'cr'},
34-
React.createElement(_components_1.Menu, {route: state.route, position: state.position}),
35-
React.createElement(_components_1.Router, {state: state}),
36-
React.createElement(_components_1.Alert, {alert: state.alert})));
33+
return (React.createElement("section", {className: 'cr'}, React.createElement(_components_1.Menu, {route: state.route, position: state.position}), React.createElement(_components_1.Router, {state: state}), React.createElement(_components_1.Alert, {alert: state.alert})));
3734
};
3835
default_1.childContextTypes = {
3936
muiTheme: React.PropTypes.object,

lib/components/menu/menu.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ var default_1 = (function (_super) {
3939
default_1.prototype.menuOptions = function () {
4040
switch (this.props.route) {
4141
case 'page':
42-
return (React.createElement("div", null,
43-
React.createElement(material_ui_1.MenuItem, {primaryText: 'progress', onClick: this.props.routeToProgress}),
44-
React.createElement(material_ui_1.MenuItem, {primaryText: 'projects', onClick: this.props.routeToProjects})));
42+
return (React.createElement("div", null, React.createElement(material_ui_1.MenuItem, {primaryText: 'progress', onClick: this.props.routeToProgress}), React.createElement(material_ui_1.MenuItem, {primaryText: 'projects', onClick: this.props.routeToProjects})));
4543
case 'progress':
4644
return React.createElement(material_ui_1.MenuItem, {primaryText: 'projects', onClick: this.props.routeToProjects});
4745
default: return null;
@@ -51,17 +49,7 @@ var default_1 = (function (_super) {
5149
render_1.togglePanel();
5250
};
5351
default_1.prototype.render = function () {
54-
return (React.createElement(material_ui_1.AppBar, {title: 'CodeRoad', className: 'cr-menu-bar', iconElementLeft: React.createElement(material_ui_1.IconButton, {onClick: this.closePanel},
55-
React.createElement(NavigationClose, null)
56-
), iconElementRight: React.createElement(material_ui_1.IconMenu, {iconButtonElement: React.createElement(material_ui_1.IconButton, null,
57-
React.createElement(MoreVertIcon, null)
58-
), targetOrigin: { horizontal: 'right', vertical: 'top' }, anchorOrigin: { horizontal: 'right', vertical: 'top' }},
59-
this.menuOptions(),
60-
window.coderoad.issuesPath ? React.createElement(material_ui_1.MenuItem, null,
61-
React.createElement("a", {href: window.coderoad.issuesPath}, "post issue")
62-
) : null,
63-
React.createElement(material_ui_1.Divider, null),
64-
React.createElement(material_ui_1.MenuItem, {primaryText: 'quit', onClick: this.props.quit}))}));
52+
return (React.createElement(material_ui_1.AppBar, {title: 'CodeRoad', className: 'cr-menu-bar', iconElementLeft: React.createElement(material_ui_1.IconButton, {onClick: this.closePanel}, React.createElement(NavigationClose, null)), iconElementRight: React.createElement(material_ui_1.IconMenu, {iconButtonElement: React.createElement(material_ui_1.IconButton, null, React.createElement(MoreVertIcon, null)), targetOrigin: { horizontal: 'right', vertical: 'top' }, anchorOrigin: { horizontal: 'right', vertical: 'top' }}, this.menuOptions(), window.coderoad.issuesPath ? React.createElement(material_ui_1.MenuItem, null, React.createElement("a", {href: window.coderoad.issuesPath}, "post issue")) : null, React.createElement(material_ui_1.Divider, null), React.createElement(material_ui_1.MenuItem, {primaryText: 'quit', onClick: this.props.quit}))}));
6553
};
6654
default_1 = __decorate([
6755
react_redux_1.connect(null, function (dispatch) {

lib/components/page/chapter.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,5 @@ var _components_1 = require('../_components');
44
Object.defineProperty(exports, "__esModule", { value: true });
55
exports.default = function (_a) {
66
var chapter = _a.chapter;
7-
return (React.createElement("section", {className: 'cr-chapter'},
8-
React.createElement(_components_1.MarkdownText, {text: chapter.title})
9-
));
7+
return (React.createElement("section", {className: 'cr-chapter'}, React.createElement(_components_1.MarkdownText, {text: chapter.title})));
108
};

lib/components/page/edit.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
66
exports.default = function (editPath) {
77
if (editPath && window.coderoad.edit) {
88
var repoPath = path.join(window.coderoad.repo, 'edit', 'master', editPath);
9-
return React.createElement("a", {href: repoPath},
10-
React.createElement(Edit, {style: { position: 'absolute', top: '10px', right: '10px' }})
11-
);
9+
return React.createElement("a", {href: repoPath}, React.createElement(Edit, {style: { position: 'absolute', top: '10px', right: '10px' }}));
1210
}
1311
};

lib/components/page/page.js

Lines changed: 24 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -95,60 +95,30 @@ var default_1 = (function (_super) {
9595
var taskPosition = this.props.taskPosition;
9696
var currentTask = taskPosition <= tasks.length ? tasks[taskPosition] : null;
9797
var allComplete = taskPosition >= tasks.length;
98-
return (React.createElement(material_ui_1.Paper, {style: style, zDepth: 1, className: 'cr-page'},
99-
React.createElement(material_ui_1.Card, null,
100-
React.createElement(material_ui_1.CardHeader, {title: page.title, subtitle: page.description}),
101-
React.createElement(material_ui_1.CardText, null,
102-
React.createElement(_components_1.MarkdownText, {text: page.explanation})
103-
)),
104-
React.createElement(material_ui_1.Divider, null),
105-
React.createElement(material_ui_1.List, {subheader: 'Tasks', className: 'cr-tasks', ref: 'tasks'}, tasks.map(function (task, index) {
106-
var isCurrentTask = index === taskPosition;
107-
var isDisabledTask = index > taskPosition;
108-
var isCompletedTask = index < taskPosition;
109-
var isFinalTask = index >= tasks.length - 1;
110-
var hints = _this.hintsShown(task);
111-
return (React.createElement("div", null,
112-
React.createElement(material_ui_1.ListItem, {ref: 'task' + index, className: classNames({
113-
'cr-task': true,
114-
'isCompletedTask': isCompletedTask,
115-
'isCurrentTask': isCurrentTask,
116-
'isDisabledTask': isDisabledTask
117-
})},
118-
React.createElement("span", {className: 'cr-task-checkbox'}, _this.getIcon(index, taskPosition)),
119-
React.createElement("span", {className: 'cr-task-index'},
120-
index + 1,
121-
"."),
122-
React.createElement("div", {className: 'cr-task-description'},
123-
React.createElement(_components_1.MarkdownText, {text: task.description})
124-
)),
125-
isCurrentTask && hints ?
126-
hints.map(function (hint, indexHint) {
127-
return React.createElement(material_ui_1.ListItem, {className: 'cr-task-hint', ref: 'hint' + indexHint},
128-
React.createElement("div", {class: 'cr-task-hint-box'},
129-
React.createElement("span", {className: 'cr-task-hint-index'},
130-
indexHint + 1,
131-
"."),
132-
React.createElement("div", {className: 'cr-task-hint-description'},
133-
React.createElement(_components_1.MarkdownText, {text: hint})
134-
))
135-
);
136-
})
137-
: null,
138-
isFinalTask ? null : React.createElement(material_ui_1.Divider, null)));
139-
})),
140-
React.createElement("section", {className: 'cr-page-toolbar'},
141-
React.createElement(material_ui_1.LinearProgress, {mode: 'determinate', value: taskProgress(taskPosition, tasks.length), style: { height: '6px' }}),
142-
React.createElement(material_ui_1.Toolbar, null,
143-
currentTask && currentTask.hints && currentTask.hints.length ?
144-
React.createElement(material_ui_1.ToolbarGroup, {float: 'left'}, this.state.hintPos <= currentTask.hints.length - 2 ?
145-
React.createElement(material_ui_1.FlatButton, {className: 'cr-task-showHint', icon: React.createElement(InfoOutline, null), onClick: this.displayHint.bind(this, currentTask)})
146-
: React.createElement(material_ui_1.FlatButton, {className: 'cr-task-showHint-disabled', icon: React.createElement(Info, null), disabled: true}))
147-
: null,
148-
React.createElement(material_ui_1.ToolbarGroup, {float: 'right'}, allComplete ?
149-
React.createElement(material_ui_1.RaisedButton, {label: 'Continue', primary: true, onClick: this.props.callNextPage})
150-
:
151-
React.createElement(material_ui_1.RaisedButton, {label: 'Run', secondary: true, onClick: this.props.callRunTests}))))));
98+
return (React.createElement(material_ui_1.Paper, {style: style, zDepth: 1, className: 'cr-page'}, React.createElement(material_ui_1.Card, null, React.createElement(material_ui_1.CardHeader, {title: page.title, subtitle: page.description}), React.createElement(material_ui_1.CardText, null, React.createElement(_components_1.MarkdownText, {text: page.explanation}))), React.createElement(material_ui_1.Divider, null), React.createElement(material_ui_1.List, {subheader: 'Tasks', className: 'cr-tasks', ref: 'tasks'}, tasks.map(function (task, index) {
99+
var isCurrentTask = index === taskPosition;
100+
var isDisabledTask = index > taskPosition;
101+
var isCompletedTask = index < taskPosition;
102+
var isFinalTask = index >= tasks.length - 1;
103+
var hints = _this.hintsShown(task);
104+
return (React.createElement("div", null, React.createElement(material_ui_1.ListItem, {ref: 'task' + index, className: classNames({
105+
'cr-task': true,
106+
'isCompletedTask': isCompletedTask,
107+
'isCurrentTask': isCurrentTask,
108+
'isDisabledTask': isDisabledTask
109+
})}, React.createElement("span", {className: 'cr-task-checkbox'}, _this.getIcon(index, taskPosition)), React.createElement("span", {className: 'cr-task-index'}, index + 1, "."), React.createElement("div", {className: 'cr-task-description'}, React.createElement(_components_1.MarkdownText, {text: task.description}))), isCurrentTask && hints ?
110+
hints.map(function (hint, indexHint) {
111+
return React.createElement(material_ui_1.ListItem, {className: 'cr-task-hint', ref: 'hint' + indexHint}, React.createElement("div", {class: 'cr-task-hint-box'}, React.createElement("span", {className: 'cr-task-hint-index'}, indexHint + 1, "."), React.createElement("div", {className: 'cr-task-hint-description'}, React.createElement(_components_1.MarkdownText, {text: hint}))));
112+
})
113+
: null, isFinalTask ? null : React.createElement(material_ui_1.Divider, null)));
114+
})), React.createElement("section", {className: 'cr-page-toolbar'}, React.createElement(material_ui_1.LinearProgress, {mode: 'determinate', value: taskProgress(taskPosition, tasks.length), style: { height: '6px' }}), React.createElement(material_ui_1.Toolbar, null, currentTask && currentTask.hints && currentTask.hints.length ?
115+
React.createElement(material_ui_1.ToolbarGroup, {float: 'left'}, this.state.hintPos <= currentTask.hints.length - 2 ?
116+
React.createElement(material_ui_1.FlatButton, {className: 'cr-task-showHint', icon: React.createElement(InfoOutline, null), onClick: this.displayHint.bind(this, currentTask)})
117+
: React.createElement(material_ui_1.FlatButton, {className: 'cr-task-showHint-disabled', icon: React.createElement(Info, null), disabled: true}))
118+
: null, React.createElement(material_ui_1.ToolbarGroup, {float: 'right'}, allComplete ?
119+
React.createElement(material_ui_1.RaisedButton, {label: 'Continue', primary: true, onClick: this.props.callNextPage})
120+
:
121+
React.createElement(material_ui_1.RaisedButton, {label: 'Run', secondary: true, onClick: this.props.callRunTests}))))));
152122
};
153123
default_1 = __decorate([
154124
react_redux_1.connect(null, function (dispatch, state) {

lib/components/progress/progress.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ var React = require('react');
1717
var react_redux_1 = require('react-redux');
1818
var Action = require('../../actions/actions');
1919
var material_ui_1 = require('material-ui');
20+
var classNames = require('classnames');
2021
var Completed = require('material-ui/lib/svg-icons/toggle/check-box');
2122
var Current = require('material-ui/lib/svg-icons/av/play-circle-filled');
2223
var AllCompleted = require('material-ui/lib/svg-icons/action/done-all');
@@ -89,16 +90,14 @@ var style = {
8990
Object.defineProperty(exports, "__esModule", { value: true });
9091
exports.default = function (_a) {
9192
var progress = _a.progress, position = _a.position;
92-
return (React.createElement(material_ui_1.Paper, {style: style, zDepth: 1, className: 'cr-progress'},
93-
React.createElement(material_ui_1.List, {subheader: 'Progress'}, progress.chapters.map(function (chapter, chapterIndex) {
94-
var isActive = chapterIndex === position.chapter;
95-
return React.createElement(material_ui_1.ListItem, {primaryText: (chapterIndex + 1) + ". " + chapter.title, className: classNames({
96-
'chapter': true,
97-
'isActive': isActive
98-
}), secondaryText: chapter.description, secondaryTextLines: chapter.description.length > 35 ? 2 : 1, initiallyOpen: chapterIndex === 0, leftIcon: chapter.completed ? React.createElement(AllCompleted, null) : null, primaryTogglesNestedList: chapterIndex === position.chapter && !chapter.completed, nestedItems: chapter.pages.map(function (page, pageIndex) {
99-
var itemPosition = { chapter: chapterIndex, page: pageIndex };
100-
return React.createElement(ProgressPage, {page: page, itemPosition: itemPosition, position: position});
101-
})});
102-
}))
103-
));
93+
return (React.createElement(material_ui_1.Paper, {style: style, zDepth: 1, className: 'cr-progress'}, React.createElement(material_ui_1.List, {subheader: 'Progress'}, progress.chapters.map(function (chapter, chapterIndex) {
94+
var isActive = chapterIndex === position.chapter;
95+
return React.createElement(material_ui_1.ListItem, {primaryText: (chapterIndex + 1) + ". " + chapter.title, className: classNames({
96+
'chapter': true,
97+
'isActive': isActive
98+
}), secondaryText: chapter.description, secondaryTextLines: chapter.description.length > 35 ? 2 : 1, initiallyOpen: chapterIndex === 0, leftIcon: chapter.completed ? React.createElement(AllCompleted, null) : null, primaryTogglesNestedList: chapterIndex === position.chapter && !chapter.completed, nestedItems: chapter.pages.map(function (page, pageIndex) {
99+
var itemPosition = { chapter: chapterIndex, page: pageIndex };
100+
return React.createElement(ProgressPage, {page: page, itemPosition: itemPosition, position: position});
101+
})});
102+
}))));
104103
};

lib/components/projects/projects.js

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,10 @@ var Projects = (function (_super) {
3636
};
3737
Projects.prototype.render = function () {
3838
var _this = this;
39-
return (React.createElement(material_ui_1.Paper, {className: 'cr-projects'},
40-
React.createElement("div", {className: 'cr-projects-header'},
41-
React.createElement("span", {className: 'title'}, "CodeRoad"),
42-
React.createElement("p", {className: 'tagline'}, "Tutorials in the Editor"),
43-
React.createElement("div", {className: 'cr-tutorials'},
44-
React.createElement(material_ui_1.List, {subheader: 'Tutorials'},
45-
window.coderoad.dir ? null : React.createElement(material_ui_1.ListItem, {primaryText: 'Create an Atom Project', secondaryText: 'File > Open > any older'}),
46-
this.props.tutorials.length > 0 ?
47-
this.props.tutorials.map(function (tutorial) {
48-
return (React.createElement(material_ui_1.ListItem, {primaryText: _this.trim(tutorial), onClick: _this.props.selectProject.bind(_this, tutorial)}));
49-
}) : React.createElement(material_ui_1.ListItem, {primaryText: 'Try a Demo', secondaryText: 'npm i -s coderoad-functional-school'})),
50-
React.createElement("br", null),
51-
React.createElement(material_ui_1.RaisedButton, {label: 'Load Tutorials', secondary: true, onClick: this.load.bind(this)})),
52-
React.createElement("p", {className: 'notes'}, "Beta"))
53-
));
39+
return (React.createElement(material_ui_1.Paper, {className: 'cr-projects'}, React.createElement("div", {className: 'cr-projects-header'}, React.createElement("span", {className: 'title'}, "CodeRoad"), React.createElement("p", {className: 'tagline'}, "Tutorials in the Editor"), React.createElement("div", {className: 'cr-tutorials'}, React.createElement(material_ui_1.List, {subheader: 'Tutorials'}, window.coderoad.dir ? null : React.createElement(material_ui_1.ListItem, {primaryText: 'Create an Atom Project', secondaryText: 'File > Open > any older'}), this.props.tutorials.length > 0 ?
40+
this.props.tutorials.map(function (tutorial) {
41+
return (React.createElement(material_ui_1.ListItem, {primaryText: _this.trim(tutorial), onClick: _this.props.selectProject.bind(_this, tutorial)}));
42+
}) : React.createElement(material_ui_1.ListItem, {primaryText: 'Try a Demo', secondaryText: 'npm i -s coderoad-functional-school'})), React.createElement("br", null), React.createElement(material_ui_1.RaisedButton, {label: 'Load Tutorials', secondary: true, onClick: this.load.bind(this)})), React.createElement("p", {className: 'notes'}, "Beta"))));
5443
};
5544
Projects = __decorate([
5645
react_redux_1.connect(null, function (dispatch) {

lib/components/render.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ var app_1 = require('./app/app');
88
require('./remove-later');
99
var rootName = 'crv';
1010
function render(target) {
11-
ReactDOM.render(React.createElement(react_redux_1.Provider, {store: _base_1.store},
12-
React.createElement(app_1.default, null)
13-
), target);
11+
ReactDOM.render(React.createElement(react_redux_1.Provider, {store: _base_1.store}, React.createElement(app_1.default, null)), target);
1412
}
1513
exports.render = render;
1614
function unmount(target) {

0 commit comments

Comments
 (0)