Skip to content

Commit d1e206f

Browse files
committed
refactor root into SidePanel
1 parent 29f06ed commit d1e206f

File tree

46 files changed

+118
-112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+118
-112
lines changed

lib/components/Alert/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ var Alert = (function (_super) {
3939
react_redux_1.connect(function (state) { return ({
4040
alert: state.alert,
4141
}); }, function (dispatch) { return ({
42-
close: function () { return dispatch(actions_1.alertClose()); },
42+
close: function () { dispatch(actions_1.alertClose()); },
4343
}); }),
4444
__metadata('design:paramtypes', [])
4545
], Alert);

lib/components/AppMenu/CloseWindow.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var CloseWindow = (function (_super) {
2828
};
2929
CloseWindow = __decorate([
3030
react_redux_1.connect(null, function (dispatch) { return ({
31-
windowToggle: function () { return dispatch(actions_1.windowToggle()); },
31+
windowToggle: function () { dispatch(actions_1.windowToggle()); },
3232
}); }),
3333
__metadata('design:paramtypes', [])
3434
], CloseWindow);

lib/components/AppMenu/MenuLink/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ var MenuLink = (function (_super) {
3232
};
3333
MenuLink = __decorate([
3434
react_redux_1.connect(null, function (dispatch) { return ({
35-
routeTo: function (route) { return dispatch(actions_1.routeSet(route)); },
35+
routeTo: function (route) { dispatch(actions_1.routeSet(route)); },
3636
}); }),
3737
__metadata('design:paramtypes', [])
3838
], MenuLink);

lib/components/Common/RouteButton.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var RouteButton = (function (_super) {
2828
};
2929
RouteButton = __decorate([
3030
react_redux_1.connect(null, function (dispatch) { return ({
31-
routeTo: function (route) { return dispatch(actions_1.routeSet(route)); },
31+
routeTo: function (route) { dispatch(actions_1.routeSet(route)); },
3232
}); }),
3333
__metadata('design:paramtypes', [])
3434
], RouteButton);

lib/components/Page/Hints/HintButton.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var HintButton = (function (_super) {
3737
hintPosition: state.hintPosition,
3838
hintsLength: selectors_1.hintsSelector(state).length,
3939
}); }, function (dispatch) { return ({
40-
hintSet: function (position) { return dispatch(actions_1.hintPositionSet(position)); },
40+
hintSet: function (position) { dispatch(actions_1.hintPositionSet(position)); },
4141
}); }),
4242
__metadata('design:paramtypes', [])
4343
], HintButton);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var Continue = (function (_super) {
3434
};
3535
Continue = __decorate([
3636
react_redux_1.connect(null, function (dispatch) { return ({
37-
callNextPage: function () { return dispatch(actions_1.pageNext()); }
37+
callNextPage: function () { dispatch(actions_1.pageNext()); },
3838
}); }),
3939
__metadata('design:paramtypes', [])
4040
], Continue);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var Save = (function (_super) {
3434
};
3535
Save = __decorate([
3636
react_redux_1.connect(null, function (dispatch) { return ({
37-
save: function () { return dispatch(actions_1.editorSave()); },
37+
save: function () { dispatch(actions_1.editorSave()); },
3838
}); }),
3939
__metadata('design:paramtypes', [])
4040
], Save);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var ToggleDevTools = (function (_super) {
3333
;
3434
ToggleDevTools = __decorate([
3535
react_redux_1.connect(null, function (dispatch) { return ({
36-
toggle: function () { return dispatch(actions_1.editorDevToolsToggle()); },
36+
toggle: function () { dispatch(actions_1.editorDevToolsToggle()); },
3737
}); }),
3838
__metadata('design:paramtypes', [])
3939
], ToggleDevTools);

lib/components/Progress/index.js

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

lib/components/App.js renamed to lib/components/SidePanel/SidePanel.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,26 @@ var __metadata = (this && this.__metadata) || function (k, v) {
1515
};
1616
var React = require('react');
1717
var react_redux_1 = require('react-redux');
18-
var index_1 = require('./index');
19-
var Routes_1 = require('./Routes');
18+
var index_1 = require('../index');
19+
var Routes_1 = require('../Routes');
2020
var Drawer_1 = require('material-ui/Drawer');
21-
var App = (function (_super) {
22-
__extends(App, _super);
23-
function App() {
21+
var SidePanel = (function (_super) {
22+
__extends(SidePanel, _super);
23+
function SidePanel() {
2424
_super.apply(this, arguments);
2525
}
26-
App.prototype.render = function () {
26+
SidePanel.prototype.render = function () {
2727
var windowToggle = this.props.windowToggle;
2828
return (React.createElement("section", null, React.createElement(Drawer_1.default, {width: 400, openSecondary: true, open: windowToggle}, React.createElement("div", {className: 'cr-bg'}, React.createElement(index_1.AppMenu, null), React.createElement(Routes_1.default, null))), React.createElement(index_1.Alert, null)));
2929
};
30-
App = __decorate([
30+
SidePanel = __decorate([
3131
react_redux_1.connect(function (state) { return ({
3232
windowToggle: state.windowToggle,
3333
}); }),
3434
__metadata('design:paramtypes', [])
35-
], App);
36-
return App;
35+
], SidePanel);
36+
return SidePanel;
3737
}(React.Component));
3838
Object.defineProperty(exports, "__esModule", { value: true });
39-
exports.default = App;
39+
exports.default = SidePanel;
4040
;

lib/components/SidePanel/element.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"use strict";
2+
var ReactDOM = require('react-dom');
3+
var sidePanelElement = {
4+
root: null,
5+
init: function () {
6+
this.root = document.createElement('div');
7+
this.root.setAttribute('id', 'crv');
8+
return this.root;
9+
},
10+
unmount: function () {
11+
ReactDOM.unmountComponentAtNode(this.root);
12+
}
13+
};
14+
Object.defineProperty(exports, "__esModule", { value: true });
15+
exports.default = sidePanelElement;

lib/components/SidePanel/root.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"use strict";
2+
var React = require('react');
3+
var react_redux_1 = require('react-redux');
4+
var theme_1 = require('../styles/theme');
5+
var MuiThemeProvider_1 = require('material-ui/styles/MuiThemeProvider');
6+
var SidePanel_1 = require('./SidePanel');
7+
var Root = function (store) { return (React.createElement(react_redux_1.Provider, {store: store}, React.createElement(MuiThemeProvider_1.default, {muiTheme: theme_1.default}, React.createElement(SidePanel_1.default, null)))); };
8+
Object.defineProperty(exports, "__esModule", { value: true });
9+
exports.default = Root;

lib/components/Start/Checks/VerifyButton.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var VerifyButton = (function (_super) {
2727
};
2828
VerifyButton = __decorate([
2929
react_redux_1.connect(null, function (dispatch) { return ({
30-
verify: function () { return dispatch(actions_1.setupVerify()); },
30+
verify: function () { dispatch(actions_1.setupVerify()); },
3131
}); }),
3232
__metadata('design:paramtypes', [])
3333
], VerifyButton);

lib/components/Tutorials/LoadTutorials/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var LoadTutorials = (function (_super) {
2828
};
2929
LoadTutorials = __decorate([
3030
react_redux_1.connect(null, function (dispatch) { return ({
31-
tutorialsFind: function () { return dispatch(actions_1.tutorialsFind()); },
31+
tutorialsFind: function () { dispatch(actions_1.tutorialsFind()); },
3232
}); }),
3333
__metadata('design:paramtypes', [])
3434
], LoadTutorials);

lib/components/Tutorials/SelectTutorial/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var SelectTutorial = (function (_super) {
3636
};
3737
SelectTutorial = __decorate([
3838
react_redux_1.connect(null, function (dispatch) { return ({
39-
selectTutorial: function (name) { return dispatch(actions_1.tutorialSet(name)); },
39+
selectTutorial: function (name) { dispatch(actions_1.tutorialSet(name)); },
4040
}); }),
4141
__metadata('design:paramtypes', [])
4242
], SelectTutorial);

lib/components/Tutorials/UpdateTutorial/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ var UpdateTutorial = (function (_super) {
3838
};
3939
UpdateTutorial = __decorate([
4040
react_redux_1.connect(null, function (dispatch) { return ({
41-
tutorialUpdate: function (title) { return dispatch(actions_1.tutorialUpdate(title)); },
41+
tutorialUpdate: function (title) { dispatch(actions_1.tutorialUpdate(title)); },
4242
}); }),
4343
__metadata('design:paramtypes', [])
4444
], UpdateTutorial);

lib/components/Tutorials/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var Tutorials = (function (_super) {
4444
react_redux_1.connect(function (state) { return ({
4545
tutorials: state.tutorials,
4646
}); }, function (dispatch) { return ({
47-
loadTutorials: function () { return dispatch(actions_1.tutorialsFind()); },
47+
loadTutorials: function () { dispatch(actions_1.tutorialsFind()); },
4848
}); }),
4949
__metadata('design:paramtypes', [Object])
5050
], Tutorials);

lib/components/render.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
"use strict";
2-
var React = require('react');
32
var ReactDOM = require('react-dom');
4-
var react_redux_1 = require('react-redux');
3+
var root_1 = require('./SidePanel/root');
54
var store_1 = require('../store');
6-
var App_1 = require('./App');
7-
var theme_1 = require('./styles/theme');
8-
var MuiThemeProvider_1 = require('material-ui/styles/MuiThemeProvider');
9-
require('./remove-later');
105
function render(target) {
11-
ReactDOM.render(React.createElement(react_redux_1.Provider, {store: store_1.default}, React.createElement(MuiThemeProvider_1.default, {muiTheme: theme_1.default}, React.createElement(App_1.default, null))), target);
6+
ReactDOM.render(root_1.default(store_1.default), target);
127
}
138
Object.defineProperty(exports, "__esModule", { value: true });
149
exports.default = render;

lib/components/root.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

lib/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
"use strict";
22
var render_1 = require('./components/render');
3-
var root_1 = require('./components/root');
3+
var element_1 = require('./components/SidePanel/element');
44
var polyfills_1 = require('core-coderoad/lib/polyfills');
55
var subscriptions_1 = require('./subscriptions');
66
var store_1 = require('./store');
77
var setup_1 = require('./modules/setup');
8+
var injectTapEventPlugin = require('react-tap-event-plugin');
89
var Main = (function () {
910
function Main() {
11+
injectTapEventPlugin();
1012
polyfills_1.default();
1113
store_1.default.dispatch(setup_1.setupVerify());
12-
this.root = root_1.default.init();
14+
this.root = element_1.default.init();
1315
}
1416
Main.prototype.activate = function () {
1517
atom.workspace.addRightPanel({

lib/subscriptions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
var CompositeDisposable = require('atom').CompositeDisposable;
33
var store_1 = require('./store');
44
var actions_1 = require('./actions');
5-
var root_1 = require('./components/root');
5+
var element_1 = require('./components/SidePanel/element');
66
var subscriptions = null;
77
function onActivate() {
88
subscriptions = new CompositeDisposable;
@@ -16,7 +16,7 @@ function onActivate() {
1616
}
1717
exports.onActivate = onActivate;
1818
function onDeactivate() {
19-
root_1.default.unmount();
19+
element_1.default.unmount();
2020
store_1.default.subscribe(function () { return null; });
2121
subscriptions.dispose();
2222
}

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@
4343
"redux": "3.5.2",
4444
"redux-logger": "2.6.1",
4545
"redux-throttle-actions": "1.1.0",
46-
"redux-thunk": "2.1.0",
47-
"reselect": "2.5.1"
46+
"redux-thunk": "2.1.0"
4847
},
4948
"engines": {
5049
"atom": ">=1.0.0 <2.0.0"

src/components/Alert/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const styles = {
1616
@connect(state => ({
1717
alert: state.alert,
1818
}), dispatch => ({
19-
close: () => dispatch(alertClose()),
19+
close() { dispatch(alertClose()); },
2020
}))
2121
export default class Alert extends React.Component<{
2222
alert?: CR.Alert, close?: any

src/components/AppMenu/CloseWindow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import NavigationClose from 'material-ui/svg-icons/navigation/close';
55
import {windowToggle} from '../../actions';
66

77
@connect(null, dispatch => ({
8-
windowToggle: () => dispatch(windowToggle()),
8+
windowToggle() { dispatch(windowToggle()); },
99
}))
1010
export default class CloseWindow extends React.Component<{
1111
windowToggle?: any}, {}> {

src/components/AppMenu/MenuLink/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const styles = {
99
};
1010

1111
@connect(null, dispatch => ({
12-
routeTo: (route: string) => dispatch(routeSet(route)),
12+
routeTo(route: string) { dispatch(routeSet(route)); },
1313
}))
1414
export default class MenuLink extends React.Component<{
1515
route: string, title?: string, routeTo?: any

src/components/Common/RouteButton.tsx

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

66
@connect(null, dispatch => ({
7-
routeTo: (route: string) => dispatch(routeSet(route)),
7+
routeTo(route: string) { dispatch(routeSet(route)); },
88
}))
99
export default class RouteButton extends React.Component<{
1010
label: string, route: string, routeTo?: any, style?: Object

src/components/Page/Hints/HintButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {hintsSelector} from 'core-coderoad/lib/selectors';
88
hintPosition: state.hintPosition,
99
hintsLength: hintsSelector(state).length,
1010
}), dispatch => ({
11-
hintSet: (position: number) => dispatch(hintPositionSet(position)),
11+
hintSet(position: number) { dispatch(hintPositionSet(position)); },
1212
}))
1313
export default class HintButton extends React.Component<{
1414
hintPosition?: number, hintsLength?: number, type: 'next'|'prev', label: string

src/components/Page/PageToolbar/Continue/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const styles = {
1212
};
1313

1414
@connect(null, dispatch => ({
15-
callNextPage: () => dispatch(pageNext())
15+
callNextPage() { dispatch(pageNext()); },
1616
}))
1717
export default class Continue extends React.Component<{
1818
callNextPage?: any

src/components/Page/PageToolbar/Save/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const styles = {
1212
};
1313

1414
@connect(null, dispatch => ({
15-
save: () => dispatch(editorSave()),
15+
save() { dispatch(editorSave()); },
1616
}))
1717
export default class Save extends React.Component<{
1818
save?: any

src/components/Page/PageToolbar/ToggleDevTools/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const styles = {
1010
};
1111

1212
@connect(null, dispatch => ({
13-
toggle: () => dispatch(editorDevToolsToggle()),
13+
toggle() { dispatch(editorDevToolsToggle()); },
1414
}))
1515
export default class ToggleDevTools extends React.Component<{
1616
toggle?: any

src/components/Progress/ProgressPage/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const styles = {
1111
};
1212

1313
@connect(null, dispatch => ({
14-
selectPage: (pagePosition: CR.PagePosition) => {
14+
selectPage(pagePosition: CR.PagePosition) {
1515
dispatch(pageSet(pagePosition));
1616
dispatch(routeSet('page'));
1717
},

src/components/Progress/index.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@ const styles = {
2020
pagePosition: state.pagePosition,
2121
info: state.tutorial.info,
2222
tutorial: state.tutorial
23-
}), dispatch => {
24-
return {
25-
progressLoad: () => dispatch(progressLoad())
26-
};
27-
})
23+
}), dispatch => ({
24+
progressLoad() { dispatch(progressLoad()); }
25+
}))
2826
export default class Progress extends React.Component<{
2927
progress?: CR.Progress, pagePosition?: CR.PagePosition,
3028
info?: Tutorial.Info, tutorial?: CR.Tutorial, progressLoad?: () => any;

src/components/App.tsx renamed to src/components/SidePanel/SidePanel.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import * as React from 'react';
22
import {connect} from 'react-redux';
3-
import {AppMenu, Alert} from './index';
4-
import Routes from './Routes';
3+
import {AppMenu, Alert} from '../index';
4+
import Routes from '../Routes';
55
import Drawer from 'material-ui/Drawer';
66
import Menu from 'material-ui/svg-icons/navigation/menu';
77

88
@connect(state => ({
99
windowToggle: state.windowToggle,
1010
}))
11-
export default class App extends React.Component<{
11+
export default class SidePanel extends React.Component<{
1212
windowToggle?: boolean
1313
}, {}> {
1414
render(): React.ReactElement<{}> {

0 commit comments

Comments
 (0)