Skip to content

Commit adbdb4f

Browse files
committed
fix progress button
1 parent ee390ea commit adbdb4f

File tree

16 files changed

+42
-129
lines changed

16 files changed

+42
-129
lines changed

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/content.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ var _components_1 = require('../_components');
44
var material_ui_1 = require('material-ui');
55
function default_1(_a) {
66
var page = _a.page;
7-
return (React.createElement(material_ui_1.Card, null,
8-
React.createElement(material_ui_1.CardHeader, {title: page.title}),
9-
React.createElement(material_ui_1.CardText, null,
10-
React.createElement(_components_1.MarkdownText, {text: page.description})
11-
)));
7+
return (React.createElement(material_ui_1.Card, null, React.createElement(material_ui_1.CardHeader, {title: page.title}), React.createElement(material_ui_1.CardText, null, React.createElement(_components_1.MarkdownText, {text: page.description}))));
128
}
139
Object.defineProperty(exports, "__esModule", { value: true });
1410
exports.default = default_1;

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/hint.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,7 @@ function hintsShown(task, hintPosition) {
1010
}
1111
exports.TaskHint = function (_a) {
1212
var hint = _a.hint, index = _a.index;
13-
return (React.createElement(material_ui_1.ListItem, {className: 'cr-task-hint', key: 'hint' + index},
14-
React.createElement("div", {class: 'cr-task-hint-box'},
15-
React.createElement("span", {className: 'cr-task-hint-index'},
16-
index + 1,
17-
"."),
18-
React.createElement("div", {className: 'cr-task-hint-description'},
19-
React.createElement(_components_1.MarkdownText, {text: hint})
20-
))
21-
));
13+
return (React.createElement(material_ui_1.ListItem, {className: 'cr-task-hint', key: 'hint' + index}, React.createElement("div", {class: 'cr-task-hint-box'}, React.createElement("span", {className: 'cr-task-hint-index'}, index + 1, "."), React.createElement("div", {className: 'cr-task-hint-description'}, React.createElement(_components_1.MarkdownText, {text: hint})))));
2214
};
2315
exports.TaskHints = function (_a) {
2416
var task = _a.task, hintPosition = _a.hintPosition;

lib/components/page/page-complete.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ var _components_1 = require('../_components');
55
exports.PageCompleteMessage = function (_a) {
66
var page = _a.page;
77
return (React.createElement("div", {className: 'cr-task-onComplete-description'}, page.completed && page.onPageComplete ?
8-
React.createElement(material_ui_1.ListItem, {className: 'cr-task-onComplete', key: 'page-complete'},
9-
React.createElement(_components_1.MarkdownText, {text: page.onPageComplete})
10-
)
8+
React.createElement(material_ui_1.ListItem, {className: 'cr-task-onComplete', key: 'page-complete'}, React.createElement(_components_1.MarkdownText, {text: page.onPageComplete}))
119
: null));
1210
};

lib/components/page/page.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,7 @@ var default_1 = (function (_super) {
4949
var _a = this.props, page = _a.page, taskPosition = _a.taskPosition, hintPosition = _a.hintPosition, tasks = _a.tasks, runTests = _a.runTests;
5050
var currentTask = taskPosition <= tasks.length ? tasks[taskPosition] : null;
5151
var allComplete = taskPosition >= tasks.length;
52-
return (React.createElement(material_ui_2.Paper, {style: style, zDepth: 1, className: 'cr-page'},
53-
React.createElement(content_1.default, {page: page}),
54-
React.createElement(material_ui_1.Divider, null),
55-
React.createElement(material_ui_1.List, {subheader: 'Tasks', className: 'cr-page-list', ref: 'tasks'},
56-
React.createElement(task_1.Tasks, {tasks: tasks, taskPosition: taskPosition, runTests: runTests}),
57-
React.createElement(hint_1.TaskHints, {task: currentTask, hintPosition: hintPosition}),
58-
React.createElement(page_complete_1.PageCompleteMessage, {page: page}),
59-
React.createElement("div", {ref: 'listEnd'})),
60-
React.createElement(toolbar_1.default, {tasks: tasks, taskPosition: taskPosition, hintPosition: hintPosition})));
52+
return (React.createElement(material_ui_2.Paper, {style: style, zDepth: 1, className: 'cr-page'}, React.createElement(content_1.default, {page: page}), React.createElement(material_ui_1.Divider, null), React.createElement(material_ui_1.List, {subheader: 'Tasks', className: 'cr-page-list', ref: 'tasks'}, React.createElement(task_1.Tasks, {tasks: tasks, taskPosition: taskPosition, runTests: runTests}), React.createElement(hint_1.TaskHints, {task: currentTask, hintPosition: hintPosition}), React.createElement(page_complete_1.PageCompleteMessage, {page: page}), React.createElement("div", {ref: 'listEnd'})), React.createElement(toolbar_1.default, {tasks: tasks, taskPosition: taskPosition, hintPosition: hintPosition})));
6153
};
6254
default_1 = __decorate([
6355
react_redux_1.connect(null, function (dispatch, state) {

lib/components/page/task.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,11 @@ var TaskCheckbox = function (_a) {
2626
};
2727
var TaskIndex = function (_a) {
2828
var index = _a.index;
29-
return (React.createElement("span", {className: 'cr-task-index'},
30-
index + 1,
31-
"."));
29+
return (React.createElement("span", {className: 'cr-task-index'}, index + 1, "."));
3230
};
3331
var TaskContent = function (_a) {
3432
var task = _a.task;
35-
return (React.createElement("div", {className: 'cr-task-description'},
36-
React.createElement(_components_1.MarkdownText, {text: task.description})
37-
));
33+
return (React.createElement("div", {className: 'cr-task-description'}, React.createElement(_components_1.MarkdownText, {text: task.description})));
3834
};
3935
exports.Task = function (_a) {
4036
var task = _a.task, taskPosition = _a.taskPosition, index = _a.index, runTests = _a.runTests;
@@ -45,10 +41,7 @@ exports.Task = function (_a) {
4541
else if (index === taskPosition) {
4642
taskClass += 'isCurrentTask';
4743
}
48-
return (React.createElement(material_ui_1.ListItem, {key: index, className: taskClass},
49-
React.createElement(TaskCheckbox, {index: index, taskPosition: taskPosition, runTests: runTests}),
50-
React.createElement(TaskIndex, {index: index}),
51-
React.createElement(TaskContent, {task: task})));
44+
return (React.createElement(material_ui_1.ListItem, {key: index, className: taskClass}, React.createElement(TaskCheckbox, {index: index, taskPosition: taskPosition, runTests: runTests}), React.createElement(TaskIndex, {index: index}), React.createElement(TaskContent, {task: task})));
5245
};
5346
exports.Tasks = function (_a) {
5447
var tasks = _a.tasks, taskPosition = _a.taskPosition, runTests = _a.runTests;

lib/components/page/toolbar.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,14 @@ var default_1 = (function (_super) {
4848
var currentTask = taskPosition <= tasks.length ? tasks[taskPosition] : null;
4949
var progress = taskProgress(taskPosition, tasks.length);
5050
var allComplete = taskPosition >= tasks.length;
51-
return (React.createElement("section", {className: 'cr-page-toolbar'},
52-
React.createElement(ProgressBar, {progress: progress}),
53-
React.createElement(material_ui_1.Toolbar, null,
54-
currentTask && currentTask.hints && currentTask.hints.length ?
55-
React.createElement(material_ui_1.ToolbarGroup, {float: 'left'}, hintPosition <= currentTask.hints.length - 2 ?
56-
React.createElement(material_ui_1.FlatButton, {className: 'cr-task-showHint', icon: React.createElement(InfoOutline, null), onClick: showHint.bind(this, currentTask, hintPosition)})
57-
: React.createElement(material_ui_1.FlatButton, {className: 'cr-task-showHint-disabled', icon: React.createElement(Info, null), disabled: true}))
58-
: null,
59-
React.createElement(material_ui_1.ToolbarGroup, {float: 'right'}, allComplete ?
60-
React.createElement(material_ui_1.RaisedButton, {label: 'Continue', primary: true, onClick: callNextPage})
61-
:
62-
React.createElement(material_ui_1.RaisedButton, {label: 'Run', secondary: true, onClick: callRunTests})))));
51+
return (React.createElement("section", {className: 'cr-page-toolbar'}, React.createElement(ProgressBar, {progress: progress}), React.createElement(material_ui_1.Toolbar, null, currentTask && currentTask.hints && currentTask.hints.length ?
52+
React.createElement(material_ui_1.ToolbarGroup, {float: 'left'}, hintPosition <= currentTask.hints.length - 2 ?
53+
React.createElement(material_ui_1.FlatButton, {className: 'cr-task-showHint', icon: React.createElement(InfoOutline, null), onClick: showHint.bind(this, currentTask, hintPosition)})
54+
: React.createElement(material_ui_1.FlatButton, {className: 'cr-task-showHint-disabled', icon: React.createElement(Info, null), disabled: true}))
55+
: null, React.createElement(material_ui_1.ToolbarGroup, {float: 'right'}, allComplete ?
56+
React.createElement(material_ui_1.RaisedButton, {label: 'Continue', primary: true, onClick: callNextPage})
57+
:
58+
React.createElement(material_ui_1.RaisedButton, {label: 'Run', secondary: true, onClick: callRunTests})))));
6359
};
6460
default_1 = __decorate([
6561
react_redux_1.connect(null, function (dispatch, state) {

lib/components/progress/progress.js

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ var react_redux_1 = require('react-redux');
1818
var Action = require('../../actions/actions');
1919
var material_ui_1 = require('material-ui');
2020
var classnames = require('classnames');
21+
var Colors = require('material-ui/lib/styles/colors');
2122
var Completed = require('material-ui/lib/svg-icons/toggle/check-box');
2223
var Current = require('material-ui/lib/svg-icons/av/play-circle-filled');
2324
var AllCompleted = require('material-ui/lib/svg-icons/action/done-all');
@@ -32,23 +33,12 @@ var ProgressPage = (function (_super) {
3233
return React.createElement(Completed, null);
3334
}
3435
else if (current) {
35-
return React.createElement(Current, null);
36+
return React.createElement(Current, {color: Colors.pink500});
3637
}
3738
else {
3839
return React.createElement(Incomplete, null);
3940
}
4041
};
41-
ProgressPage.prototype.getButton = function (isActive, itemPosition) {
42-
if (isActive && itemPosition.chapter === 0 && itemPosition.page === 0) {
43-
return React.createElement(material_ui_1.RaisedButton, {label: 'Start', primary: true, style: { height: '35px' }});
44-
}
45-
else if (isActive) {
46-
return React.createElement(material_ui_1.RaisedButton, {label: 'Continue', secondary: true, style: { height: '35px', width: '100px' }});
47-
}
48-
else {
49-
return null;
50-
}
51-
};
5242
ProgressPage.prototype.canActivate = function (isActive, itemPosition, position) {
5343
if (isActive && itemPosition.chapter <= position.chapter && itemPosition.page <= position.page) {
5444
return true;
@@ -63,7 +53,7 @@ var ProgressPage = (function (_super) {
6353
return (React.createElement(material_ui_1.ListItem, {key: itemPosition.page, className: classnames({
6454
'cr-page': true,
6555
'cr-page-isDisabled': !this.canActivate(isActive, itemPosition, position)
66-
}), primaryText: (itemPosition.page + 1) + ". " + page.title, secondaryText: page.description, secondaryTextLines: page.description.length > 50 ? 2 : 1, leftIcon: this.getProgressIcon(page.completed, isActive), rightIcon: this.getButton(isActive, itemPosition), onClick: this.canActivate(isActive, itemPosition, position) ? this.props.selectPage.bind(this, itemPosition) : null}));
56+
}), primaryText: (itemPosition.page + 1) + ". " + page.title, secondaryText: page.description, secondaryTextLines: page.description.length > 50 ? 2 : 1, leftIcon: this.getProgressIcon(page.completed, isActive), onClick: this.canActivate(isActive, itemPosition, position) ? this.props.selectPage.bind(this, itemPosition) : null}));
6757
};
6858
;
6959
ProgressPage = __decorate([
@@ -88,16 +78,14 @@ var style = {
8878
Object.defineProperty(exports, "__esModule", { value: true });
8979
exports.default = function (_a) {
9080
var progress = _a.progress, position = _a.position;
91-
return (React.createElement(material_ui_1.Paper, {style: style, zDepth: 1, className: 'cr-progress'},
92-
React.createElement(material_ui_1.List, {subheader: 'Progress'}, progress.chapters.map(function (chapter, chapterIndex) {
93-
var isActive = chapterIndex === position.chapter;
94-
return React.createElement(material_ui_1.ListItem, {primaryText: (chapterIndex + 1) + ". " + chapter.title, className: classnames({
95-
'chapter': true,
96-
'isActive': isActive
97-
}), 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) {
98-
var itemPosition = { chapter: chapterIndex, page: pageIndex };
99-
return React.createElement(ProgressPage, {page: page, itemPosition: itemPosition, position: position});
100-
})});
101-
}))
102-
));
81+
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) {
82+
var isActive = chapterIndex === position.chapter;
83+
return React.createElement(material_ui_1.ListItem, {primaryText: (chapterIndex + 1) + ". " + chapter.title, className: classnames({
84+
'chapter': true,
85+
'isActive': isActive
86+
}), 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) {
87+
var itemPosition = { chapter: chapterIndex, page: pageIndex };
88+
return React.createElement(ProgressPage, {page: page, itemPosition: itemPosition, position: position});
89+
})});
90+
}))));
10391
};

0 commit comments

Comments
 (0)