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

Commit23e1ad9

Browse files
committed
hints handled differently
1 parent892f346 commit23e1ad9

File tree

18 files changed

+57
-174
lines changed

18 files changed

+57
-174
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
returndefault_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
varstate=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
returnReact.createElement(material_ui_1.MenuItem,{primaryText:'projects',onClick:this.props.routeToProjects});
4745
default:returnnull;
@@ -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
varchapter=_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
varmaterial_ui_1=require('material-ui');
55
functiondefault_1(_a){
66
varpage=_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
varrepoPath=path.join(window.coderoad.repo,'edit','master',editPath);
9-
returnReact.createElement("a",{href:repoPath},
10-
React.createElement(Edit,{style:{position:'absolute',top:'10px',right:'10px'}})
11-
);
9+
returnReact.createElement("a",{href:repoPath},React.createElement(Edit,{style:{position:'absolute',top:'10px',right:'10px'}}));
1210
}
1311
};

‎lib/components/page/hint.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ var react_redux_1 = require('react-redux');
1818
varAction=require('../../actions/actions');
1919
varmaterial_ui_1=require('material-ui');
2020
var_components_1=require('../_components');
21+
variconPath='material-ui/lib/svg-icons/';
22+
varHelp=require(iconPath+'action/help');
23+
varHelpOutline=require(iconPath+'action/help-outline');
2124
vardefault_1=(function(_super){
2225
__extends(default_1,_super);
2326
functiondefault_1(){
@@ -26,20 +29,14 @@ var default_1 = (function (_super) {
2629
default_1.prototype.render=function(){
2730
var_a=this.props,task=_a.task,hintPosition=_a.hintPosition,nextHint=_a.nextHint,prevHint=_a.prevHint;
2831
varhints=task&&task.hints ?task.hints :null;
29-
console.log(hintPosition);
32+
console.log(hintPosition,hints,nextHint);
3033
if(hintPosition<0||!hints||!hints.length){
3134
returnReact.createElement("div",null);
3235
}
3336
else{
3437
varhint=hints[hintPosition];
35-
return(React.createElement(material_ui_1.Card,{className:'cr-task-hints'},
36-
React.createElement(material_ui_1.CardHeader,{title:'Hints',actAsExpander:true,showExpandableButton:true}),
37-
React.createElement(material_ui_1.CardText,{className:'cr-task-hint',expandable:true},
38-
React.createElement(_components_1.MarkdownText,{text:hint})
39-
),
40-
React.createElement(material_ui_1.CardActions,{expandable:true},
41-
hintPosition>0 ?React.createElement(material_ui_1.FlatButton,{label:'Previous',onClick:prevHint.bind(this,hintPosition-1)}) :null,
42-
hintPosition<task.hints.length-1 ?React.createElement(material_ui_1.FlatButton,{label:'Next',onClick:nextHint.bind(this,hintPosition+1)}) :null)));
38+
return(React.createElement(material_ui_1.Card,{className:'cr-task-hints'},React.createElement(material_ui_1.CardHeader,{title:'Hints',avatar:React.createElement(Help,null),actAsExpander:true,showExpandableButton:true}),React.createElement(material_ui_1.CardText,{className:'cr-task-hint',expandable:true},React.createElement(_components_1.MarkdownText,{text:hint})),React.createElement(material_ui_1.CardActions,{expandable:true},hintPosition>0 ?React.createElement(material_ui_1.FlatButton,{label:'Previous',onClick:prevHint.bind(this,hintPosition-1)}) :React.createElement("div",null),hintPosition>=0&&hintPosition<hints.length-1 ?
39+
React.createElement(material_ui_1.FlatButton,{label:'Next',onClick:nextHint.bind(this,hintPosition+1)}) :React.createElement("div",null))));
4340
}
4441
};
4542
default_1=__decorate([

‎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
varpage=_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 & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +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
varcurrentTask=taskPosition<=tasks.length ?tasks[taskPosition] :null;
5151
varallComplete=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(task_1.Tasks,{tasks:tasks,taskPosition:taskPosition,runTests:runTests}),
56-
React.createElement(hint_1.default,{task:currentTask,hintPosition:hintPosition}),
57-
React.createElement(page_complete_1.PageCompleteMessage,{page:page}),
58-
React.createElement("div",{ref:'listEnd'}),
59-
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(task_1.Tasks,{tasks:tasks,taskPosition:taskPosition,runTests:runTests}),React.createElement(hint_1.default,{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})));
6053
};
6154
default_1=__decorate([
6255
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
varTaskIndex=function(_a){
2828
varindex=_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
varTaskContent=function(_a){
3432
vartask=_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
vartask=_a.task,taskPosition=_a.taskPosition,index=_a.index,runTests=_a.runTests;
@@ -45,10 +41,7 @@ exports.Task = function (_a) {
4541
elseif(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
vartasks=_a.tasks,taskPosition=_a.taskPosition,runTests=_a.runTests;

‎lib/components/page/toolbar.js

Lines changed: 6 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,9 @@ var React = require('react');
1717
varreact_redux_1=require('react-redux');
1818
varAction=require('../../actions/actions');
1919
varmaterial_ui_1=require('material-ui');
20-
variconPath='material-ui/lib/svg-icons/';
21-
varInfo=require(iconPath+'action/info');
22-
varInfoOutline=require(iconPath+'action/info-outline');
2320
varProgressBar=function(_a){
2421
varprogress=_a.progress;
25-
returnReact.createElement(material_ui_1.LinearProgress,{mode:'determinate',value:progress,style:{height:'6px'}});
22+
returnReact.createElement(material_ui_1.LinearProgress,{mode:'determinate',value:progress,style:{height:'8px'}});
2623
};
2724
functiontaskProgress(current,max){
2825
return(current/max)*100;
@@ -32,51 +29,22 @@ var default_1 = (function (_super) {
3229
functiondefault_1(){
3330
_super.apply(this,arguments);
3431
}
35-
default_1.prototype.displayHint=function(task){
36-
varhintPosition=this.props.hintPosition;
37-
if(task&&task.hints&&task.hints.length){
38-
if(hintPosition<task.hints.length-1){
39-
this.props.showHint(hintPosition+1);
40-
}
41-
}
42-
else{
43-
this.props.showHint(-1);
44-
}
45-
};
4632
default_1.prototype.render=function(){
4733
var_a=this.props,tasks=_a.tasks,taskPosition=_a.taskPosition,hintPosition=_a.hintPosition,callNextPage=_a.callNextPage,callRunTests=_a.callRunTests,showHint=_a.showHint;
4834
varcurrentTask=taskPosition<=tasks.length ?tasks[taskPosition] :null;
4935
varprogress=taskProgress(taskPosition,tasks.length);
5036
varallComplete=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})))));
37+
return(React.createElement("section",{className:'cr-page-toolbar'},React.createElement(ProgressBar,{progress:progress}),React.createElement(material_ui_1.Toolbar,null,React.createElement(material_ui_1.ToolbarGroup,{float:'right'},allComplete ?
38+
React.createElement(material_ui_1.RaisedButton,{label:'Continue',primary:true,onClick:callNextPage})
39+
:
40+
React.createElement(material_ui_1.RaisedButton,{label:'Run',secondary:true,onClick:callRunTests})))));
6341
};
6442
default_1=__decorate([
6543
react_redux_1.connect(null,function(dispatch,state){
6644
return{
6745
callNextPage:function(){returndispatch(Action.nextPage());},
6846
callRunTests:function(){returndispatch(Action.runTests());},
69-
toggleLog:function(){returndispatch(Action.toggleLog());},
70-
showHint:function(task,hintPosition){
71-
if(task&&task.hints&&task.hints.length){
72-
if(hintPosition<task.hints.length-1){
73-
dispatch(Action.setHintPosition(hintPosition+1));
74-
}
75-
}
76-
else{
77-
dispatch(Action.setHintPosition(-1));
78-
}
79-
}
47+
toggleLog:function(){returndispatch(Action.toggleLog());}
8048
};
8149
}),
8250
__metadata('design:paramtypes',[])

‎lib/components/progress/progress.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,14 @@ var style = {
7878
Object.defineProperty(exports,"__esModule",{value:true});
7979
exports.default=function(_a){
8080
varprogress=_a.progress,position=_a.position;
81-
return(React.createElement(material_ui_1.Paper,{style:style,zDepth:1,className:'cr-progress'},
82-
React.createElement(material_ui_1.List,{subheader:'Progress'},progress.chapters.map(function(chapter,chapterIndex){
83-
varisActive=chapterIndex===position.chapter;
84-
returnReact.createElement(material_ui_1.ListItem,{primaryText:(chapterIndex+1)+". "+chapter.title,className:classnames({
85-
'chapter':true,
86-
'isActive':isActive
87-
}),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){
88-
varitemPosition={chapter:chapterIndex,page:pageIndex};
89-
returnReact.createElement(ProgressPage,{page:page,itemPosition:itemPosition,position:position});
90-
})});
91-
}))
92-
));
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+
varisActive=chapterIndex===position.chapter;
83+
returnReact.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+
varitemPosition={chapter:chapterIndex,page:pageIndex};
88+
returnReact.createElement(ProgressPage,{page:page,itemPosition:itemPosition,position:position});
89+
})});
90+
}))));
9391
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp