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

Commit85ce2d9

Browse files
committed
alert on update tutorial
1 parent63f7bce commit85ce2d9

File tree

16 files changed

+98
-86
lines changed

16 files changed

+98
-86
lines changed

‎lib/components/AppMenu/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var AppBar_1 = require('material-ui/AppBar');
44
varmenuIconLeft_1=require('./menuIconLeft');
55
varmenuRight_1=require('./menuRight');
66
varstyles={
7-
zIndex:'999 !important'
7+
zIndex:'1 !important'
88
};
99
exports.AppMenu=function(_a){
1010
varroute=_a.route;

‎lib/components/Page/Task/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ exports.Task = function (_a) {
2828
vartask=_a.task,taskPosition=_a.taskPosition,index=_a.index,testRun=_a.testRun;
2929
varbackgroundColor=getStatus(index,taskPosition,testRun);
3030
varcurrentTask=taskPosition===index;
31-
return(React.createElement(List_1.ListItem,{key:index,style:Object.assign({},styles,{backgroundColor:backgroundColor})},taskCheckbox_1.taskCheckbox(currentTask,testRun),React.createElement("span",{style:indexStyles},index+1,"."),React.createElement("div",{style:descriptionStyles},React.createElement(index_1.Markdown,null,task.description))));
31+
return(React.createElement(List_1.ListItem,{key:index,style:Object.assign({},styles,{backgroundColor:backgroundColor})},taskCheckbox_1.taskCheckbox(task,testRun),React.createElement("span",{style:indexStyles},index+1,"."),React.createElement("div",{style:descriptionStyles},React.createElement(index_1.Markdown,null,task.description))));
3232
};

‎lib/components/Tutorials/UpdateTutorial/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ var UpdateTutorial = (function (_super) {
2828
_super.apply(this,arguments);
2929
}
3030
UpdateTutorial.prototype.render=function(){
31-
var_a=this.props,name=_a.name,tutorialUpdate=_a.tutorialUpdate;
32-
return(React.createElement(update_1.default,{style:styles,color:colors_1.pink500,onTouchTap:tutorialUpdate.bind(this,name)}));
31+
var_a=this.props,tutorial=_a.tutorial,tutorialUpdate=_a.tutorialUpdate;
32+
return(React.createElement("span",null,React.createElement(update_1.default,{style:styles,color:colors_1.pink500,onTouchTap:tutorialUpdate.bind(this,tutorial.name)}),React.createElement("span",{style:{marginLeft:'10px'}},tutorial.latest)));
3333
};
3434
UpdateTutorial=__decorate([
3535
react_redux_1.connect(null,function(dispatch){

‎lib/components/Tutorials/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ var styles = {
1111
exports.Tutorials=function(_a){
1212
vartutorials=_a.tutorials;
1313
return(React.createElement("div",{style:styles},React.createElement(Table_1.Table,null,React.createElement(Table_1.TableHeader,{displaySelectAll:false,adjustForCheckbox:false},React.createElement(Table_1.TableRow,null,React.createElement(Table_1.TableHeaderColumn,null,"Tutorial"),React.createElement(Table_1.TableHeaderColumn,null,"Version"))),React.createElement(Table_1.TableBody,{displayRowCheckbox:false},tutorials.map(functiontutorialRow(tutorial,index){
14-
return(React.createElement(Table_1.TableRow,{key:index},React.createElement(Table_1.TableRowColumn,null,React.createElement(SelectTutorial_1.SelectTutorial,{tutorial:tutorial})),React.createElement(Table_1.TableRowColumn,null,tutorial.version,tutorial.latest
15-
?React.createElement(UpdateTutorial_1.UpdateTutorial,{name:tutorial.name})
14+
return(React.createElement(Table_1.TableRow,{key:index},React.createElement(Table_1.TableRowColumn,null,React.createElement(SelectTutorial_1.SelectTutorial,{tutorial:tutorial})),React.createElement(Table_1.TableRowColumn,null,tutorial.version,!!tutorial.latest
15+
?React.createElement(UpdateTutorial_1.UpdateTutorial,{tutorial:tutorial})
1616
:null)));
1717
}))),React.createElement("br",null),React.createElement(LoadTutorials_1.LoadTutorials,null)));
1818
};

‎lib/reducers/alert/index.js

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,65 +5,66 @@ var _alert = {
55
open:false,
66
action:'',
77
};
8+
varopen={
9+
open:true,
10+
pass:true,
11+
};
812
varcurrent=_alert;
913
functionalertReducer(alert,action){
1014
if(alert===void0){alert=_alert;}
1115
varstatusBarAlert=document.getElementsByClassName('cr-alert-replay')[0];
1216
switch(action.type){
1317
case_types_1.ALERT_REPLAY:
14-
returnObject.assign({},current,{open:true});
18+
returnObject.assign({},current,open);
1519
case_types_1.ALERT_TOGGLE:
1620
returnaction.payload.alert||_alert;
21+
case_types_1.TUTORIAL_UPDATE:
22+
current=Object.assign({},{
23+
message:"run `npm install --save-dev "+action.payload.name+"`",
24+
action:'note',
25+
duration:4000,
26+
},open);
27+
returncurrent;
1728
case_types_1.TEST_RESULT:
1829
varresult=action.payload.result;
1930
if(result.pass&&result.change>0){
2031
statusBarAlert.style.color='#73C990';
21-
current={
32+
current=Object.assign({},{
2233
message:result.msg,
23-
open:true,
24-
action:'pass',
2534
duration:result.duration||1500,
26-
};
35+
},open);
2736
returncurrent;
2837
}
2938
elseif(result.pass===false&&result.change<1){
3039
statusBarAlert.style.color='#FF4081';
31-
current={
40+
current=Object.assign({},{
3241
message:result.msg,
33-
open:true,
3442
action:'fail',
3543
duration:result.duration||2500,
36-
};
44+
},open);
3745
returncurrent;
3846
}
3947
statusBarAlert.style.color='#9DA5B4';
40-
current={
48+
current=Object.assign({},{
4149
message:result.msg,
42-
open:true,
4350
action:'note',
4451
duration:result.duration||2500,
45-
};
52+
},open);
4653
returncurrent;
4754
case_types_1.COMPLETE_PAGE:
48-
current={
55+
current=Object.assign({},{
4956
message:"Page "+(action.payload.position.page+1)+" Complete",
50-
open:true,
51-
action:'pass',
52-
};
57+
},open);
5358
returncurrent;
5459
case_types_1.COMPLETE_CHAPTER:
55-
current={
60+
current=Object.assign({},{
5661
message:"Chapter "+(action.payload.chapter+1)+" Complete",
57-
open:true,
58-
action:'pass',
59-
};
62+
},open);
6063
returncurrent;
6164
case_types_1.COMPLETE_TUTORIAL:
62-
current={
65+
current=Object.assign({},{
6366
message:'Tutorial Complete',
64-
open:true,
65-
action:'pass',
66-
};
67+
},open);
6768
returncurrent;
6869
default:
6970
returnalert;

‎lib/reducers/tutorials/index.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
"use strict";
22
var_types_1=require('../../actions/_types');
3-
varupdate_1=require('./update');
43
varstore_1=require('../../store');
54
varcheck_1=require('./check');
65
functiontutorialsReducer(tutorials,action){
76
if(tutorials===void0){tutorials=[];}
87
switch(action.type){
9-
case_types_1.TUTORIAL_UPDATE:
10-
update_1.tutorialUpdate(action.payload.name);
118
case_types_1.TUTORIALS_FIND:
129
varpackageJson=store_1.default.getState().packageJson;
1310
return([]

‎lib/reducers/tutorials/update.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
"use strict";
22
varcommand_line_1=require('../../services/command-line');
33
functiontutorialUpdate(name){
4-
alert(name);
4+
console.log("run \"npm install --save-dev "+name+"\"");
55
}
66
exports.tutorialUpdate=tutorialUpdate;
77
functioncanUpdateTutorial(name,currentVersion){
88
if(!navigator.onLine){
9-
returnfalse;
9+
returnnull;
1010
}
1111
return(command_line_1.default('npm',"outdated "+name).then(function(res){
1212
console.log(res);
@@ -20,7 +20,7 @@ function canUpdateTutorial(name, currentVersion) {
2020
returntrue;
2121
}
2222
}
23-
returnfalse;
23+
returnnull;
2424
}));
2525
}
2626
exports.canUpdateTutorial=canUpdateTutorial;

‎lib/services/command-line.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function commandLine(root, commands) {
1515
throwroot+' not found. Python may not be installed';
1616
}
1717
}
18-
varrun=child_process_1.exec(root+" "+commands);
18+
varrun=child_process_1.exec(""+root+(commands ?' '+commands :''));
1919
returnnewPromise(function(resolve,reject){
2020
run.stdout.on('data',function(data){returnresolve(data);});
2121
run.stderr.on('data',function(data){returnreject(data);});

‎src/components/AppMenu/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {menuIconLeft} from './menuIconLeft';
44
import{menuRight}from'./menuRight';
55

66
conststyles={
7-
zIndex:'999 !important'
7+
zIndex:'1 !important'
88
};
99

1010
exportconstAppMenu:React.StatelessComponent<{

‎src/components/Page/Task/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const Task: React.StatelessComponent<{
4040
key={index}
4141
style={Object.assign({},styles,{backgroundColor})}
4242
>
43-
{taskCheckbox(currentTask,testRun)}
43+
{taskCheckbox(task,testRun)}
4444
<spanstyle={indexStyles}>{index+1}.</span>
4545
<divstyle={descriptionStyles}>
4646
<Markdown>{task.description}</Markdown>

‎src/components/Tutorials/UpdateTutorial/index.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,19 @@ const styles = {
1515
};
1616
})
1717
exportclassUpdateTutorialextendsReact.Component<{
18-
name:string,tutorialUpdate?:any
18+
tutorial:Tutorial.Info,tutorialUpdate?:any
1919
},{}>{
2020
render(){
21-
const{name, tutorialUpdate}=this.props;
21+
const{tutorial, tutorialUpdate}=this.props;
2222
return(
23-
<Update
24-
style={styles}
25-
color={pink500}
26-
onTouchTap={tutorialUpdate.bind(this,name)}
27-
/>
23+
<span>
24+
<Update
25+
style={styles}
26+
color={pink500}
27+
onTouchTap={tutorialUpdate.bind(this,tutorial.name)}
28+
/>
29+
<spanstyle={{marginLeft:'10px'}}>{tutorial.latest}</span>
30+
</span>
2831
);
2932
}
3033
}

‎src/components/Tutorials/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,12 @@ export const Tutorials: React.StatelessComponent<{
3838
</TableRowColumn>
3939
<TableRowColumn>
4040
{tutorial.version}
41-
{tutorial.latest
42-
?<UpdateTutorialname={tutorial.name}/>
41+
42+
{!!tutorial.latest
43+
?<UpdateTutorialtutorial={tutorial}/>
4344
:null
4445
}
46+
4547
</TableRowColumn>
4648
</TableRow>
4749
);

‎src/reducers/alert/index.ts

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
import{
22
ALERT_REPLAY,ALERT_TOGGLE,TEST_RESULT,
3-
COMPLETE_PAGE,COMPLETE_CHAPTER,COMPLETE_TUTORIAL
3+
COMPLETE_PAGE,COMPLETE_CHAPTER,COMPLETE_TUTORIAL,
4+
TUTORIAL_UPDATE
45
}from'../../actions/_types';
56

67
const_alert:CR.Alert={
78
message:'',
89
open:false,
910
action:'',
1011
};
12+
constopen={
13+
open:true,
14+
pass:true,
15+
};
1116

1217
letcurrent:CR.Alert=_alert;
1318

@@ -17,61 +22,58 @@ export default function alertReducer(
1722
letstatusBarAlert=<HTMLElement>document.getElementsByClassName('cr-alert-replay')[0];
1823
switch(action.type){
1924
caseALERT_REPLAY:
20-
returnObject.assign({},current,{open:true});
25+
returnObject.assign({},current,open);
2126
caseALERT_TOGGLE:
2227
returnaction.payload.alert||_alert;
28+
caseTUTORIAL_UPDATE:
29+
current=Object.assign({},{
30+
message:`run \`npm install --save-dev${action.payload.name}\``,
31+
action:'note',
32+
duration:4000,
33+
},open);
34+
returncurrent;
2335
caseTEST_RESULT:
2436
letresult=action.payload.result;
2537
if(result.pass&&result.change>0){
2638
// Pass
2739
statusBarAlert.style.color='#73C990';
28-
current={
40+
current=Object.assign({},{
2941
message:result.msg,
30-
open:true,
31-
action:'pass',
3242
duration:result.duration||1500,
33-
};
43+
},open);
3444
returncurrent;
3545
}elseif(result.pass===false&&result.change<1){
3646
// Fail
3747
statusBarAlert.style.color='#FF4081';
38-
current={
48+
current=Object.assign({},{
3949
message:result.msg,
40-
open:true,
4150
action:'fail',
4251
duration:result.duration||2500,
43-
};
52+
},open);
4453
returncurrent;
4554
}
4655
// Alert
4756
statusBarAlert.style.color='#9DA5B4';
48-
current={
57+
current=Object.assign({},{
4958
message:result.msg,
50-
open:true,
5159
action:'note',
5260
duration:result.duration||2500,
53-
};
61+
},open);
5462
returncurrent;
5563
caseCOMPLETE_PAGE:
56-
current={
64+
current=Object.assign({},{
5765
message:`Page${action.payload.position.page+1} Complete`,
58-
open:true,
59-
action:'pass',
60-
};
66+
},open);
6167
returncurrent;
6268
caseCOMPLETE_CHAPTER:
63-
current={
69+
current=Object.assign({},{
6470
message:`Chapter${action.payload.chapter+1} Complete`,
65-
open:true,
66-
action:'pass',
67-
};
71+
},open);
6872
returncurrent;
6973
caseCOMPLETE_TUTORIAL:
70-
current={
74+
current=Object.assign({},{
7175
message:'Tutorial Complete',
72-
open:true,
73-
action:'pass',
74-
};
76+
},open);
7577
returncurrent;
7678
default:
7779
returnalert;

‎src/reducers/tutorials/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import{TUTORIAL_UPDATE,TUTORIALS_FIND}from'../../actions/_types';
1+
import{TUTORIALS_FIND}from'../../actions/_types';
22
import{tutorialUpdate}from'./update';
33
importstorefrom'../../store';
44
import{searchForTutorials}from'./check';
@@ -7,8 +7,8 @@ export default function tutorialsReducer(
77
tutorials=[],action:Action
88
):Tutorial.Info[]{
99
switch(action.type){
10-
caseTUTORIAL_UPDATE:
11-
tutorialUpdate(action.payload.name);
10+
//case TUTORIAL_UPDATE:
11+
// tutorialUpdate(action.payload.name);
1212
/* falls through */
1313
caseTUTORIALS_FIND:
1414
constpackageJson=store.getState().packageJson;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp