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

Commitde8e020

Browse files
committed
page continue progress
1 parent0395e66 commitde8e020

File tree

12 files changed

+52
-37
lines changed

12 files changed

+52
-37
lines changed

‎lib/actions/tutorials.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ function isTutorial(name) {
4444
}
4545
returnfalse;
4646
}
47-
functionsearchForTutorials(location){
48-
if(!!location&&Object.keys(location).length>0){
49-
returnObject.keys(location).filter(function(name){returnisTutorial(name);});
47+
functionsearchForTutorials(deps){
48+
if(!!deps&&Object.keys(deps).length>0){
49+
returnObject.keys(deps).filter(function(name){returnisTutorial(name);});
5050
}
5151
else{
5252
return[];

‎lib/components/page/page.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var ReactDOM = require('react-dom');
1818
varreact_redux_1=require('react-redux');
1919
varAction=require('../../actions/actions');
2020
var_components_1=require('../_components');
21-
varclassNames=require('classnames');
21+
varclassnames=require('classnames');
2222
variconPath='material-ui/lib/svg-icons/';
2323
varmaterial_ui_1=require('material-ui');
2424
varcolors_1=require('material-ui/lib/styles/colors');
@@ -109,7 +109,7 @@ var default_1 = (function (_super) {
109109
varisFinalTask=index>=tasks.length-1;
110110
varhints=_this.hintsShown(task);
111111
return(React.createElement("div",null,
112-
React.createElement(material_ui_1.ListItem,{ref:'task'+index,className:classNames({
112+
React.createElement(material_ui_1.ListItem,{ref:'task'+index,className:classnames({
113113
'cr-task':true,
114114
'isCompletedTask':isCompletedTask,
115115
'isCurrentTask':isCurrentTask,
@@ -135,7 +135,12 @@ var default_1 = (function (_super) {
135135
);
136136
})
137137
:null,
138-
isFinalTask ?null :React.createElement(material_ui_1.Divider,null)));
138+
isFinalTask ?null :React.createElement(material_ui_1.Divider,null),
139+
page.completed&&page.continue ?React.createElement(material_ui_1.ListItem,{className:'cr-task-continue',ref:'continue'},
140+
React.createElement("div",{className:'cr-task-continue-description'},
141+
React.createElement(_components_1.MarkdownText,{text:page.continue})
142+
)
143+
) :null));
139144
})),
140145
React.createElement("section",{className:'cr-page-toolbar'},
141146
React.createElement(material_ui_1.LinearProgress,{mode:'determinate',value:taskProgress(taskPosition,tasks.length),style:{height:'6px'}}),

‎lib/components/progress/progress.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var React = require('react');
1717
varreact_redux_1=require('react-redux');
1818
varAction=require('../../actions/actions');
1919
varmaterial_ui_1=require('material-ui');
20-
varclassNames=require('classnames');
20+
varclassnames=require('classnames');
2121
varCompleted=require('material-ui/lib/svg-icons/toggle/check-box');
2222
varCurrent=require('material-ui/lib/svg-icons/av/play-circle-filled');
2323
varAllCompleted=require('material-ui/lib/svg-icons/action/done-all');
@@ -62,7 +62,7 @@ var ProgressPage = (function (_super) {
6262
varitemPosition=this.props.itemPosition;
6363
varposition=this.props.position;
6464
varisActive=itemPosition.chapter===position.chapter&&itemPosition.page===position.page;
65-
return(React.createElement(material_ui_1.ListItem,{key:itemPosition.page,className:classNames({
65+
return(React.createElement(material_ui_1.ListItem,{key:itemPosition.page,className:classnames({
6666
'cr-page':true,
6767
'cr-page-isDisabled':!this.canActivate(isActive,itemPosition,position)
6868
}),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}));
@@ -93,7 +93,7 @@ exports.default = function (_a) {
9393
return(React.createElement(material_ui_1.Paper,{style:style,zDepth:1,className:'cr-progress'},
9494
React.createElement(material_ui_1.List,{subheader:'Progress'},progress.chapters.map(function(chapter,chapterIndex){
9595
varisActive=chapterIndex===position.chapter;
96-
returnReact.createElement(material_ui_1.ListItem,{primaryText:(chapterIndex+1)+". "+chapter.title,className:classNames({
96+
returnReact.createElement(material_ui_1.ListItem,{primaryText:(chapterIndex+1)+". "+chapter.title,className:classnames({
9797
'chapter':true,
9898
'isActive':isActive
9999
}),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){

‎lib/reducers/page/page.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ function pageReducer(page, action) {
1111
switch(action.type){
1212
caseType.SET_PAGE:
1313
returnaction.payload.page;
14+
caseType.PAGE_COMPLETE:
15+
return{
16+
title:page.title,
17+
description:page.description,
18+
explanation:page.explanation,
19+
continue:page.continue,
20+
completed:true
21+
};
1422
default:
1523
returnpage;
1624
}

‎src/actions/task-actions.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,6 @@ import * as Type from './actionTypes';
22
import*asActionfrom'./actions';
33
import{store}from'../_base';
44

5-
// function checkPageComplete(taskPosition: number): void {
6-
// console.log(store.getState().taskTests);
7-
// const taskLength: number = store.getState().taskTests.length;
8-
// console.log('check', taskPosition, taskLength);
9-
// if (taskPosition > taskLength) {
10-
// store.dispatch(Action.pageComplete());
11-
// }
12-
// }
13-
14-
// export function setTaskPosition(taskPosition: number): CR.Action {
15-
// const currentTaskPosition: number = store.getState().taskPosition;
16-
// if (currentTaskPosition === taskPosition) {
17-
// return { type: Type.NULL };
18-
// }
19-
// checkPageComplete(taskPosition);
20-
// return { type: Type.SET_TASK_POSITION, payload: { taskPosition }};
21-
// }
22-
235
exportfunctionshowHint():CR.Action{
246
return{type:Type.SHOW_HINT};
257
}

‎src/actions/tutorials.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function loadRootPackageJson(): PackageJson {
3232
returnnull;
3333
}
3434

35-
functionisTutorial(name):boolean{
35+
functionisTutorial(name:string):boolean{
3636
letpathToTutorialPackageJson=path.join(window.coderoad.dir,'node_modules',name,'package.json');
3737
if(fileExists(pathToTutorialPackageJson)){
3838
// has package.json
@@ -49,9 +49,9 @@ function isTutorial(name): boolean {
4949
returnfalse;
5050
}
5151

52-
functionsearchForTutorials(location:Object):string[]{
53-
if(!!location&&Object.keys(location).length>0){
54-
returnObject.keys(location).filter((name)=>isTutorial(name));
52+
functionsearchForTutorials(deps:Object):string[]{
53+
if(!!deps&&Object.keys(deps).length>0){
54+
returnObject.keys(deps).filter((name)=>isTutorial(name));
5555
}else{
5656
return[];
5757
}

‎src/components/page/_page.less

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
bottom:0;
1717
right:0;
1818
width:400px;
19+
&-completed {
20+
height:200px;
21+
}
1922
}
2023
}
2124
.cr-tasks {

‎src/components/page/page.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as ReactDOM from 'react-dom';
44
import{connect}from'react-redux';
55
import*asActionfrom'../../actions/actions';
66
import{MarkdownText}from'../_components';
7-
constclassNames=require('classnames');
7+
import*asclassnamesfrom'classnames';
88
consticonPath='material-ui/lib/svg-icons/';
99

1010
import{Paper,Card,CardHeader,CardText,LinearProgress,Divider,
@@ -123,7 +123,7 @@ render() {
123123
<div>
124124
<ListItem
125125
ref={'task'+index}
126-
className={classNames({
126+
className={classnames({
127127
'cr-task':true,
128128
'isCompletedTask':isCompletedTask,
129129
'isCurrentTask':isCurrentTask,
@@ -145,6 +145,10 @@ render() {
145145
})
146146
:null}
147147
{isFinalTask ?null :<Divider/>}
148+
{page.completed&&page.continue ?<ListItemclassName='cr-task-continue'ref='continue'>
149+
<divclassName='cr-task-continue-description'><MarkdownTexttext={page.continue}/>
150+
</div>
151+
</ListItem>:null}
148152
</div>
149153
);
150154
})

‎src/components/progress/progress.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as React from 'react';
33
import{connect}from'react-redux';
44
import*asActionfrom'../../actions/actions';
55
import{Paper,List,ListItem,RaisedButton}from'material-ui';
6-
import*asclassNamesfrom'classnames';
6+
import*asclassnamesfrom'classnames';
77
letCompleted=require('material-ui/lib/svg-icons/toggle/check-box');
88
letCurrent=require('material-ui/lib/svg-icons/av/play-circle-filled');
99
letAllCompleted=require('material-ui/lib/svg-icons/action/done-all');
@@ -51,7 +51,7 @@ class ProgressPage extends React.Component<{page: CR.Page, itemPosition: CR.Posi
5151
constisActive=itemPosition.chapter===position.chapter&&itemPosition.page===position.page;
5252
return(<ListItem
5353
key={itemPosition.page}
54-
className={classNames({
54+
className={classnames({
5555
'cr-page':true,
5656
'cr-page-isDisabled':!this.canActivate(isActive,itemPosition,position)
5757
})}
@@ -82,7 +82,7 @@ export default ({progress, position}) => (
8282
{progress.chapters.map((chapter:CR.Chapter,chapterIndex:number)=>{
8383
constisActive=chapterIndex===position.chapter;
8484
return<ListItemprimaryText={`${chapterIndex+1}.${chapter.title}`}
85-
className={classNames({
85+
className={classnames({
8686
'chapter':true,
8787
'isActive':isActive
8888
})}

‎src/reducers/page/page.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ export default function pageReducer(page = defaultPage, action: CR.Action): CR.P
1111
switch(action.type){
1212
caseType.SET_PAGE:
1313
returnaction.payload.page;
14+
caseType.PAGE_COMPLETE:
15+
return{
16+
title:page.title,
17+
description:page.description,
18+
explanation:page.explanation,
19+
continue:page.continue,
20+
completed:true
21+
};
1422
default:
1523
returnpage;
1624
}

‎src/typings/cr/cr.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ declare namespace CR {
1212
interfacePageextendsInfo{
1313
explanation?:string;
1414
tasks?:Task[];
15+
continue?:string;
1516
}
16-
interfaceTaskextendsInfo{
17+
interfaceTask{
18+
description:string;
1719
tests?:string[];
1820
hints?:string[];
1921
actions?:string[];

‎styles/styles.less

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ pre {
7474
bottom:0;
7575
right:0;
7676
width:400px;
77+
&-completed {
78+
height:200px!important;
79+
}
7780
}
7881
}
7982
.cr-tasks {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp