|
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 react_redux_1 = require('react-redux'); |
18 | | -var Action = require('../../actions/actions'); |
19 | 3 | var material_ui_1 = require('material-ui'); |
20 | | -var Projects = (function (_super) { |
21 | | - __extends(Projects, _super); |
22 | | - function Projects() { |
23 | | - _super.apply(this, arguments); |
24 | | - } |
25 | | - Projects.prototype.load = function () { |
26 | | - this.props.loadTutorials(); |
27 | | - }; |
28 | | - Projects.prototype.trim = function (name) { |
29 | | - if (name.match(/^coderoad-tutorial-/)) { |
30 | | - return name.slice(18); |
31 | | - } |
32 | | - if (name.match(/^coderoad-/)) { |
33 | | - return name.slice(9); |
34 | | - } |
35 | | - return name; |
36 | | - }; |
37 | | - Projects.prototype.render = function () { |
38 | | - 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, {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")))); |
43 | | - }; |
44 | | - Projects = __decorate([ |
45 | | - react_redux_1.connect(null, function (dispatch) { |
46 | | - return { |
47 | | - selectProject: function (name) { |
48 | | - Action.loadTutorial(name); |
49 | | - dispatch(Action.setRoute('progress')); |
50 | | - }, |
51 | | - toggleAlert: function (item) { |
52 | | - dispatch(Action.toggleAlert(item)); |
53 | | - }, |
54 | | - loadTutorials: function () { |
55 | | - dispatch(Action.loadTutorials()); |
56 | | - } |
57 | | - }; |
58 | | - }), |
59 | | - __metadata('design:paramtypes', []) |
60 | | - ], Projects); |
61 | | - return Projects; |
62 | | -}(React.Component)); |
63 | | -Object.defineProperty(exports, "__esModule", { value: true }); |
64 | | -exports.default = Projects; |
65 | | -; |
| 4 | +var setup_1 = require('./setup'); |
| 5 | +var tutorials_1 = require('./tutorials'); |
| 6 | +exports.Project = function (_a) { |
| 7 | + var tutorials = _a.tutorials; |
| 8 | + 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"), window.coderoad.dir && window.coderoad.setup.hasPackageJson && tutorials.length > 0 ? |
| 9 | + React.createElement(tutorials_1.default, {tutorials: tutorials}) : React.createElement(setup_1.SetupGuide, null), React.createElement("p", {className: 'notes'}, "Beta")))); |
| 10 | +}; |
0 commit comments