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

Commitd34e3d0

Browse files
committed
remove RAT, break ALERT_TOGGLE into OPEN & CLOSE
1 parentea9cc35 commitd34e3d0

File tree

22 files changed

+50
-55
lines changed

22 files changed

+50
-55
lines changed

‎lib/actions/_types.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
"use strict";
22
exports.ALERT_REPLAY='ALERT_REPLAY';
3-
exports.ALERT_TOGGLE='ALERT_TOGGLE';
3+
exports.ALERT_OPEN='ALERT_OPEN';
4+
exports.ALERT_CLOSE='ALERT_CLOSE';
45
exports.COMPLETE_PAGE='COMPLETE_PAGE';
56
exports.COMPLETE_TUTORIAL='COMPLETE_TUTORIAL';
67
exports.DEVTOOLS_TOGGLE='DEVTOOLS_TOGGLE';
78
exports.HINT_POSITION_SET='HINT_POSITION_SET';
89
exports.PAGE_SET='PAGE_SET';
9-
exports.PAGE_POSITION_SET='POSITION_SET';
1010
exports.PROGRESS_LOAD='PROGRESS_LOAD';
1111
exports.PROGRESS_PAGE_POSITION_LOAD='PROGRESS_PAGE_POSITION_LOAD';
1212
exports.QUIT='QUIT';

‎lib/actions/alert.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
"use strict";
22
var_types_1=require('./_types');
3-
functionalertToggle(alert){
3+
functionalertOpen(alert){
44
returnfunction(dispatch,getState){
5-
dispatch({type:_types_1.ALERT_TOGGLE,payload:{alert:alert}});
5+
dispatch({type:_types_1.ALERT_OPEN,payload:{alert:alert}});
66
};
77
}
8-
exports.alertToggle=alertToggle;
8+
exports.alertOpen=alertOpen;
99
functionalertReplay(){
1010
return{type:_types_1.ALERT_REPLAY};
1111
}
1212
exports.alertReplay=alertReplay;
13+
functionalertClose(){
14+
return{type:_types_1.ALERT_CLOSE};
15+
}
16+
exports.alertClose=alertClose;

‎lib/actions/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use strict";
22
varalert_1=require('./alert');
3-
exports.alertToggle=alert_1.alertToggle;
3+
exports.alertOpen=alert_1.alertOpen;
4+
exports.alertClose=alert_1.alertClose;
45
exports.alertReplay=alert_1.alertReplay;
56
varprogress_1=require('./progress');
67
exports.progressLoad=progress_1.progressLoad;
@@ -12,7 +13,6 @@ exports.hintPositionSet = hint_1.hintPositionSet;
1213
varpage_1=require('./page');
1314
exports.pageSet=page_1.pageSet;
1415
exports.pageNext=page_1.pageNext;
15-
exports.pagePositionSet=page_1.pagePositionSet;
1616
varroute_1=require('./route');
1717
exports.routeSet=route_1.routeSet;
1818
varsetup_1=require('./setup');

‎lib/actions/page.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,3 @@ function pageSet(pagePosition) {
3030
};
3131
}
3232
exports.pageSet=pageSet;
33-
functionpagePositionSet(pagePosition){
34-
return{type:_types_1.PAGE_POSITION_SET,payload:{pagePosition:pagePosition}};
35-
}
36-
exports.pagePositionSet=pagePositionSet;

