Skip to content

Commit 8e0ca1e

Browse files
committed
fix code background color
1 parent 7d1287f commit 8e0ca1e

File tree

16 files changed

+163
-58
lines changed

16 files changed

+163
-58
lines changed

lib/atom/editor.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ var Action = require('../actions/actions');
66
function setAtomGlobals() {
77
if (atom.project.rootDirectories.length > 0) {
88
window.coderoad.dir = atom.project.rootDirectories[0].path;
9+
_base_1.store.dispatch(Action.setSetup({ hasDirectory: true }));
910
}
1011
else {
1112
var message = 'Create a new Atom project. In Atom: File > Open > any folder';

lib/components/app/router.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ var __extends = (this && this.__extends) || function (d, b) {
66
};
77
var React = require('react');
88
var _components_1 = require('./../_components');
9-
var ReactCSSTransitionGroup = require('react-addons-css-transition-group');
109
var default_1 = (function (_super) {
1110
__extends(default_1, _super);
1211
function default_1() {
@@ -26,7 +25,7 @@ var default_1 = (function (_super) {
2625
};
2726
default_1.prototype.render = function () {
2827
var state = this.props.state;
29-
return (React.createElement(ReactCSSTransitionGroup, {transitionName: 'route', transitionEnterTimeout: 500, transitionLeaveTimeout: 300}, this.chooseRoute(state)));
28+
return (React.createElement("div", null, this.chooseRoute(state)));
3029
};
3130
return default_1;
3231
}(React.Component));

lib/services/package.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,9 @@ var PackageService = (function () {
6262
return tasks;
6363
};
6464
PackageService.prototype.getPage = function (position) {
65-
var page = this.page(position);
65+
var _a = this.page(position), title = _a.title, description = _a.description, onPageComplete = _a.onPageComplete, completed = _a.completed;
6666
return {
67-
title: page.title,
68-
description: page.description,
69-
onPageComplete: page.onPageComplete,
70-
completed: page.completed || false,
67+
title: title, description: description, onPageComplete: onPageComplete, completed: completed || false
7168
};
7269
};
7370
PackageService.prototype.getSavedPosition = function () {
@@ -96,12 +93,11 @@ var PackageService = (function () {
9693
var chapters = this.data.chapters;
9794
return {
9895
completed: false,
99-
chapters: !chapters ? [] : chapters.map(function (chapter) {
96+
chapters: !chapters ? [] : chapters.map(function (_a) {
97+
var title = _a.title, description = _a.description, completed = _a.completed, pages = _a.pages;
10098
return {
101-
title: chapter.title,
102-
description: chapter.description,
103-
completed: chapter.completed || false,
104-
pages: !chapter.pages ? [] : chapter.pages.map(function (page) {
99+
title: title, description: description, completed: completed || false,
100+
pages: !pages ? [] : pages.map(function (page) {
105101
return {
106102
title: page.title,
107103
description: page.description,

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
"marked": "0.3.5",
4242
"material-ui": "0.14.4",
4343
"react": "0.14.7",
44-
"react-addons-css-transition-group": "^0.14.7",
4544
"react-dom": "0.14.7",
4645
"react-redux": "4.4.0",
4746
"react-tap-event-plugin": "0.2.2",

src/atom/editor.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import * as Action from '../actions/actions';
66
export function setAtomGlobals() {
77
if (atom.project.rootDirectories.length > 0) {
88
window.coderoad.dir = atom.project.rootDirectories[0].path;
9+
store.dispatch(Action.setSetup({hasDirectory: true}));
910
} else {
1011
let message = 'Create a new Atom project. In Atom: File > Open > any folder';
1112
store.dispatch(Action.toggleAlert({ message, action: 'tip', duration: 6000 }));
@@ -48,7 +49,7 @@ export function getEditor() {
4849
* Actions in Atom Editor
4950
* @return {[type]} [description]
5051
*/
51-
export function open(filePath: string, options?: Object) {
52+
export function open(filePath: string, options = {}) {
5253
// delete file first, to avoid bug
5354
if (fileExists(filePath)) {
5455
fs.unlink(filePath);
@@ -67,7 +68,7 @@ export function set(text: string) {
6768
});
6869
}
6970

70-
export function insert(text: string, options?: Object) {
71+
export function insert(text: string, options = {}) {
7172
options = Object.assign(options, {
7273
autoIndent: true
7374
});

src/atom/main.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@ class Main {
3030
this.statusBarTile = addToStatusBar(statusBar);
3131
}
3232
deactivate(): void {
33+
// remove bottom status bar icon
3334
if (this.statusBarTile) {
3435
this.statusBarTile.destroy();
3536
this.statusBarTile = null;
3637
}
38+
// remove subscriptions & unmount react app
3739
onDeactivateSubscriptionsAndUnmount();
3840
}
3941
toggle(): void {

src/components/alert/alert.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ const defaultAlert = {
2020
export default class extends React.Component<{alert: CR.Alert, toggleAlert?: any}, CR.Alert> {
2121
render() {
2222
const {alert, toggleAlert} = this.props;
23+
const {action, open, message, duration} = alert;
2324
return (
2425
<Snackbar
25-
className={classNames('cr-alert', alert.action)}
26-
open={alert.open || false}
27-
message={alert.message || ''}
28-
action={alert.action}
29-
autoHideDuration={alert.duration || 1500}
26+
className={classNames('cr-alert', action)}
27+
open={open || false}
28+
message={message || ''}
29+
action={action}
30+
autoHideDuration={duration || 1500}
3031
onActionTouchTap={toggleAlert}
3132
onRequestClose={toggleAlert}
3233
/>

src/components/app/_app.less

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@ atom-panel-container > atom-panel > #crv {
99
@keyframes slide {
1010
100% { width: 400px; }
1111
}
12+
13+
#crv {
14+
code {
15+
background-color: rgb(22, 23, 25);
16+
}
17+
}

src/components/app/router.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as React from 'react';
22
import {Page, Progress, Start} from './../_components';
3-
import * as ReactCSSTransitionGroup from 'react-addons-css-transition-group';
43

54
export default class extends React.Component<{state: CR.State}, {}> {
65
chooseRoute(state: CR.State) {
@@ -25,9 +24,9 @@ export default class extends React.Component<{state: CR.State}, {}> {
2524
render() {
2625
const state = this.props.state;
2726
return (
28-
<ReactCSSTransitionGroup transitionName='route' transitionEnterTimeout={500} transitionLeaveTimeout={300}>
27+
<div>
2928
{this.chooseRoute(state)}
30-
</ReactCSSTransitionGroup>
29+
</div>
3130
);
3231
}
3332
}

src/components/menu/menu.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,31 +34,35 @@ export default class extends React.Component<{
3434
route: string, position: CR.Position, routeToProgress?: any, routeToPage?: any, routeToProjects?: any, quit?: any
3535
}, {}> {
3636
navOptions(): React.ReactElement<{}> {
37+
const {routeToProgress, routeToPage} = this.props;
3738
switch (this.props.route) {
3839
case 'page':
39-
return <button onTouchTap={this.props.routeToProgress}>progress</button>;
40+
return <button onTouchTap={routeToProgress}>progress</button>;
4041
case 'progress':
41-
return <button onTouchTap={this.props.routeToPage}>page</button>;
42+
return <button onTouchTap={routeToPage}>page</button>;
4243
default: return null;
4344
}
4445
}
4546
menuOptions() {
47+
const {routeToProgress, routeToProjects} = this.props;
4648
switch (this.props.route) {
4749
case 'page':
4850
return (
4951
<div>
50-
<MenuItem primaryText='progress' onTouchTap={this.props.routeToProgress} key='progress' />
51-
<MenuItem primaryText='projects' onTouchTap={this.props.routeToProjects} key='projects' />
52+
<MenuItem primaryText='progress' onTouchTap={routeToProgress} key='progress' />
53+
<MenuItem primaryText='projects' onTouchTap={routeToProjects} key='projects' />
5254
</div>);
5355
case 'progress':
54-
return <MenuItem primaryText='projects' onTouchTap={this.props.routeToProjects} key='projects' />;
56+
return <MenuItem primaryText='projects' onTouchTap={routeToProjects} key='projects' />;
5557
default: return null;
5658
}
5759
}
5860
closePanel() {
5961
togglePanel();
6062
}
6163
render(): React.ReactElement<{}> {
64+
const origin = {horizontal: 'right', vertical: 'top'};
65+
const {quit} = this.props;
6266
return (
6367
<AppBar title={'CodeRoad'}
6468
className='cr-menu-bar'
@@ -68,20 +72,19 @@ export default class extends React.Component<{
6872
iconButtonElement={
6973
<IconButton><MoreVertIcon /></IconButton>
7074
}
71-
targetOrigin={{horizontal: 'right', vertical: 'top'}}
72-
anchorOrigin={{horizontal: 'right', vertical: 'top'}}
73-
>
75+
targetOrigin={origin}
76+
anchorOrigin={origin}>
7477
{/* Menu Items */}
7578
{this.menuOptions()}
76-
{}
79+
7780
{window.coderoad.issuesPath ? <MenuItem key='issue'>
7881
<a href={window.coderoad.issuesPath}>
7982
post issue
8083
</a>
8184
</MenuItem> : null}
8285

8386
<Divider />
84-
<MenuItem primaryText='quit' onTouchTap={this.props.quit}/>
87+
<MenuItem primaryText='quit' onTouchTap={quit}/>
8588

8689
</IconMenu>
8790
} />

src/components/page/edit.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
import * as React from 'react';
22
import * as path from 'path';
33
const Edit = require('material-ui/lib/svg-icons/editor/mode-edit');
4+
const editStyle = {position: 'absolute', top: '10px', right: '10px'};
45

5-
/**
6-
* Edit Component
7-
* basic chapter info
8-
*/
9-
export default (editPath) => {
6+
export default (editPath: string) => {
107
if (editPath && window.coderoad.edit) {
118
let repoPath = path.join(window.coderoad.repo, 'edit', 'master', editPath);
129
return <a href={repoPath}>
13-
<Edit style={{position: 'absolute', top: '10px', right: '10px'}}/>
10+
<Edit style={editStyle}/>
1411
</a>;
1512
}
1613
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.cr {
2+
&-projects {
3+
height: 100%;
4+
text-align: center;
5+
&-header {
6+
display: block;
7+
height: 300px;
8+
background-color: lightblue;
9+
padding-top: 100px;
10+
.title {
11+
color: white;
12+
font-size: 2em;
13+
}
14+
.tagline {
15+
color: white;
16+
font-size: 1.5em;
17+
}
18+
.notes {
19+
padding-top: 10px;
20+
font-size: 1em;
21+
}
22+
}
23+
}
24+
&-tutorials {
25+
padding: 10px;
26+
}
27+
}

src/components/projects/projects.tsx

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
'use strict';
2+
import * as React from 'react';
3+
import {connect} from 'react-redux';
4+
import * as Action from '../../actions/actions';
5+
import {Paper, RaisedButton, List, ListItem} from 'material-ui';
6+
7+
@connect(null, (dispatch) => {
8+
return {
9+
selectProject: (name: string) => {
10+
Action.loadTutorial(name);
11+
dispatch(Action.setRoute('progress'));
12+
},
13+
toggleAlert: (item: CR.Alert): void => {
14+
dispatch(Action.toggleAlert(item));
15+
},
16+
loadTutorials: () => {
17+
dispatch(Action.loadTutorials());
18+
}
19+
};
20+
})
21+
export default class Projects extends React.Component<{
22+
tutorials: string[], toggleAlert?: any, selectProject?: any, loadTutorials?: any
23+
}, {}> {
24+
load() {
25+
this.props.loadTutorials();
26+
}
27+
trim(name: string): string {
28+
if (name.match(/^coderoad-tutorial-/)) {
29+
return name.slice(18);
30+
}
31+
if (name.match(/^coderoad-/)) {
32+
return name.slice(9);
33+
}
34+
return name;
35+
}
36+
render() {
37+
// let tutorials: string[] = getTutorials();
38+
return (
39+
<Paper className='cr-projects'>
40+
41+
<div className='cr-projects-header'>
42+
<span className='title'>CodeRoad</span>
43+
<p className='tagline'>Tutorials in the Editor</p>
44+
45+
46+
<div className='cr-tutorials'>
47+
<List subheader='Tutorials' >
48+
49+
{window.coderoad.dir ? null : <ListItem
50+
key='open'
51+
primaryText='Create an Atom Project'
52+
secondaryText='File > Open > any older' /> }
53+
54+
{this.props.tutorials.length > 0 ?
55+
this.props.tutorials.map((tutorial: string, index) => {
56+
return (<ListItem
57+
key={index}
58+
primaryText={this.trim(tutorial)}
59+
onClick={this.props.selectProject.bind(this,
60+
tutorial)}/>);
61+
}) : <ListItem
62+
key='demo'
63+
primaryText='Try a Demo'
64+
secondaryText='npm i -s coderoad-functional-school'/>}
65+
66+
</List>
67+
<br />
68+
<RaisedButton label='Load Tutorials' secondary={true} onClick={this.load.bind(this)} />
69+
</div>
70+
<p className='notes'>Beta</p>
71+
72+
</div>
73+
</Paper>
74+
);
75+
}
76+
};

0 commit comments

Comments
 (0)