Skip to content

Commit e82cbc1

Browse files
committed
refactor connected dispatches
1 parent d1e206f commit e82cbc1

File tree

28 files changed

+71
-127
lines changed

28 files changed

+71
-127
lines changed

lib/components/Alert/index.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,14 @@ var Alert = (function (_super) {
3131
_super.apply(this, arguments);
3232
}
3333
Alert.prototype.render = function () {
34-
var _a = this.props, alert = _a.alert, close = _a.close;
34+
var _a = this.props, alert = _a.alert, alertClose = _a.alertClose;
3535
var action = alert.action, message = alert.message, open = alert.open, duration = alert.duration, color = alert.color;
36-
return (React.createElement(Snackbar_1.default, {style: styles, bodyStyle: { color: color }, open: open, message: message || '', action: action || '', autoHideDuration: duration || 2000, onActionTouchTap: close, onRequestClose: close}));
36+
return (React.createElement(Snackbar_1.default, {style: styles, bodyStyle: { color: color }, open: open, message: message || '', action: action || '', autoHideDuration: duration || 2000, onActionTouchTap: alertClose, onRequestClose: alertClose}));
3737
};
3838
Alert = __decorate([
3939
react_redux_1.connect(function (state) { return ({
4040
alert: state.alert,
41-
}); }, function (dispatch) { return ({
42-
close: function () { dispatch(actions_1.alertClose()); },
43-
}); }),
41+
}); }, { alertClose: actions_1.alertClose }),
4442
__metadata('design:paramtypes', [])
4543
], Alert);
4644
return Alert;

lib/components/AppMenu/CloseWindow.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ var CloseWindow = (function (_super) {
2727
return (React.createElement(IconButton_1.default, {onClick: this.props.windowToggle}, React.createElement(close_1.default, {color: 'white'})));
2828
};
2929
CloseWindow = __decorate([
30-
react_redux_1.connect(null, function (dispatch) { return ({
31-
windowToggle: function () { dispatch(actions_1.windowToggle()); },
32-
}); }),
30+
react_redux_1.connect(null, { windowToggle: actions_1.windowToggle }),
3331
__metadata('design:paramtypes', [])
3432
], CloseWindow);
3533
return CloseWindow;

lib/components/AppMenu/MenuLink/index.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,11 @@ var MenuLink = (function (_super) {
2727
_super.apply(this, arguments);
2828
}
2929
MenuLink.prototype.render = function () {
30-
var _a = this.props, route = _a.route, title = _a.title, routeTo = _a.routeTo;
31-
return (React.createElement(MenuItem_1.default, {style: styles, primaryText: title ? title : route, onTouchTap: routeTo.bind(this, route), key: route}));
30+
var _a = this.props, route = _a.route, title = _a.title, routeSet = _a.routeSet;
31+
return (React.createElement(MenuItem_1.default, {style: styles, primaryText: title ? title : route, onTouchTap: routeSet.bind(this, route), key: route}));
3232
};
3333
MenuLink = __decorate([
34-
react_redux_1.connect(null, function (dispatch) { return ({
35-
routeTo: function (route) { dispatch(actions_1.routeSet(route)); },
36-
}); }),
34+
react_redux_1.connect(null, { routeSet: actions_1.routeSet }),
3735
__metadata('design:paramtypes', [])
3836
], MenuLink);
3937
return MenuLink;

lib/components/Common/RouteButton.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@ var RouteButton = (function (_super) {
2323
_super.apply(this, arguments);
2424
}
2525
RouteButton.prototype.render = function () {
26-
var _a = this.props, label = _a.label, route = _a.route, style = _a.style, routeTo = _a.routeTo;
27-
return (React.createElement(RaisedButton_1.default, {label: label, style: style || {}, onTouchTap: routeTo.bind(this, route), secondary: true}));
26+
var _a = this.props, label = _a.label, route = _a.route, style = _a.style, routeSet = _a.routeSet;
27+
return (React.createElement(RaisedButton_1.default, {label: label, style: style || {}, onTouchTap: routeSet.bind(this, route), secondary: true}));
2828
};
2929
RouteButton = __decorate([
30-
react_redux_1.connect(null, function (dispatch) { return ({
31-
routeTo: function (route) { dispatch(actions_1.routeSet(route)); },
32-
}); }),
30+
react_redux_1.connect(null, { routeSet: actions_1.routeSet }),
3331
__metadata('design:paramtypes', [])
3432
], RouteButton);
3533
return RouteButton;

lib/components/Page/Hints/HintButton.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,19 @@ var HintButton = (function (_super) {
2424
_super.apply(this, arguments);
2525
}
2626
HintButton.prototype.render = function () {
27-
var _a = this.props, hintPosition = _a.hintPosition, hintsLength = _a.hintsLength, label = _a.label, type = _a.type, hintSet = _a.hintSet;
27+
var _a = this.props, hintPosition = _a.hintPosition, hintsLength = _a.hintsLength, label = _a.label, type = _a.type, hintPositionSet = _a.hintPositionSet;
2828
switch (type) {
2929
case 'next':
30-
return (React.createElement(FlatButton_1.default, {label: label, disabled: hintPosition > hintsLength - 2, onTouchTap: hintSet.bind(this, hintPosition + 1)}));
30+
return (React.createElement(FlatButton_1.default, {label: label, disabled: hintPosition > hintsLength - 2, onTouchTap: hintPositionSet.bind(this, hintPosition + 1)}));
3131
case 'prev':
32-
return (React.createElement(FlatButton_1.default, {label: label, disabled: hintPosition === 0, onTouchTap: hintSet.bind(this, hintPosition - 1)}));
32+
return (React.createElement(FlatButton_1.default, {label: label, disabled: hintPosition === 0, onTouchTap: hintPositionSet.bind(this, hintPosition - 1)}));
3333
}
3434
};
3535
HintButton = __decorate([
3636
react_redux_1.connect(function (state) { return ({
3737
hintPosition: state.hintPosition,
3838
hintsLength: selectors_1.hintsSelector(state).length,
39-
}); }, function (dispatch) { return ({
40-
hintSet: function (position) { dispatch(actions_1.hintPositionSet(position)); },
41-
}); }),
39+
}); }, { hintPositionSet: actions_1.hintPositionSet }),
4240
__metadata('design:paramtypes', [])
4341
], HintButton);
4442
return HintButton;

