|
1 | 1 | "use strict";
|
| 2 | +var__extends=(this&&this.__extends)||function(d,b){ |
| 3 | +for(varpinb)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 | +varc=arguments.length,r=c<3 ?target :desc===null ?desc=Object.getOwnPropertyDescriptor(target,key) :desc,d; |
| 9 | +if(typeofReflect==="object"&&typeofReflect.decorate==="function")r=Reflect.decorate(decorators,target,key,desc); |
| 10 | +elsefor(vari=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 | +returnc>3&&r&&Object.defineProperty(target,key,r),r; |
| 12 | +}; |
| 13 | +var__metadata=(this&&this.__metadata)||function(k,v){ |
| 14 | +if(typeofReflect==="object"&&typeofReflect.metadata==="function")returnReflect.metadata(k,v); |
| 15 | +}; |
2 | 16 | varReact=require('react');
|
| 17 | +varreact_redux_1=require('react-redux'); |
3 | 18 | varCard_1=require('material-ui/Card');
|
4 | 19 | varindex_1=require('../../index');
|
5 | 20 | varHintButton_1=require('./HintButton');
|
6 | 21 | varhelp_1=require('material-ui/svg-icons/action/help');
|
| 22 | +varselectors_1=require('../../../selectors'); |
7 | 23 | varstyles={
|
8 | 24 | position:'relative',
|
9 | 25 | margin:'5px auto 10px',
|
10 | 26 | width:'360px',
|
11 | 27 | textAlign:'center',
|
12 | 28 | };
|
13 |
| -varHints=function(_a){ |
14 |
| -vartask=_a.task,hintPosition=_a.hintPosition; |
15 |
| -varhints=task&&task.hints ?task.hints :null; |
16 |
| -if(hintPosition<0||!hints||!hints.length){ |
17 |
| -returnnull; |
| 29 | +varHints=(function(_super){ |
| 30 | +__extends(Hints,_super); |
| 31 | +functionHints(){ |
| 32 | +_super.apply(this,arguments); |
18 | 33 | }
|
19 |
| -varhint=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 | +returnnull; |
| 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 | +returnHints; |
| 51 | +}(React.Component)); |
24 | 52 | Object.defineProperty(exports,"__esModule",{value:true});
|
25 | 53 | exports.default=Hints;
|