|
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 |
| -}; |
16 | 2 | var React = require('react');
|
17 |
| -var FlatButton_1 = require('material-ui/FlatButton'); |
18 | 3 | var Table_1 = require('material-ui/Table');
|
19 |
| -var react_redux_1 = require('react-redux'); |
20 |
| -var actions_1 = require('../../actions/actions'); |
21 |
| -var file_upload_1 = require('material-ui/svg-icons/file/file-upload'); |
22 |
| -var TutorialList = (function (_super) { |
23 |
| - __extends(TutorialList, _super); |
24 |
| - function TutorialList() { |
25 |
| - _super.apply(this, arguments); |
26 |
| - } |
27 |
| - TutorialList.prototype.trim = function (name) { |
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 |
| - TutorialList.prototype.render = function () { |
37 |
| - var _this = this; |
38 |
| - var _a = this.props, tutorials = _a.tutorials, loadTutorials = _a.loadTutorials, selectTutorial = _a.selectTutorial, toggleAlert = _a.toggleAlert, updateTutorial = _a.updateTutorial; |
39 |
| - return (React.createElement("div", {className: 'cr-tutorials'}, React.createElement(Table_1.Table, null, React.createElement(Table_1.TableHeader, {displaySelectAll: false, adjustForCheckbox: false}, React.createElement(Table_1.TableRow, null, React.createElement(Table_1.TableHeaderColumn, null, "Tutorial"), React.createElement(Table_1.TableHeaderColumn, null, "Version"))), React.createElement(Table_1.TableBody, {displayRowCheckbox: false}, tutorials.map(function (tutorial, index) { |
40 |
| - return (React.createElement(Table_1.TableRow, {key: index}, React.createElement(Table_1.TableRowColumn, null, React.createElement(FlatButton_1.default, {label: _this.trim(tutorial.name), primary: true, onTouchTap: selectTutorial.bind(_this, tutorial)})), !!tutorial.latest |
41 |
| - ? React.createElement(Table_1.TableRowColumn, null, tutorial.version, " ", React.createElement(file_upload_1.default, {onClick: updateTutorial(tutorial.name)})) |
42 |
| - : React.createElement(Table_1.TableRowColumn, null, tutorial.version))); |
43 |
| - }))), React.createElement("br", null), React.createElement(FlatButton_1.default, {style: { margin: '0 90px' }, label: 'Check for Tutorials', secondary: true, onTouchTap: loadTutorials}))); |
44 |
| - }; |
45 |
| - TutorialList = __decorate([ |
46 |
| - react_redux_1.connect(null, function (dispatch) { |
47 |
| - return { |
48 |
| - selectTutorial: function (tutorial) { |
49 |
| - actions_1.loadTutorial(tutorial); |
50 |
| - dispatch(actions_1.setRoute('progress')); |
51 |
| - }, |
52 |
| - toggleAlert: function (item) { |
53 |
| - dispatch(actions_1.toggleAlert(item)); |
54 |
| - }, |
55 |
| - loadTutorials: function () { |
56 |
| - dispatch(actions_1.loadTutorials()); |
57 |
| - }, |
58 |
| - updateTutorial: function (name) { |
59 |
| - dispatch(actions_1.updateTutorial(name)); |
60 |
| - } |
61 |
| - }; |
62 |
| - }), |
63 |
| - __metadata('design:paramtypes', []) |
64 |
| - ], TutorialList); |
65 |
| - return TutorialList; |
66 |
| -}(React.Component)); |
| 4 | +var buttons_1 = require('./buttons'); |
67 | 5 | exports.Tutorials = function (_a) {
|
68 | 6 | var tutorials = _a.tutorials;
|
69 |
| - return (React.createElement(TutorialList, {tutorials: tutorials})); |
| 7 | + return (React.createElement("div", {className: 'cr-tutorials'}, React.createElement(Table_1.Table, null, React.createElement(Table_1.TableHeader, {displaySelectAll: false, adjustForCheckbox: false}, React.createElement(Table_1.TableRow, null, React.createElement(Table_1.TableHeaderColumn, null, "Tutorial"), React.createElement(Table_1.TableHeaderColumn, null, "Version"))), React.createElement(Table_1.TableBody, {displayRowCheckbox: false}, tutorials.map(function (tutorial, index) { |
| 8 | + return (React.createElement(Table_1.TableRow, {key: index}, React.createElement(Table_1.TableRowColumn, null, React.createElement(buttons_1.SelectTutorial, {tutorial: tutorial})), !!tutorial.latest |
| 9 | + ? React.createElement(Table_1.TableRowColumn, null, tutorial.version, " ", React.createElement(buttons_1.UpdateTutorial, {name: tutorial.name})) |
| 10 | + : React.createElement(Table_1.TableRowColumn, null, tutorial.version))); |
| 11 | + }))), React.createElement("br", null), React.createElement(buttons_1.LoadTutorials, null))); |
70 | 12 | };
|
0 commit comments