lib/components/Page/PageToolbar/Continue/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,10 @@ var Continue = (function (_super) {
3030
_super.apply(this, arguments);
3131
}
3232
Continue.prototype.render = function () {
33-
return (React.createElement(RaisedButton_1.default, {style: styles, label: 'Continue', primary: true, onTouchTap: this.props.callNextPage}));
33+
return (React.createElement(RaisedButton_1.default, {style: styles, label: 'Continue', primary: true, onTouchTap: this.props.pageNext}));
3434
};
3535
Continue = __decorate([
36-
react_redux_1.connect(null, function (dispatch) { return ({
37-
callNextPage: function () { dispatch(actions_1.pageNext()); },
38-
}); }),
36+
react_redux_1.connect(null, { pageNext: actions_1.pageNext }),
3937
__metadata('design:paramtypes', [])
4038
], Continue);
4139
return Continue;

lib/components/Page/PageToolbar/Save/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,10 @@ var Save = (function (_super) {
3030
_super.apply(this, arguments);
3131
}
3232
Save.prototype.render = function () {
33-
return (React.createElement(RaisedButton_1.default, {label: 'Save', style: styles, secondary: true, onTouchTap: this.props.save}));
33+
return (React.createElement(RaisedButton_1.default, {label: 'Save', style: styles, secondary: true, onTouchTap: this.props.editorSave}));
3434
};
3535
Save = __decorate([
36-
react_redux_1.connect(null, function (dispatch) { return ({
37-
save: function () { dispatch(actions_1.editorSave()); },
38-
}); }),
36+
react_redux_1.connect(null, { editorSave: actions_1.editorSave }),
3937
__metadata('design:paramtypes', [])
4038
], Save);
4139
return Save;

lib/components/Page/PageToolbar/ToggleDevTools/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,11 @@ var ToggleDevTools = (function (_super) {
2828
_super.apply(this, arguments);
2929
}
3030
ToggleDevTools.prototype.render = function () {
31-
return (React.createElement(FlatButton_1.default, {style: styles, icon: React.createElement(code_1.default, null), onTouchTap: this.props.toggle}));
31+
return (React.createElement(FlatButton_1.default, {style: styles, icon: React.createElement(code_1.default, null), onTouchTap: this.props.editorDevToolsToggle}));
3232
};
3333
;
3434
ToggleDevTools = __decorate([
35-
react_redux_1.connect(null, function (dispatch) { return ({
36-
toggle: function () { dispatch(actions_1.editorDevToolsToggle()); },
37-
}); }),
35+
react_redux_1.connect(null, { editorDevToolsToggle: actions_1.editorDevToolsToggle }),
3836
__metadata('design:paramtypes', [])
3937
], ToggleDevTools);
4038
return ToggleDevTools;

lib/components/Progress/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ var Progress = (function (_super) {
4646
pagePosition: state.pagePosition,
4747
info: state.tutorial.info,
4848
tutorial: state.tutorial
49-
}); }, function (dispatch) { return ({
50-
progressLoad: function () { dispatch(actions_1.progressLoad()); }
51-
}); }),
49+
}); }, { progressLoad: actions_1.progressLoad }),
5250
__metadata('design:paramtypes', [])
5351
], Progress);
5452
return Progress;

lib/components/Start/Checks/VerifyButton.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@ var VerifyButton = (function (_super) {
2323
_super.apply(this, arguments);
2424
}
2525
VerifyButton.prototype.render = function () {
26-
return (React.createElement(FlatButton_1.default, {label: 'Verify Setup Complete', primary: true, onTouchTap: this.props.verify}));
26+
return (React.createElement(FlatButton_1.default, {label: 'Verify Setup Complete', primary: true, onTouchTap: this.props.setupVerify}));
2727
};
2828
VerifyButton = __decorate([
29-
react_redux_1.connect(null, function (dispatch) { return ({
30-
verify: function () { dispatch(actions_1.setupVerify()); },
31-
}); }),
29+
react_redux_1.connect(null, { setupVerify: actions_1.setupVerify }),
3230
__metadata('design:paramtypes', [])
3331
], VerifyButton);
3432
return VerifyButton;

0 commit comments

Comments
 (0)