Skip to content

Commit 8f134cc

Browse files
committed
remove dev warnings
1 parent 3c34288 commit 8f134cc

File tree

7 files changed

+29
-19
lines changed

7 files changed

+29
-19
lines changed

lib/components/alert/alert.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,18 @@ var react_redux_1 = require('react-redux');
1818
var Action = require('../../actions/actions');
1919
var material_ui_1 = require('material-ui');
2020
var classNames = require('classnames');
21+
var defaultAlert = {
22+
open: false,
23+
message: '',
24+
};
2125
var default_1 = (function (_super) {
2226
__extends(default_1, _super);
2327
function default_1() {
2428
_super.apply(this, arguments);
2529
}
2630
default_1.prototype.render = function () {
27-
var alert = this.props.alert;
28-
return (React.createElement(material_ui_1.Snackbar, {className: classNames('cr-alert', alert.action), open: alert.open, message: alert.message, action: alert.action, autoHideDuration: alert.duration || 1500, onActionTouchTap: this.props.toggleAlert}));
31+
var _a = this.props, alert = _a.alert, toggleAlert = _a.toggleAlert;
32+
return (React.createElement(material_ui_1.Snackbar, {className: classNames('cr-alert', alert.action), open: alert.open || false, message: alert.message || '', action: alert.action, autoHideDuration: alert.duration || 1500, onActionTouchTap: toggleAlert, onRequestClose: toggleAlert}));
2933
};
3034
default_1 = __decorate([
3135
react_redux_1.connect(null, function (dispatch) {

lib/components/progress/progress.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ exports.default = function (_a) {
8080
var progress = _a.progress, position = _a.position;
8181
return (React.createElement(material_ui_1.Paper, {style: style, zDepth: 1, className: 'cr-progress'}, React.createElement(material_ui_1.List, {subheader: 'Progress'}, progress.chapters.map(function (chapter, chapterIndex) {
8282
var isActive = chapterIndex === position.chapter;
83-
return React.createElement(material_ui_1.ListItem, {primaryText: (chapterIndex + 1) + ". " + chapter.title, className: classnames({
83+
return React.createElement(material_ui_1.ListItem, {primaryText: (chapterIndex + 1) + ". " + chapter.title, key: 'c' + chapterIndex, className: classnames({
8484
'chapter': true,
8585
'isActive': isActive
8686
}), secondaryText: chapter.description, secondaryTextLines: chapter.description.length > 35 ? 2 : 1, initiallyOpen: chapterIndex === 0, leftIcon: chapter.completed ? React.createElement(AllCompleted, null) : null, primaryTogglesNestedList: chapterIndex === position.chapter && !chapter.completed, nestedItems: chapter.pages.map(function (page, pageIndex) {

lib/components/projects/projects.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ var Projects = (function (_super) {
3636
};
3737
Projects.prototype.render = function () {
3838
var _this = this;
39-
return (React.createElement(material_ui_1.Paper, {className: 'cr-projects'}, React.createElement("div", {className: 'cr-projects-header'}, React.createElement("span", {className: 'title'}, "CodeRoad"), React.createElement("p", {className: 'tagline'}, "Tutorials in the Editor"), React.createElement("div", {className: 'cr-tutorials'}, React.createElement(material_ui_1.List, {subheader: 'Tutorials'}, window.coderoad.dir ? null : React.createElement(material_ui_1.ListItem, {primaryText: 'Create an Atom Project', secondaryText: 'File > Open > any older'}), this.props.tutorials.length > 0 ?
40-
this.props.tutorials.map(function (tutorial) {
41-
return (React.createElement(material_ui_1.ListItem, {primaryText: _this.trim(tutorial), onClick: _this.props.selectProject.bind(_this, tutorial)}));
42-
}) : React.createElement(material_ui_1.ListItem, {primaryText: 'Try a Demo', secondaryText: 'npm i -s coderoad-functional-school'})), React.createElement("br", null), React.createElement(material_ui_1.RaisedButton, {label: 'Load Tutorials', secondary: true, onClick: this.load.bind(this)})), React.createElement("p", {className: 'notes'}, "Beta"))));
39+
return (React.createElement(material_ui_1.Paper, {className: 'cr-projects'}, React.createElement("div", {className: 'cr-projects-header'}, React.createElement("span", {className: 'title'}, "CodeRoad"), React.createElement("p", {className: 'tagline'}, "Tutorials in the Editor"), React.createElement("div", {className: 'cr-tutorials'}, React.createElement(material_ui_1.List, {subheader: 'Tutorials'}, window.coderoad.dir ? null : React.createElement(material_ui_1.ListItem, {key: 'open', primaryText: 'Create an Atom Project', secondaryText: 'File > Open > any older'}), this.props.tutorials.length > 0 ?
40+
this.props.tutorials.map(function (tutorial, index) {
41+
return (React.createElement(material_ui_1.ListItem, {key: index, primaryText: _this.trim(tutorial), onClick: _this.props.selectProject.bind(_this, tutorial)}));
42+
}) : React.createElement(material_ui_1.ListItem, {key: 'demo', primaryText: 'Try a Demo', secondaryText: 'npm i -s coderoad-functional-school'})), React.createElement("br", null), React.createElement(material_ui_1.RaisedButton, {label: 'Load Tutorials', secondary: true, onClick: this.load.bind(this)})), React.createElement("p", {className: 'notes'}, "Beta"))));
4343
};
4444
Projects = __decorate([
4545
react_redux_1.connect(null, function (dispatch) {

src/components/alert/alert.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ import * as Action from '../../actions/actions';
55
import {Snackbar} from 'material-ui';
66
const classNames = require('classnames');
77

8-
/**
9-
* Alert
10-
* - success
11-
*/
8+
const defaultAlert = {
9+
open: false,
10+
message: '',
11+
};
12+
1213
@connect(null, (dispatch) => {
1314
return {
1415
toggleAlert: () => {
@@ -18,15 +19,16 @@ const classNames = require('classnames');
1819
})
1920
export default class extends React.Component<{alert: CR.Alert, toggleAlert?: any}, CR.Alert> {
2021
render() {
21-
const alert = this.props.alert;
22+
const {alert, toggleAlert} = this.props;
2223
return (
2324
<Snackbar
2425
className={classNames('cr-alert', alert.action)}
25-
open={alert.open}
26-
message={alert.message}
26+
open={alert.open || false}
27+
message={alert.message || ''}
2728
action={alert.action}
2829
autoHideDuration={alert.duration || 1500}
29-
onActionTouchTap={this.props.toggleAlert}
30+
onActionTouchTap={toggleAlert}
31+
onRequestClose={toggleAlert}
3032
/>
3133
);
3234
}

src/components/page/hint.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export default class extends React.Component<{
2121
render() {
2222
const {task, hintPosition, nextHint, prevHint} = this.props;
2323
const hints = task && task.hints ? task.hints : null;
24-
console.log(hintPosition, hints, nextHint);
2524
if (hintPosition < 0 || !hints || !hints.length) {
2625
return <div></div>;
2726
} else {

src/components/progress/progress.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export default ({progress, position}) => (
7171
{progress.chapters.map((chapter: CR.Chapter, chapterIndex: number) => {
7272
const isActive = chapterIndex === position.chapter;
7373
return <ListItem primaryText={`${chapterIndex + 1}. ${chapter.title}`}
74+
key={'c' + chapterIndex}
7475
className={classnames({
7576
'chapter': true,
7677
'isActive': isActive

src/components/projects/projects.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,21 @@ export default class Projects extends React.Component<{
4747
<List subheader='Tutorials' >
4848

4949
{window.coderoad.dir ? null : <ListItem
50+
key='open'
5051
primaryText='Create an Atom Project'
5152
secondaryText='File > Open > any older' /> }
5253

5354
{this.props.tutorials.length > 0 ?
54-
this.props.tutorials.map((tutorial: string) => {
55+
this.props.tutorials.map((tutorial: string, index) => {
5556
return (<ListItem
57+
key={index}
5658
primaryText={this.trim(tutorial)}
5759
onClick={this.props.selectProject.bind(this,
5860
tutorial)}/>);
59-
}) : <ListItem primaryText='Try a Demo'
60-
secondaryText='npm i -s coderoad-functional-school'/>}
61+
}) : <ListItem
62+
key='demo'
63+
primaryText='Try a Demo'
64+
secondaryText='npm i -s coderoad-functional-school'/>}
6165

6266
</List>
6367
<br />

0 commit comments

Comments
 (0)