Skip to content

Commit 2f329ba

Browse files
committed
load Markdown, Alert, render from core
1 parent 7d8152d commit 2f329ba

File tree

17 files changed

+55
-119
lines changed

17 files changed

+55
-119
lines changed

lib/components/SidePanel/SidePanel.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ var SidePanel = (function (_super) {
2424
_super.apply(this, arguments);
2525
}
2626
SidePanel.prototype.render = function () {
27-
var windowToggle = this.props.windowToggle;
28-
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)));
27+
var isWindowOpen = this.props.isWindowOpen;
28+
return (React.createElement("section", null, React.createElement(Drawer_1.default, {width: 400, openSecondary: true, open: isWindowOpen}, 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
};
3030
SidePanel = __decorate([
3131
react_redux_1.connect(function (state) { return ({
32-
windowToggle: state.windowToggle,
32+
isWindowOpen: state.window,
3333
}); }),
3434
__metadata('design:paramtypes', [])
3535
], SidePanel);

lib/components/Start/Welcome/index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ var styles = {
2727
textShadow: '1px 1px 0px #000',
2828
},
2929
};
30-
var Welcome = function () { return (React.createElement("div", {style: styles.header, className: 'cr-bg'}, React.createElement("div", {style: styles.title}, "CodeRoad"), React.createElement("div", {style: styles.tagline}, "Tutorials in your Editor"), React.createElement("br", null), React.createElement("br", null), React.createElement(index_1.RouteButton, {label: 'Start', route: 'tutorials', style: styles.button}))); };
30+
var Welcome = function (_a) {
31+
var title = _a.title, tagline = _a.tagline, firstRoute = _a.firstRoute;
32+
return (React.createElement("div", {style: styles.header, className: 'cr-bg'}, React.createElement("div", {style: styles.title}, title), React.createElement("div", {style: styles.tagline}, tagline), React.createElement("br", null), React.createElement("br", null), React.createElement(index_1.RouteButton, {label: 'Start', route: firstRoute, style: styles.button})));
33+
};
3134
Object.defineProperty(exports, "__esModule", { value: true });
3235
exports.default = Welcome;

lib/components/Start/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ var Start = (function (_super) {
3030
}
3131
Start.prototype.render = function () {
3232
var ready = this.props.ready;
33-
return (React.createElement("section", {className: 'cr-start'}, React.createElement("div", {style: headerStyles}, ready ? React.createElement(Welcome_1.default, null) : React.createElement(Checks_1.default, null))));
33+
return (React.createElement("section", {className: 'cr-start'}, React.createElement("div", {style: headerStyles}, ready
34+
? React.createElement(Welcome_1.default, {title: 'CodeRoad', tagline: 'Tutorials in your Editor', firstRoute: 'tutorials'})
35+
: React.createElement(Checks_1.default, null))));
3436
};
3537
Start = __decorate([
3638
react_redux_1.connect(function (state) { return ({

lib/components/index.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use strict";
2-
var Alert_1 = require('./Alert');
3-
exports.Alert = Alert_1.default;
2+
var core_coderoad_1 = require('core-coderoad');
3+
exports.Alert = core_coderoad_1.Alert;
4+
exports.Markdown = core_coderoad_1.Markdown;
45
var AppMenu_1 = require('./AppMenu');
56
exports.AppMenu = AppMenu_1.default;
67
var FinalPage_1 = require('./FinalPage');
@@ -15,9 +16,7 @@ var Start_1 = require('./Start');
1516
exports.Start = Start_1.default;
1617
var Tutorials_1 = require('./Tutorials');
1718
exports.Tutorials = Tutorials_1.default;
18-
var Markdown_1 = require('./common/Markdown');
19-
exports.Markdown = Markdown_1.default;
20-
var ContentCard_1 = require('./common/ContentCard');
21-
exports.ContentCard = ContentCard_1.default;
2219
var RouteButton_1 = require('./common/RouteButton');
2320
exports.RouteButton = RouteButton_1.default;
21+
var ContentCard_1 = require('./common/ContentCard');
22+
exports.ContentCard = ContentCard_1.default;

lib/reducers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ exports.default = redux_1.combineReducers({
1313
alert: core_coderoad_1.alertReducer, checks: setup_1.checks, editor: core_coderoad_1.editorReducer, dir: core_coderoad_1.dirReducer, hintPosition: hints_1.reducer,
1414
packageJson: setup_1.packageJson, pagePosition: page_1.pagePosition, progress: progress_1.reducer, route: core_coderoad_1.routeReducer,
1515
tutorial: tutorial_1.reducer, tutorials: tutorials_1.reducer,
16-
taskActions: page_1.taskActions, taskPosition: tests_1.taskPosition, taskTests: page_1.taskTests, testRun: tests_1.testRun, windowToggle: core_coderoad_1.windowToggle
16+
taskActions: page_1.taskActions, taskPosition: tests_1.taskPosition, taskTests: page_1.taskTests, testRun: tests_1.testRun, window: core_coderoad_1.windowReducer
1717
});

package.json

-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
"atom-plugin-command-line": "1.0.2",
3333
"coderoad-cli": "0.6.0",
3434
"core-coderoad": "0.3.0",
35-
"highlights": "1.3.1",
36-
"marked": "0.3.5",
3735
"material-ui": "0.15.0",
3836
"node-file-exists": "1.1.0",
3937
"react": "15.1.0",

src/components/Alert/index.tsx

-38
This file was deleted.

src/components/Routes/index.tsx

+12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@ import * as React from 'react';
22
import {connect} from 'react-redux';
33
import {Page, Progress, Tutorials, Start, FinalPage} from '../index';
44

5+
// const createRouter = (routes: Object) => {
6+
// return;
7+
// };
8+
//
9+
// const router = {
10+
// page: <Page />,
11+
// progress: <Progress />,
12+
// start: <Start />,
13+
// tutorials: <Tutorials />,
14+
// final: <FinalPage />,
15+
// };
16+
517
@connect(state => ({ route: state.route }))
618
export default class Routes extends React.Component<{
719
route?: string

src/components/SidePanel/SidePanel.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ import Drawer from 'material-ui/Drawer';
66
import Menu from 'material-ui/svg-icons/navigation/menu';
77

88
@connect(state => ({
9-
windowToggle: state.windowToggle,
9+
isWindowOpen: state.window,
1010
}))
1111
export default class SidePanel extends React.Component<{
12-
windowToggle?: boolean
12+
isWindowOpen?: boolean
1313
}, {}> {
1414
render(): React.ReactElement<{}> {
15-
const {windowToggle} = this.props;
15+
const {isWindowOpen} = this.props;
1616
return (
1717
<section>
1818
<Drawer
1919
width={400}
2020
openSecondary={true}
21-
open={windowToggle}
21+
open={isWindowOpen}
2222
>
2323
<div className='cr-bg'>
2424
<AppMenu />

src/components/Start/Welcome/index.tsx

+6-4
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,16 @@ const styles = {
3232
},
3333
};
3434

35-
const Welcome: React.StatelessComponent<{}> = () => (
35+
const Welcome: React.StatelessComponent<{
36+
title: string, tagline: string, firstRoute: string
37+
}> = ({title, tagline, firstRoute}) => (
3638
<div style={styles.header} className='cr-bg'>
37-
<div style={styles.title}>CodeRoad</div>
38-
<div style={styles.tagline}>Tutorials in your Editor</div>
39+
<div style={styles.title}>{title}</div>
40+
<div style={styles.tagline}>{tagline}</div>
3941
<br /><br />
4042
<RouteButton
4143
label='Start'
42-
route='tutorials'
44+
route={firstRoute}
4345
style={styles.button}
4446
/>
4547
</div>

src/components/Start/index.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ export default class Start extends React.Component<{
2121
return (
2222
<section className='cr-start'>
2323
<div style={headerStyles}>
24-
{ready ? <Welcome /> : <Checks />}
24+
{ready
25+
? <Welcome
26+
title='CodeRoad'
27+
tagline='Tutorials in your Editor'
28+
firstRoute='tutorials'
29+
/>
30+
: <Checks />}
2531
</div>
2632
</section>
2733
);

src/components/common/Markdown.tsx

-37
This file was deleted.

src/components/index.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
export {default as Alert} from './Alert';
1+
export {
2+
Alert, Markdown
3+
} from 'core-coderoad';
4+
25
export {default as AppMenu} from './AppMenu';
36
export {default as FinalPage} from './FinalPage';
47
export {default as Page} from './Page';
@@ -7,6 +10,5 @@ export {default as Routes} from './Routes';
710
export {default as Start} from './Start';
811
export {default as Tutorials} from './Tutorials';
912

10-
export {default as Markdown} from './common/Markdown';
11-
export {default as ContentCard} from './common/ContentCard';
1213
export {default as RouteButton} from './common/RouteButton';
14+
export {default as ContentCard} from './common/ContentCard';

src/components/render.ts

-11
This file was deleted.

src/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
2-
import render from './components/render';
32
import sidePanelElement from './components/SidePanel/element';
4-
import {loadPolyfills} from 'core-coderoad';
3+
import sidePanelRoot from './components/SidePanel/root';
4+
import {loadPolyfills, render} from 'core-coderoad';
55
import {onActivate, onDeactivate, addToStatusBar} from './subscriptions';
66
// activate Redux
77
import store from './store';
@@ -26,7 +26,7 @@ class Main {
2626
});
2727
onActivate();
2828
// render React component
29-
render(this.root);
29+
render(this.root, sidePanelRoot(store));
3030
}
3131
consumeStatusBar(statusBar) {
3232
this.statusBarTile = addToStatusBar(statusBar);

src/reducers.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ import {
1414
editorReducer as editor,
1515
dirReducer as dir,
1616
routeReducer as route,
17-
windowToggle
17+
windowReducer as window
1818
} from 'core-coderoad';
1919

2020
export default combineReducers({
2121
alert, checks, editor, dir, hintPosition,
2222
packageJson, pagePosition, progress, route,
2323
tutorial, tutorials,
24-
taskActions, taskPosition, taskTests, testRun, windowToggle
24+
taskActions, taskPosition, taskTests, testRun, window
2525
});

tsconfig.json

-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@
8080
"src/store.ts",
8181
"src/subscriptions.ts",
8282
"src/typings.d.ts",
83-
"src/components/Alert/index.tsx",
8483
"src/components/AppMenu/CloseWindow.tsx",
8584
"src/components/AppMenu/index.tsx",
8685
"src/components/AppMenu/issuesLink.tsx",
@@ -90,7 +89,6 @@
9089
"src/components/AppMenu/menuRightRouteOptions.tsx",
9190
"src/components/AppMenu/Quit/index.tsx",
9291
"src/components/common/ContentCard.tsx",
93-
"src/components/common/Markdown.tsx",
9492
"src/components/common/RouteButton.tsx",
9593
"src/components/FinalPage/index.tsx",
9694
"src/components/Page/EditPage/index.tsx",

0 commit comments

Comments
 (0)