‎lib/actions/progress.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function completePage(completed) {
2828
dispatch(completeTutorial());
2929
}
3030
else{
31-
dispatch(alert_1.alertToggle({
31+
dispatch(alert_1.alertOpen({
3232
message:"Page "+(pagePosition+1)+" Complete",
3333
action:'PASS',
3434
}));
@@ -45,7 +45,7 @@ function completeTutorial(completed) {
4545
returnfunction(dispatch,getState){
4646
vartutorial=getState().tutorial;
4747
dispatch({type:_types_1.COMPLETE_TUTORIAL,payload:{tutorial:tutorial,completed:completed}});
48-
dispatch('ALER'({
48+
dispatch(alert_1.alertOpen({
4949
message:'Tutorial Complete',
5050
action:'PASS',
5151
}));

‎lib/actions/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function testResult(result) {
3535
});
3636
}
3737
dispatch({type:_types_1.TEST_RESULT,payload:{result:result,taskActions:taskActions}});
38-
dispatch(alert_1.alertToggle(alert));
38+
dispatch(alert_1.alertOpen(alert));
3939
};
4040
}
4141
exports.testResult=testResult;

‎lib/actions/tutorial.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function tutorialUpdate(name) {
2020
duration:3000,
2121
};
2222
dispatch({type:_types_1.TUTORIAL_UPDATE,payload:{name:name}});
23-
dispatch(alert_1.alertToggle(alert));
23+
dispatch(alert_1.alertOpen(alert));
2424
};
2525
}
2626
exports.tutorialUpdate=tutorialUpdate;

‎lib/components/Alert/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ var Alert = (function (_super) {
2727
_super.apply(this,arguments);
2828
}
2929
Alert.prototype.render=function(){
30-
var_a=this.props,alert=_a.alert,alertToggle=_a.alertToggle;
30+
var_a=this.props,alert=_a.alert,close=_a.close;
3131
varaction=alert.action,message=alert.message,open=alert.open,duration=alert.duration;
32-
return(React.createElement(Snackbar_1.default,{className:"cr-alert "+action,open:open,message:message||'',action:action||'NOTE',autoHideDuration:duration||2000,onRequestClose:alertToggle}));
32+
return(React.createElement(Snackbar_1.default,{className:"cr-alert "+action,open:open,message:message||'',action:action||'NOTE',autoHideDuration:duration||2000,onRequestClose:close}));
3333
};
3434
Alert=__decorate([
3535
react_redux_1.connect(null,function(dispatch){
3636
return{
37-
alertToggle:function(){returndispatch(actions_1.alertToggle({open:false}));}
37+
close:function(){returndispatch(actions_1.alertClose());}
3838
};
3939
}),
4040
__metadata('design:paramtypes',[])

‎lib/reducers/alert/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ function alertReducer(alert, action) {
2828
switch(action.type){
2929
case_types_1.ALERT_REPLAY:
3030
returnsetAlert(current);
31-
case_types_1.ALERT_TOGGLE:
31+
case_types_1.ALERT_OPEN:
3232
returnsetAlert(action.payload.alert);
33+
case_types_1.ALERT_CLOSE:
34+
returnObject.assign({},alert,{open:false});
3335
default:
3436
returnalert;
3537
}

‎lib/reducers/page-position/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ function pagePositionReducer(pagePosition, action) {
77
varpages=action.payload.progress.pages;
88
varfirstFail=pages.indexOf(false);
99
returnfirstFail<0 ?pages.length-1 :firstFail;
10-
case_types_1.PAGE_SET:
1110
case_types_1.PAGE_POSITION_SET:
1211
returnaction.payload.pagePosition;
1312
default:

‎lib/store/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"use strict";
22
varredux_1=require('redux');
3-
varredux_action_thunk_1=require('redux-action-thunk');
43
varreducers_1=require('../reducers');
54
varcreateLogger=require('redux-logger');
6-
varmiddlewares=[redux_action_thunk_1.ratMiddleware];
5+
varredux_thunk_1=require('redux-thunk');
6+
varmiddlewares=[redux_thunk_1.default];
77
vardevMode=true;
88
if(devMode){
99
varlogger=createLogger();

‎package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
"react-redux":"4.4.5",
4747
"react-tap-event-plugin":"1.0.0",
4848
"redux":"3.5.2",
49-
"redux-action-thunk":"0.3.0",
5049
"redux-logger":"2.6.1",
5150
"redux-thunk":"2.1.0"
5251
},

‎src/actions/_types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
exportconstALERT_REPLAY='ALERT_REPLAY';
2-
exportconstALERT_TOGGLE='ALERT_TOGGLE';
2+
exportconstALERT_OPEN='ALERT_OPEN';
3+
exportconstALERT_CLOSE='ALERT_CLOSE';
34
exportconstCOMPLETE_PAGE='COMPLETE_PAGE';
45
exportconstCOMPLETE_TUTORIAL='COMPLETE_TUTORIAL';
56
exportconstDEVTOOLS_TOGGLE='DEVTOOLS_TOGGLE';

‎src/actions/alert.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
1-
import{ALERT_REPLAY,ALERT_TOGGLE}from'./_types';
1+
import{ALERT_REPLAY,ALERT_OPEN,ALERT_CLOSE}from'./_types';
22

3-
exportfunctionalertToggle(alert:Object):ReduxThunk.ThunkInterface{
3+
exportfunctionalertOpen(alert:Object):ReduxThunk.ThunkInterface{
44
return(dispatch,getState):void=>{
5-
dispatch({type:ALERT_TOGGLE,payload:{ alert}});
5+
dispatch({type:ALERT_OPEN,payload:{ alert}});
66
};
77
}
88

99
exportfunctionalertReplay():Action{
1010
return{type:ALERT_REPLAY};
1111
}
1212

13-
// import {rat} from 'redux-action-thunk';
14-
//
15-
// rat.add('ALERT_TOGGLE', (dispatch, getState) => (alert) => {
16-
// dispatch({ type: 'ALERT_TOGGLE', payload: { alert }});
17-
// });
18-
//
19-
// rat.add('ALERT_REPLAY');
13+
exportfunctionalertClose():Action{
14+
return{type:ALERT_CLOSE};
15+
}

‎src/actions/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
export{alertToggle,alertReplay}from'./alert';
2-
// import './alert';
1+
export{alertOpen,alertClose,alertReplay}from'./alert';
32
export{
43
progressLoad,completePage,completeTutorial,
54
progressPagePositionLoad

‎src/actions/progress.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import{
22
PROGRESS_PAGE_POSITION_LOAD,PROGRESS_LOAD,COMPLETE_PAGE,COMPLETE_TUTORIAL
33
}from'./_types';
4-
import{alertToggle}from'./alert';
4+
import{alertOpen}from'./alert';
55
import{testRun}from'./test';
66

77
exportfunctionprogressPagePositionLoad():ReduxThunk.ThunkInterface{
@@ -30,7 +30,7 @@ export function completePage(completed = true): ReduxThunk.ThunkInterface {
3030
if(progress.pages.every(x=>x.completed)){
3131
dispatch(completeTutorial());
3232
}else{
33-
dispatch(alertToggle({
33+
dispatch(alertOpen({
3434
message:`Page${pagePosition+1} Complete`,
3535
action:'PASS',
3636
}));
@@ -45,7 +45,7 @@ export function completeTutorial(completed = true): ReduxThunk.ThunkInterface {
4545
return(dispatch,getState):void=>{
4646
const{tutorial}=getState();
4747
dispatch({type:COMPLETE_TUTORIAL,payload:{ tutorial, completed}});
48-
dispatch('ALER'({
48+
dispatch(alertOpen({
4949
message:'Tutorial Complete',
5050
action:'PASS',
5151
}));

‎src/actions/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
}from'./_types';
44
import{hintPositionSet}from'./hint';
55
import{completePage}from'./progress';
6-
import{alertToggle}from'./alert';
6+
import{alertOpen}from'./alert';
77

88
exportfunctiontestRun():ReduxThunk.ThunkInterface{
99
return(dispatch,getState):void=>{
@@ -39,7 +39,7 @@ export function testResult(result: Test.Result): ReduxThunk.ThunkInterface {
3939
});
4040
}
4141
dispatch({type:TEST_RESULT,payload:{ result, taskActions}});
42-
dispatch(alertToggle(alert));
42+
dispatch(alertOpen(alert));
4343
};
4444
}
4545

‎src/actions/tutorial.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
}from'./_types';
44
import{progressLoad}from'./progress';
55
import{routeSet}from'./route';
6-
import{alertToggle}from'./alert';
6+
import{alertOpen}from'./alert';
77

88
exportfunctiontutorialSet(name:string):ReduxThunk.ThunkInterface{
99
return(dispatch,getState):void=>{
@@ -22,7 +22,7 @@ export function tutorialUpdate(name: string): ReduxThunk.ThunkInterface {
2222
duration:3000,
2323
};
2424
dispatch({type:TUTORIAL_UPDATE,payload:{ name}});
25-
dispatch(alertToggle(alert));
25+
dispatch(alertOpen(alert));
2626
};
2727
}
2828

‎src/components/Alert/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import*asReactfrom'react';
22
import{connect}from'react-redux';
33
importSnackbarfrom'material-ui/Snackbar';
4-
import{alertToggle}from'../../actions';
4+
import{alertClose}from'../../actions';
55

66
constdefaultAlert={
77
message:'',
@@ -10,14 +10,14 @@ const defaultAlert = {
1010

1111
@connect(null,dispatch=>{
1212
return{
13-
alertToggle:()=>dispatch(alertToggle({open:false}))
13+
close:()=>dispatch(alertClose())
1414
};
1515
})
1616
exportdefaultclassAlertextendsReact.Component<{
17-
alert:CR.Alert,alertToggle?:any
17+
alert:CR.Alert,close?:any
1818
},{}>{
1919
render(){
20-
const{alert,alertToggle}=this.props;
20+
const{alert,close}=this.props;
2121
const{action, message, open, duration}=alert;
2222
return(
2323
<Snackbar
@@ -26,7 +26,7 @@ export default class Alert extends React.Component<{
2626
message={message||''}
2727
action={action||'NOTE'}
2828
autoHideDuration={duration||2000}
29-
onRequestClose={alertToggle}
29+
onRequestClose={close}
3030
/>
3131
);
3232
}

‎src/reducers/alert/index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import{
2-
ALERT_REPLAY,ALERT_TOGGLE,TUTORIAL_UPDATE,
3-
TEST_RESULT,COMPLETE_PAGE,COMPLETE_TUTORIAL
2+
ALERT_REPLAY,ALERT_OPEN,ALERT_CLOSE
43
}from'../../actions/_types';
54

65
const_alert:CR.Alert={
@@ -25,7 +24,6 @@ const colors = {
2524
letcurrent:CR.Alert=_alert;
2625

2726
functionsetAlert(a:CR.Alert):CR.Alert{
28-
2927
constcolor=colors[a.action]||colors.NOTE;
3028
letstatusBarAlert=<HTMLElement>document.getElementsByClassName('cr-alert-replay')[0];
3129
statusBarAlert.style.color=color;
@@ -40,9 +38,12 @@ export default function alertReducer(
4038
caseALERT_REPLAY:
4139
returnsetAlert(current);
4240

43-
caseALERT_TOGGLE:
41+
caseALERT_OPEN:
4442
returnsetAlert(action.payload.alert);
4543

44+
caseALERT_CLOSE:
45+
returnObject.assign({},alert,{open:false});
46+
4647
default:
4748
returnalert;
4849
}

‎src/reducers/tutorial-list/update.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
importcommandLinefrom'../../services/command-line';
2-
// import {alertToggle} from '../../actions';
32
import{tutorialsFind}from'../../actions';
43

54
exportfunctiontutorialUpdate(name:string):void{

‎src/store/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import{applyMiddleware,createStore}from'redux';
2-
import{ratMiddleware}from'redux-action-thunk';
32
importreducerfrom'../reducers';
43
import*ascreateLoggerfrom'redux-logger';
54
importthunkfrom'redux-thunk';
65

76
// const middlewares = [ramMiddleware];
8-
constmiddlewares=[ratMiddleware];
7+
constmiddlewares=[thunk];
98

109
constdevMode=true;
1110
if(devMode){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp