Skip to content

Commit 1460520

Browse files
committed
rename defaultItem to _item
1 parent fae097a commit 1460520

File tree

19 files changed

+39
-33
lines changed

19 files changed

+39
-33
lines changed

lib/components/Progress/ProgressChapter.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ exports.ProgressChapter = function (_a) {
1111
return (React.createElement(List_1.ListItem, {key: 'c' + chapterIndex, className: classnames({
1212
'chapter': true,
1313
'isActive': isActive
14-
}), initiallyOpen: chapterIndex === 0, leftIcon: progressIcon_1.progressIcon(chapter.completed), primaryTogglesNestedList: chapterIndex === position.chapter && !chapter.completed, nestedItems: chapter.pages.map(function (page, pageIndex) { return (React.createElement(ProgressPage_1.ProgressPage, {key: 'c' + chapterIndex + 'p' + pageIndex, pageIndex: pageIndex, page: page, chapterIndex: chapterIndex, position: position})); })}, React.createElement("h3", null, chapterIndex + 1, ". ", chapter.title), React.createElement("span", {className: 'chapter-description'}, React.createElement(index_1.Markdown, null, chapter.description))));
14+
}), initiallyOpen: chapterIndex === 0, leftIcon: progressIcon_1.progressIcon(chapter.completed), primaryTogglesNestedList: chapterIndex === position.chapter && !chapter.completed, nestedItems: chapter.pages.map(function (page, pageIndex) { return (React.createElement(ProgressPage_1.ProgressPage, {key: chapterIndex + '_' + pageIndex, pageIndex: pageIndex, page: page, chapterIndex: chapterIndex, position: position})); })}, React.createElement("h3", null, chapterIndex + 1, ". ", chapter.title), React.createElement("span", {className: 'chapter-description'}, React.createElement(index_1.Markdown, null, chapter.description))));
1515
};

