Skip to content

Commit 745197c

Browse files
committed
remove unnecessary components
1 parent 7992487 commit 745197c

File tree

13 files changed

+131
-441
lines changed

13 files changed

+131
-441
lines changed

lib/components/Page/Hints/index.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ var React = require('react');
1717
var react_redux_1 = require('react-redux');
1818
var List_1 = require('material-ui/List');
1919
var actions_1 = require('../../../actions');
20-
var TextField_1 = require('material-ui/TextField');
2120
var styles = {
2221
text: {
2322
margin: '10px 15px',
@@ -40,14 +39,12 @@ var Hints = (function (_super) {
4039
var _this = this;
4140
var _a = this.props, hints = _a.hints, editorMarkdownOpen = _a.editorMarkdownOpen;
4241
var text = this.state.text;
43-
return (React.createElement(List_1.List, null,
44-
!hints || !hints.length
45-
? []
46-
: hints.map(function (hint, index) { return (React.createElement(List_1.ListItem, {key: index, secondaryText: React.createElement("p", null,
47-
index + 1,
48-
". ",
49-
hint), onClick: editorMarkdownOpen.bind(_this, hint, null)})); }),
50-
React.createElement(TextField_1.default, {style: styles.text, hintText: 'Hint text', multiLine: true, value: text, onChange: this.handleChange.bind(this)})));
42+
return (React.createElement(List_1.List, null, !hints || !hints.length
43+
? []
44+
: hints.map(function (hint, index) { return (React.createElement(List_1.ListItem, {key: index, secondaryText: React.createElement("p", null,
45+
index + 1,
46+
". ",
47+
hint), onClick: editorMarkdownOpen.bind(_this, hint, null)})); })));
5148
};
5249
Hints = __decorate([
5350
react_redux_1.connect(null, { editorMarkdownOpen: actions_1.editorMarkdownOpen }),

lib/components/Page/TaskActions/index.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ var Stepper_1 = require('material-ui/Stepper');
1919
var index_1 = require('../../index');
2020
var task_object_1 = require('./task-object');
2121
var actions_1 = require('../../../actions');
22-
var TextField_1 = require('material-ui/TextField');
23-
var SelectField_1 = require('material-ui/SelectField');
24-
var MenuItem_1 = require('material-ui/MenuItem');
2522
var styles = {
2623
form: {
2724
margin: '10px 15px',
@@ -73,13 +70,8 @@ var TaskActions = (function (_super) {
7370
React.createElement(Stepper_1.StepContent, null, a.singleLine ? ''
7471
: React.createElement("div", {onClick: editorMarkdownOpen.bind(_this, a.content, null)},
7572
React.createElement(index_1.Markdown, null, '```js\n' + a.content + '\n```')
76-
)))); })),
77-
React.createElement("span", {style: styles.form},
78-
React.createElement(SelectField_1.default, {value: this.state.as.action, onChange: this.handleSelect.bind(this), style: styles.select},
79-
React.createElement(MenuItem_1.default, {key: 'open', value: 'open', primaryText: 'open'}),
80-
React.createElement(MenuItem_1.default, {key: 'set', value: 'set', primaryText: 'set'}),
81-
React.createElement(MenuItem_1.default, {key: 'insert', value: 'insert', primaryText: 'insert'})),
82-
React.createElement(TextField_1.default, {hintText: 'Content', value: this.state.as.content, onChange: this.handleText.bind(this)}))));
73+
)))); }))
74+
));
8375
};
8476
TaskActions = __decorate([
8577
react_redux_1.connect(null, { tutorialActionAdd: actions_1.tutorialActionAdd, editorMarkdownOpen: actions_1.editorMarkdownOpen }),

lib/components/Page/Tests/index.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ var React = require('react');
1717
var react_redux_1 = require('react-redux');
1818
var path_1 = require('path');
1919
var actions_1 = require('../../../actions');
20-
var FlatButton_1 = require('material-ui/FlatButton');
2120
var core_coderoad_1 = require('core-coderoad');
2221
var styles = {
23-
button: {
22+
test: {
2423
bottom: '8px',
2524
},
2625
};
@@ -30,9 +29,8 @@ var Tests = (function (_super) {
3029
_super.apply(this, arguments);
3130
}
3231
Tests.prototype.render = function () {
33-
var _this = this;
34-
var _a = this.props, tests = _a.tests, config = _a.config, style = _a.style, open = _a.open;
35-
return (React.createElement("div", {style: style}, tests.map(function (file, index) { return (React.createElement(FlatButton_1.default, {key: index, style: styles.button, onClick: open.bind(_this, file), label: 'Test', secondary: true})); })));
32+
var _a = this.props, tests = _a.tests, style = _a.style, open = _a.open;
33+
return (React.createElement("div", {style: style}, tests.map(function (file, index) { return (React.createElement("button", null, file)); })));
3634
};
3735
Tests = __decorate([
3836
react_redux_1.connect(function (state) { return ({

lib/components/Publish/index.js

Lines changed: 21 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@ var __metadata = (this && this.__metadata) || function (k, v) {
1515
};
1616
var React = require('react');
1717
var react_redux_1 = require('react-redux');
18-
var redux_form_1 = require('redux-form');
18+
var Table_1 = require('material-ui/Table');
1919
var Card_1 = require('material-ui/Card');
2020
var RaisedButton_1 = require('material-ui/RaisedButton');
2121
var actions_1 = require('../../actions');
2222
var TopPanel_1 = require('../TopPanel');
23-
var textField_1 = require('../Form/textField');
24-
var validate_1 = require('./validate');
2523
var styles = {
2624
card: {
2725
margin: '10px',
@@ -32,6 +30,15 @@ var styles = {
3230
margin: '30px 10px 20px 10px',
3331
},
3432
};
33+
var fields = [{
34+
name: 'author(s)',
35+
example: 'Shawn McKay <[email protected]>',
36+
status: true,
37+
}, {
38+
name: 'keywords',
39+
example: '["CodeRoad", "JS", "React"]',
40+
status: false,
41+
}];
3542
var TutorialPublish = (function (_super) {
3643
__extends(TutorialPublish, _super);
3744
function TutorialPublish() {
@@ -42,50 +49,21 @@ var TutorialPublish = (function (_super) {
4249
this.props.editorPjOpen();
4350
};
4451
TutorialPublish.prototype.componentDidMount = function () {
45-
var _this = this;
4652
TopPanel_1.topElement.toggle(false);
47-
setTimeout(function () {
48-
var _a = _this.props.packageJson, description = _a.description, version = _a.version, keywords = _a.keywords;
49-
_this.props.initialize({
50-
description: description,
51-
version: version,
52-
keywords: keywords,
53-
});
54-
});
55-
document.getElementsByTagName('input')[0].focus();
56-
};
57-
TutorialPublish.prototype.shouldComponentUpdate = function () {
58-
if (document.activeElement &&
59-
typeof document.activeElement.value === 'string') {
60-
return false;
61-
}
62-
};
63-
TutorialPublish.prototype.onSubmit = function (values) {
64-
var description = values.description, version = values.version, author = values.author, keywords = values.keywords;
65-
this.props.pjSave(Object.assign({}, this.props.packageJson, {
66-
description: description, version: version, author: author,
67-
}));
6853
};
6954
TutorialPublish.prototype.render = function () {
70-
var _a = this.props, pristine = _a.pristine, submitting = _a.submitting, handleSubmit = _a.handleSubmit, invalid = _a.invalid;
7155
return (React.createElement(Card_1.Card, {style: styles.card},
7256
React.createElement(Card_1.CardHeader, {title: 'Tutorial Info'}),
73-
React.createElement("form", {onSubmit: handleSubmit(this.onSubmit.bind(this))},
74-
React.createElement(redux_form_1.Field, {name: 'author', component: textField_1.default.bind(null, {
75-
hintText: 'Shawn McKay <[email protected]>',
76-
floatingLabelText: 'Author <email>',
77-
}), tabIndex: '1'}),
78-
React.createElement(redux_form_1.Field, {name: 'description', component: textField_1.default.bind(null, {
79-
hintText: 'Tutorial description',
80-
floatingLabelText: 'Description',
81-
}), tabIndex: '1'}),
82-
React.createElement(redux_form_1.Field, {name: 'version', component: textField_1.default.bind(null, {
83-
hintText: '0.1.0',
84-
floatingLabelText: 'Version',
85-
disabled: true,
86-
}), tabIndex: '2'}),
87-
React.createElement(RaisedButton_1.default, {type: 'submit', style: styles.button, label: 'Save', primary: true, disabled: invalid}),
88-
React.createElement(RaisedButton_1.default, {style: styles.button, label: 'Publish', secondary: true, disabled: invalid, onTouchTap: function () { return alert('Publish not yet implemented'); }}))));
57+
React.createElement(Table_1.Table, {fixedHeader: true, selectable: false},
58+
React.createElement(Table_1.TableHeader, {displaySelectAll: false, adjustForCheckbox: false},
59+
React.createElement(Table_1.TableRow, null,
60+
React.createElement(Table_1.TableHeaderColumn, null, "Field"),
61+
React.createElement(Table_1.TableHeaderColumn, null, "Description"))
62+
),
63+
React.createElement(Table_1.TableBody, {displayRowCheckbox: false}, fields.map(function (field, index) { return (React.createElement(Table_1.TableRow, {key: index},
64+
React.createElement(Table_1.TableRowColumn, null, field.name),
65+
React.createElement(Table_1.TableRowColumn, null, field.example))); }))),
66+
React.createElement(RaisedButton_1.default, {style: styles.button, label: 'Publish', secondary: true, disabled: true, onTouchTap: function () { return alert('Publish not yet implemented'); }})));
8967
};
9068
TutorialPublish = __decorate([
9169
react_redux_1.connect(function (state) { return ({
@@ -96,7 +74,4 @@ var TutorialPublish = (function (_super) {
9674
return TutorialPublish;
9775
}(React.Component));
9876
Object.defineProperty(exports, "__esModule", { value: true });
99-
exports.default = redux_form_1.reduxForm({
100-
form: 'tutorialPublish',
101-
validate: validate_1.default,
102-
})(TutorialPublish);
77+
exports.default = TutorialPublish;

lib/components/Publish/validate.js

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
1-
"use strict";
2-
var debounce = require('lodash.debounce');
3-
var validate = debounce(function (values) {
4-
var errors = {};
5-
var requiredFields = ['description', 'version', 'author'];
6-
requiredFields.forEach(function (field) {
7-
if (!values[field]) {
8-
errors[field] = 'Required';
9-
}
10-
});
11-
if (!values.version || !values.version.match(/^(\d+\.)?(\d+\.)?(\*|\d+)$/)) {
12-
errors.version = 'Invalid version number';
13-
}
14-
return errors;
15-
}, 200);
16-
Object.defineProperty(exports, "__esModule", { value: true });
17-
exports.default = validate;
1+
var fields = {
2+
name: 'coderoad-tutorial-name',
3+
version: '0.1.0',
4+
description: 'Describe your tutorial',
5+
keywords: '',
6+
};

lib/components/TutorialInfo/index.js

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

src/components/Page/Hints/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,13 @@ export default class Hints extends React.Component<{
4545
onClick={editorMarkdownOpen.bind(this, hint, null)}/>
4646
))
4747
}
48-
<TextField
48+
{/*<TextField
4949
style={styles.text}
5050
hintText='Hint text'
5151
multiLine={true}
5252
value={text}
5353
onChange={this.handleChange.bind(this)}
54-
/>
55-
54+
/>*/}
5655
</List>
5756
);
5857
}

src/components/Page/TaskActions/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export default class TaskActions extends React.Component<{
8686
</Step>
8787
))}
8888
</Stepper>
89-
<span style={styles.form}>
89+
{/*<span style={styles.form}>
9090
<SelectField
9191
value={this.state.as.action}
9292
onChange={this.handleSelect.bind(this)}
@@ -101,7 +101,7 @@ export default class TaskActions extends React.Component<{
101101
value={this.state.as.content}
102102
onChange={this.handleText.bind(this)}
103103
/>
104-
</span>
104+
</span>*/}
105105
</section>
106106
);
107107
}

src/components/Page/Tests/index.tsx

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ import * as React from 'react';
22
import {connect} from 'react-redux';
33
import {join} from 'path';
44
import {editorOpen} from '../../../actions';
5-
import FlatButton from 'material-ui/FlatButton';
5+
// import Chip from 'material-ui/Chip';
6+
// import Avatar from 'material-ui/Avatar';
7+
// import CodeIcon from 'material-ui/svg-icons/action/code';
68
import {configSelector, tutorialConfigOptions} from 'core-coderoad';
79

810
const styles = {
9-
button: {
11+
test: {
1012
bottom: '8px',
1113
},
1214
};
@@ -25,20 +27,25 @@ export default class Tests extends React.Component<{
2527
open?: (file: string) => any
2628
}, {}> {
2729
render() {
28-
const {tests, config, style, open} = this.props;
30+
const {tests, style, open} = this.props;
2931

3032
return (
3133
<div style={style}>
3234
{tests.map((file, index) => (
33-
<FlatButton
34-
key={index}
35-
style={styles.button}
36-
onClick={open.bind(this, file)}
37-
label={'Test'}
38-
secondary={true}
39-
/>
35+
<button>{file}</button>
4036
))}
4137
</div>
4238
);
4339
}
4440
}
41+
42+
/*
43+
<Chip
44+
key={index}
45+
style={styles.test}
46+
onClick={open.bind(this, file)}
47+
>
48+
<Avatar icon={<CodeIcon />} />
49+
{file}
50+
</Chip>
51+
*/

0 commit comments

Comments
 (0)