|
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');
|
| 17 | +var react_redux_1 = require('react-redux'); |
3 | 18 | var Card_1 = require('material-ui/Card');
|
4 | 19 | var index_1 = require('../../index');
|
5 | 20 | var HintButton_1 = require('./HintButton');
|
6 | 21 | var help_1 = require('material-ui/svg-icons/action/help');
|
| 22 | +var selectors_1 = require('../../../selectors'); |
7 | 23 | var styles = {
|
8 | 24 | position: 'relative',
|
9 | 25 | margin: '5px auto 10px',
|
10 | 26 | width: '360px',
|
11 | 27 | textAlign: 'center',
|
12 | 28 | };
|
13 |
| -var Hints = function (_a) { |
14 |
| - var task = _a.task, hintPosition = _a.hintPosition; |
15 |
| - var hints = task && task.hints ? task.hints : null; |
16 |
| - if (hintPosition < 0 || !hints || !hints.length) { |
17 |
| - return null; |
| 29 | +var Hints = (function (_super) { |
| 30 | + __extends(Hints, _super); |
| 31 | + function Hints() { |
| 32 | + _super.apply(this, arguments); |
18 | 33 | }
|
19 |
| - var hint = hints[hintPosition]; |
20 |
| - return (React.createElement(Card_1.Card, {style: styles}, React.createElement(Card_1.CardHeader, {title: 'Hints', avatar: React.createElement(help_1.default, null), actAsExpander: true, showExpandableButton: true}), React.createElement(Card_1.CardText, {className: 'cr-task-hint', expandable: true}, React.createElement(index_1.Markdown, null, hint)), hints.length > 1 |
21 |
| - ? React.createElement(Card_1.CardActions, {style: { paddingBottom: '30px !important' }, expandable: true, className: 'cr-task-hints-actions'}, React.createElement(HintButton_1.default, {type: 'prev', label: 'Previous', hintPosition: hintPosition, hintsLength: hints.length}), React.createElement(HintButton_1.default, {type: 'next', label: 'Next', hintPosition: hintPosition, hintsLength: hints.length})) |
22 |
| - : null)); |
23 |
| -}; |
| 34 | + Hints.prototype.render = function () { |
| 35 | + var _a = this.props, hint = _a.hint, hints = _a.hints; |
| 36 | + if (!hint) { |
| 37 | + return null; |
| 38 | + } |
| 39 | + return (React.createElement(Card_1.Card, {style: styles}, React.createElement(Card_1.CardHeader, {title: 'Hints', avatar: React.createElement(help_1.default, null), actAsExpander: true, showExpandableButton: true}), React.createElement(Card_1.CardText, {className: 'cr-task-hint', expandable: true}, React.createElement(index_1.Markdown, null, hint)), hints.length > 1 |
| 40 | + ? React.createElement(Card_1.CardActions, {style: { paddingBottom: '30px !important' }, expandable: true, className: 'cr-task-hints-actions'}, React.createElement(HintButton_1.default, {type: 'prev', label: 'Previous', hintsLength: hints.length}), React.createElement(HintButton_1.default, {type: 'next', label: 'Next', hintsLength: hints.length})) |
| 41 | + : null)); |
| 42 | + }; |
| 43 | + Hints = __decorate([ |
| 44 | + react_redux_1.connect(function (state) { return ({ |
| 45 | + hints: selectors_1.hintsSelector(state), |
| 46 | + hint: selectors_1.hintSelector(state), |
| 47 | + }); }), |
| 48 | + __metadata('design:paramtypes', []) |
| 49 | + ], Hints); |
| 50 | + return Hints; |
| 51 | +}(React.Component)); |
24 | 52 | Object.defineProperty(exports, "__esModule", { value: true });
|
25 | 53 | exports.default = Hints;
|
0 commit comments