lib/components/Progress/ProgressPage.js

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ var ProgressPage = (function (_super) {
3939
};
4040
ProgressPage.prototype.render = function () {
4141
var _a = this.props, page = _a.page, position = _a.position, chapterIndex = _a.chapterIndex, pageIndex = _a.pageIndex, selectPage = _a.selectPage;
42-
console.log(this.props);
4342
var isActive = chapterIndex === position.chapter && pageIndex === position.page;
4443
return (React.createElement(List_1.ListItem, {className: classnames({
4544
'page': true,

lib/components/Start/Checks/SetupChecks.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
var React = require('react');
33
var Card_1 = require('material-ui/Card');
44
var FlatButton_1 = require('material-ui/FlatButton');
5-
var setup_checker_1 = require('./setup-checker');
6-
var verify_1 = require('./verify');
5+
var VerifyButton_1 = require('./VerifyButton');
76
var action_setup_1 = require('../../../reducers/checks/action-setup');
7+
var DynamicStepper_1 = require('./DynamicStepper');
88
var StepCheck_1 = require('./StepCheck');
99
exports.SetupChecks = function (_a) {
1010
var checks = _a.checks;
@@ -13,5 +13,5 @@ exports.SetupChecks = function (_a) {
1313
return null;
1414
}
1515
var status = [setup.dir, setup.packageJson, setup.tutorial];
16-
return (React.createElement(Card_1.Card, {className: 'cr-check'}, React.createElement(Card_1.CardHeader, {title: 'Setup Checks', subtitle: 'CodeRoad requires a brief setup'}), React.createElement(Card_1.CardText, null, React.createElement(setup_checker_1.default, {status: status}, React.createElement(StepCheck_1.StepCheck, {label: 'open a directory', completed: checks.setup.dir}, React.createElement("p", null, "File -> Open (a new folder)"), React.createElement("br", null), React.createElement(FlatButton_1.default, {label: 'Open Directory', secondary: true, onTouchTap: action_setup_1.openDirectory})), React.createElement(StepCheck_1.StepCheck, {label: 'package.json', completed: checks.setup.packageJson}, "Create a package.json by running", React.createElement("br", null), React.createElement("code", null, "> npm init -y`"), React.createElement("br", null), React.createElement(FlatButton_1.default, {label: 'Create package.json', secondary: true, onTouchTap: action_setup_1.createPackageJson})), React.createElement(StepCheck_1.StepCheck, {label: 'install a tutorial', completed: checks.setup.tutorial}, "Install a tutorial using npm. For example:", React.createElement("br", null), React.createElement("code", null, "> npm install --save-dev coderoad-functional-school"), React.createElement("br", null)))), React.createElement(Card_1.CardActions, null, React.createElement(verify_1.VerifyButton, null))));
16+
return (React.createElement(Card_1.Card, {className: 'cr-check'}, React.createElement(Card_1.CardHeader, {title: 'Setup Checks', subtitle: 'CodeRoad requires a brief setup'}), React.createElement(Card_1.CardText, null, React.createElement(DynamicStepper_1.DynamicStepper, {status: status}, React.createElement(StepCheck_1.StepCheck, {label: 'open a directory', completed: checks.setup.dir}, React.createElement("p", null, "File -> Open (a new folder)"), React.createElement("br", null), React.createElement(FlatButton_1.default, {label: 'Open Directory', secondary: true, onTouchTap: action_setup_1.openDirectory})), React.createElement(StepCheck_1.StepCheck, {label: 'package.json', completed: checks.setup.packageJson}, "Create a package.json by running", React.createElement("br", null), React.createElement("code", null, "> npm init -y`"), React.createElement("br", null), React.createElement(FlatButton_1.default, {label: 'Create package.json', secondary: true, onTouchTap: action_setup_1.createPackageJson})), React.createElement(StepCheck_1.StepCheck, {label: 'install a tutorial', completed: checks.setup.tutorial}, "Install a tutorial using npm. For example:", React.createElement("br", null), React.createElement("code", null, "> npm install --save-dev coderoad-functional-school"), React.createElement("br", null)))), React.createElement(Card_1.CardActions, null, React.createElement(VerifyButton_1.VerifyButton, null))));
1717
};

src/components/Progress/ProgressChapter.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const ProgressChapter: React.StatelessComponent<{
2525
nestedItems={
2626
chapter.pages.map((page: CR.Page, pageIndex: number) => (
2727
<ProgressPage
28-
key={'c' + chapterIndex + 'p' + pageIndex}
28+
key={chapterIndex + '_' + pageIndex}
2929
pageIndex={pageIndex}
3030
page={page}
3131
chapterIndex={chapterIndex}

src/components/Progress/ProgressPage.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export class ProgressPage extends React.Component<{
3030
}
3131
render() {
3232
const {page, position, chapterIndex, pageIndex, selectPage} = this.props;
33-
console.log(this.props);
3433
const isActive = chapterIndex === position.chapter && pageIndex === position.page;
3534
return (
3635
<ListItem

src/components/Progress/progressIcon.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import CheckBox from 'material-ui/svg-icons/toggle/check-box';
44
import PlayCircleFilled from 'material-ui/svg-icons/av/play-circle-filled';
55
import CheckBoxOutlineBlank from 'material-ui/svg-icons/toggle/check-box-outline-blank';
66

7-
export function progressIcon(completed: boolean, current: boolean) {
7+
export function progressIcon(completed: boolean, current?: boolean) {
88
if (completed) {
99
return <CheckBox />;
1010
} else if (current) {

src/components/Start/Checks/SetupChecks.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import * as React from 'react';
22
import {Step, StepLabel, StepContent} from 'material-ui/Stepper';
33
import {Card, CardHeader, CardText, CardActions} from 'material-ui/Card';
44
import FlatButton from 'material-ui/FlatButton';
5-
import DynamicStepper from './setup-checker';
6-
import {VerifyButton} from './verify';
5+
import {VerifyButton} from './VerifyButton';
76
import {openDirectory, createPackageJson} from '../../../reducers/checks/action-setup';
87
import {DynamicStepper} from './DynamicStepper';
98
import {StepCheck} from './StepCheck';

src/reducers/alert/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ import {
33
COMPLETE_PAGE, COMPLETE_CHAPTER, COMPLETE_TUTORIAL
44
} from '../../actions/_types';
55

6-
const defaultAlert: CR.Alert = {
6+
const _alert: CR.Alert = {
77
message: '',
88
open: false,
99
action: '',
1010
duration: 0
1111
};
1212

13-
let current: CR.Alert = defaultAlert;
13+
let current: CR.Alert = _alert;
1414

15-
export default function alertReducer(alert = defaultAlert, action: CR.Action): CR.Alert {
15+
export default function alertReducer(alert = _alert, action: CR.Action): CR.Alert {
1616
let statusBarAlert = <HTMLElement>document.getElementsByClassName('cr-alert-replay')[0];
1717
switch (action.type) {
1818
case ALERT_REPLAY:
@@ -23,7 +23,7 @@ export default function alertReducer(alert = defaultAlert, action: CR.Action): C
2323
duration: 2000
2424
};
2525
case ALERT_TOGGLE:
26-
return action.payload.alert || defaultAlert;
26+
return action.payload.alert || _alert;
2727
case TEST_RESULT:
2828
let result = action.payload.result;
2929
if (result.pass && result.change > 0) {

src/reducers/checks/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {SETUP_VERIFY} from '../../actions/_types';
22
import setupVerify from './verify';
33

4-
const defaultChecks = {
4+
const _checks = {
55
passed: false,
66
system: {
77
node: false,
@@ -14,7 +14,7 @@ const defaultChecks = {
1414
}
1515
};
1616

17-
export default function checksReducer(checks = defaultChecks, action: CR.Action): CR.Checks {
17+
export default function checksReducer(checks = _checks, action: CR.Action): CR.Checks {
1818
switch (action.type) {
1919
case SETUP_VERIFY:
2020
return setupVerify();

src/reducers/globals/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import {GLOBALS_SET} from '../../actions/_types';
22
import {globalsSet} from './set-globals';
33

44
// TODO: refactor out globals into state
5-
const defaultGlobals = {
5+
const _globals = {
66
dir: null,
77
win: null
88
};
99

10-
export default function globalReducer(globals = defaultGlobals,
10+
export default function globalReducer(globals = _globals,
1111
action: CR.Action): CR.Coderoad {
1212
switch (action.type) {
1313
case GLOBALS_SET:

src/reducers/package/index.ts

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import {} from '../../actions/_types';
2+
3+
const _package: PackageJson = {};
4+
5+
export default function packageReducer(package = _package, action: CR.Action): string {
6+
switch (action.type) {
7+
default:
8+
return package;
9+
}
10+
}

src/reducers/page/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import {
22
PAGE_SET, COMPLETE_PAGE
33
} from '../../actions/_types';
44

5-
const defaultPage: CR.Page = {
5+
const _page: CR.Page = {
66
title: '',
77
description: '',
88
completed: false
99
};
1010

11-
export default function pageReducer(page = defaultPage,
11+
export default function pageReducer(page = _page,
1212
action: CR.Action): CR.Page {
1313
switch (action.type) {
1414
case PAGE_SET:

src/reducers/position/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import {
22
PAGE_SET, POSITION_SET
33
} from '../../actions/_types';
44

5-
const defaultPosition: CR.Position = {
5+
const _position: CR.Position = {
66
chapter: 0,
77
page: 0
88
};
99

10-
export default function positionReducer(position = defaultPosition,
10+
export default function positionReducer(position = _position,
1111
action: CR.Action): CR.Position {
1212
switch (action.type) {
1313
case PAGE_SET:

src/reducers/progress/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
} from '../../actions/_types';
44
import TutorialPackage from '../../services/tutorial-package';
55

6-
const defaultProgress: CR.Progress = {
6+
const _progress: CR.Progress = {
77
completed: false,
88
chapters: [{
99
title: '',
@@ -17,7 +17,7 @@ const defaultProgress: CR.Progress = {
1717
}]
1818
};
1919

20-
export default function progressReducer(progress = defaultProgress,
20+
export default function progressReducer(progress = _progress,
2121
action: CR.Action): CR.Progress {
2222
switch (action.type) {
2323
case TUTORIAL_SET:

src/reducers/route/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import {ROUTE_SET} from '../../actions/_types';
22
import {store} from '../../store/store';
33

4-
const defaultRoute: string = 'start';
4+
const _route: string = 'start';
55

6-
export default function routeReducer(route = defaultRoute, action: CR.Action): string {
6+
export default function routeReducer(route = _route, action: CR.Action): string {
77
switch (action.type) {
88
case ROUTE_SET:
99
const next = action.payload.route;

src/reducers/task-position/index.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import {PAGE_SET, TEST_RESULT} from '../../actions/_types';
22

3-
const defaultTaskPosition: number = 0;
4-
5-
export default function taskPositionReducer(taskPosition = defaultTaskPosition, action: CR.Action): number {
3+
export default function taskPositionReducer(taskPosition = 0, action: CR.Action): number {
64
switch (action.type) {
75
case PAGE_SET:
86
return 0;

src/reducers/tasks/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import {PAGE_SET} from '../../actions/_types';
22

3-
const defaultTasks: CR.Task[] = [{
3+
const _tasks: CR.Task[] = [{
44
description: '',
55
completed: false,
66
tests: [],
77
hints: [],
88
actions: []
99
}];
1010

11-
export default function tasksReducer(tasks = defaultTasks,
11+
export default function tasksReducer(tasks = _tasks,
1212
action: CR.Action): CR.Task[] {
1313
switch (action.type) {
1414
case PAGE_SET:

src/reducers/tutorial-info/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import {TUTORIAL_SET} from '../../actions/_types';
22
import TutorialPackage from '../../services/tutorial-package';
33

4-
const defaultInfo: CR.TutorialInfo = {
4+
const _info: CR.TutorialInfo = {
55
title: '',
66
description: ''
77
};
88

9-
export default function projectReducer(info = defaultInfo,
9+
export default function projectReducer(info = _info,
1010
action: CR.Action): CR.TutorialInfo {
1111
switch (action.type) {
1212
case TUTORIAL_SET:

tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
"src/reducers/globals/set-globals.ts",
8282
"src/reducers/hint-position/index.ts",
8383
"src/reducers/index.ts",
84+
"src/reducers/package/index.ts",
8485
"src/reducers/page/index.ts",
8586
"src/reducers/position/index.ts",
8687
"src/reducers/progress/index.ts",

0 commit comments

Comments
 (0)