|
1 | 1 | "use strict"; |
| 2 | +var __extends = (this && this.__extends) || function (d, b) { |
| 3 | + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; |
| 4 | + function __() { this.constructor = d; } |
| 5 | + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); |
| 6 | +}; |
| 7 | +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { |
| 8 | + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; |
| 9 | + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); |
| 10 | + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; |
| 11 | + return c > 3 && r && Object.defineProperty(target, key, r), r; |
| 12 | +}; |
| 13 | +var __metadata = (this && this.__metadata) || function (k, v) { |
| 14 | + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); |
| 15 | +}; |
2 | 16 | var React = require('react'); |
3 | | -var TutorialInfo = function (_a) { |
4 | | - var tutorialInfo = _a.tutorialInfo; |
5 | | - return (React.createElement("div", null)); |
| 17 | +var react_redux_1 = require('react-redux'); |
| 18 | +var TextField_1 = require('material-ui/TextField'); |
| 19 | +var Card_1 = require('material-ui/Card'); |
| 20 | +var RaisedButton_1 = require('material-ui/RaisedButton'); |
| 21 | +var actions_1 = require('../../actions'); |
| 22 | +var styles = { |
| 23 | + margin: '10px', |
| 24 | + padding: '30px 20px', |
| 25 | + textAlign: 'center', |
| 26 | +}; |
| 27 | +var buttonStyles = { |
| 28 | + margin: '30px 10px 20px 10px', |
6 | 29 | }; |
| 30 | +var TutorialInfo = (function (_super) { |
| 31 | + __extends(TutorialInfo, _super); |
| 32 | + function TutorialInfo(props) { |
| 33 | + _super.call(this, props); |
| 34 | + this.state = this.props.tutorialInfo; |
| 35 | + } |
| 36 | + TutorialInfo.prototype.handleText = function (prop, event) { |
| 37 | + this.handleChange(prop, event.target.value); |
| 38 | + }; |
| 39 | + TutorialInfo.prototype.handleSelect = function (prop, event, index, value) { |
| 40 | + this.handleChange(prop, value); |
| 41 | + }; |
| 42 | + TutorialInfo.prototype.handleChange = function (prop, val) { |
| 43 | + var obj = {}; |
| 44 | + obj[prop] = val; |
| 45 | + this.setState(Object.assign({}, this.state, obj)); |
| 46 | + }; |
| 47 | + TutorialInfo.prototype.save = function () { |
| 48 | + this.props.save(this.state); |
| 49 | + }; |
| 50 | + TutorialInfo.prototype.render = function () { |
| 51 | + return (React.createElement(Card_1.Card, {style: styles}, React.createElement(Card_1.CardHeader, {title: 'Tutorial Info'}), React.createElement(TextField_1.default, {floatingLabelText: 'Title', defaultValue: this.state.name, onChange: this.handleText.bind(this, 'name')}), React.createElement("br", null), React.createElement(TextField_1.default, {floatingLabelText: 'Description', defaultValue: this.state.description, onChange: this.handleText.bind(this, 'description')}), React.createElement("br", null), React.createElement(TextField_1.default, {floatingLabelText: 'Version', defaultValue: this.state.version.join('.'), disabled: true, onChange: this.handleText.bind(this, 'version')}), React.createElement("br", null), React.createElement(TextField_1.default, {floatingLabelText: 'Keywords', defaultValue: this.state.keywords.join(','), multiLine: true, onChange: this.handleText.bind(this, 'keywords')}), React.createElement("br", null), React.createElement(RaisedButton_1.default, {style: buttonStyles, label: 'Save', primary: true, onTouchTap: this.save.bind(this)}), React.createElement(RaisedButton_1.default, {style: buttonStyles, label: 'Continue', secondary: true, onTouchTap: this.props.routeToTutorial.bind(this)}))); |
| 52 | + }; |
| 53 | + TutorialInfo = __decorate([ |
| 54 | + react_redux_1.connect(null, function (dispatch) { |
| 55 | + return { |
| 56 | + save: function (config) { return dispatch(tutorialConfigSave(config)); }, |
| 57 | + routeToTutorial: function () { return dispatch(actions_1.routeSet('page')); } |
| 58 | + }; |
| 59 | + }), |
| 60 | + __metadata('design:paramtypes', [Object]) |
| 61 | + ], TutorialInfo); |
| 62 | + return TutorialInfo; |
| 63 | +}(React.Component)); |
7 | 64 | Object.defineProperty(exports, "__esModule", { value: true }); |
8 | 65 | exports.default = TutorialInfo; |
0 commit comments