Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9134f38

Browse files
committed
page/chapter/tutorial complete alert
1 parent4f58b21 commit9134f38

File tree

21 files changed

+189
-98
lines changed

21 files changed

+189
-98
lines changed

‎lib/actions/actions.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ exports.pageComplete = progress_actions_1.pageComplete;
4242
exports.chapterComplete=progress_actions_1.chapterComplete;
4343
exports.projectComplete=progress_actions_1.projectComplete;
4444
vartask_actions_1=require('./task-actions');
45-
exports.setTaskPosition=task_actions_1.setTaskPosition;
4645
exports.showHint=task_actions_1.showHint;
4746
exports.runTests=task_actions_1.runTests;
4847
exports.testComplete=task_actions_1.testComplete;

‎lib/actions/progress-actions.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,19 @@ var _base_1 = require('../_base');
44
functionpageComplete(){
55
varposition=_base_1.store.getState().position;
66
varpageLength=_base_1.store.getState().progress.chapters[position.chapter].pages.length;
7-
varaction={type:Type.PAGE_COMPLETE,payload:{position:position}};
87
if(position.page>=pageLength-1){
9-
_base_1.store.dispatch(chapterComplete());
10-
returnaction;
8+
returnchapterComplete();
119
}
12-
returnaction;
10+
return{type:Type.PAGE_COMPLETE,payload:{position:position}};
1311
}
1412
exports.pageComplete=pageComplete;
1513
functionchapterComplete(){
1614
varchapter=_base_1.store.getState().position.chapter;
1715
varchapterLength=_base_1.store.getState().progress.chapters.length;
18-
varaction={type:Type.CHAPTER_COMPLETE,payload:{chapter:chapter}};
1916
if(chapter>=chapterLength-1){
20-
_base_1.store.dispatch(projectComplete());
21-
returnaction;
17+
returnprojectComplete();
2218
}
23-
returnaction;
19+
return{type:Type.CHAPTER_COMPLETE,payload:{chapter:chapter}};
2420
}
2521
exports.chapterComplete=chapterComplete;
2622
functionprojectComplete(){

‎lib/actions/task-actions.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,6 @@
11
"use strict";
22
varType=require('./actionTypes');
3-
varAction=require('./actions');
43
var_base_1=require('../_base');
5-
functioncheckPageComplete(taskPosition){
6-
vartaskLength=_base_1.store.getState().taskTests.length;
7-
if(taskPosition>taskLength){
8-
_base_1.store.dispatch(Action.pageComplete());
9-
}
10-
}
11-
functionsetTaskPosition(taskPosition){
12-
varcurrentTaskPosition=_base_1.store.getState().taskPosition;
13-
if(currentTaskPosition===taskPosition){
14-
return{type:Type.NULL};
15-
}
16-
checkPageComplete(taskPosition);
17-
return{type:Type.SET_TASK_POSITION,payload:{taskPosition:taskPosition}};
18-
}
19-
exports.setTaskPosition=setTaskPosition;
204
functionshowHint(){
215
return{type:Type.SHOW_HINT};
226
}

‎lib/components/account/account.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ 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'},React.createElement("h3",null,"Account")));
14+
return(React.createElement("section",{className:'cr-account'},
15+
React.createElement("h3",null,"Account")
16+
));
1517
};
1618
returndefault_1;
1719
}(React.Component));

‎lib/components/app/app.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ var default_1 = (function (_super) {
3030
};
3131
default_1.prototype.render=function(){
3232
varstate=this.props.state;
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})));
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})));
3437
};
3538
default_1.childContextTypes={
3639
muiTheme:React.PropTypes.object,

‎lib/components/menu/menu.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ 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,React.createElement(material_ui_1.MenuItem,{primaryText:'progress',onClick:this.props.routeToProgress}),React.createElement(material_ui_1.MenuItem,{primaryText:'projects',onClick:this.props.routeToProjects})));
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})));
4345
case'progress':
4446
returnReact.createElement(material_ui_1.MenuItem,{primaryText:'projects',onClick:this.props.routeToProjects});
4547
default:returnnull;
@@ -49,7 +51,17 @@ var default_1 = (function (_super) {
4951
render_1.togglePanel();
5052
};
5153
default_1.prototype.render=function(){
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}))}));
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}))}));
5365
};
5466
default_1=__decorate([
5567
react_redux_1.connect(null,function(dispatch){

‎lib/components/page/chapter.js

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

‎lib/components/page/edit.js

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

‎lib/components/page/page.js

Lines changed: 54 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -95,30 +95,60 @@ var default_1 = (function (_super) {
9595
vartaskPosition=this.props.taskPosition;
9696
varcurrentTask=taskPosition<=tasks.length ?tasks[taskPosition] :null;
9797
varallComplete=taskPosition>=tasks.length;
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-
varisCurrentTask=index===taskPosition;
100-
varisDisabledTask=index>taskPosition;
101-
varisCompletedTask=index<taskPosition;
102-
varisFinalTask=index>=tasks.length-1;
103-
varhints=_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-
returnReact.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}))))));
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+
varisCurrentTask=index===taskPosition;
107+
varisDisabledTask=index>taskPosition;
108+
varisCompletedTask=index<taskPosition;
109+
varisFinalTask=index>=tasks.length-1;
110+
varhints=_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+
returnReact.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}))))));
122152
};
123153
default_1=__decorate([
124154
react_redux_1.connect(null,function(dispatch,state){

‎lib/components/progress/progress.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,16 @@ var style = {
9090
Object.defineProperty(exports,"__esModule",{value:true});
9191
exports.default=function(_a){
9292
varprogress=_a.progress,position=_a.position;
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-
varisActive=chapterIndex===position.chapter;
95-
returnReact.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-
varitemPosition={chapter:chapterIndex,page:pageIndex};
100-
returnReact.createElement(ProgressPage,{page:page,itemPosition:itemPosition,position:position});
101-
})});
102-
}))));
93+
return(React.createElement(material_ui_1.Paper,{style:style,zDepth:1,className:'cr-progress'},
94+
React.createElement(material_ui_1.List,{subheader:'Progress'},progress.chapters.map(function(chapter,chapterIndex){
95+
varisActive=chapterIndex===position.chapter;
96+
returnReact.createElement(material_ui_1.ListItem,{primaryText:(chapterIndex+1)+". "+chapter.title,className:classNames({
97+
'chapter':true,
98+
'isActive':isActive
99+
}),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){
100+
varitemPosition={chapter:chapterIndex,page:pageIndex};
101+
returnReact.createElement(ProgressPage,{page:page,itemPosition:itemPosition,position:position});
102+
})});
103+
}))
104+
));
103105
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp