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 index_1 = require ( '../../index' ) ;
4
19
var taskCheckbox_1 = require ( './taskCheckbox' ) ;
5
20
var List_1 = require ( 'material-ui/List' ) ;
@@ -23,14 +38,25 @@ var styles = {
23
38
lineHeight : '1.6' ,
24
39
} ,
25
40
} ;
26
- function getStatus ( index , taskPosition , testRun ) {
27
- return index < taskPosition ? colors_1 . lightGreen200 : 'inherit' ;
28
- }
29
- var Task = function ( _a ) {
30
- var task = _a . task , taskPosition = _a . taskPosition , index = _a . index , testRun = _a . testRun ;
31
- var backgroundColor = getStatus ( index , taskPosition , testRun ) ;
32
- var isCurrentTask = taskPosition === index ;
33
- return ( React . createElement ( List_1 . ListItem , { key : index , style : Object . assign ( { } , styles . task , { backgroundColor : backgroundColor } ) } , taskCheckbox_1 . default ( isCurrentTask , testRun ) , React . createElement ( "span" , { style : styles . index } , index + 1 , "." ) , React . createElement ( "div" , { style : styles . description } , React . createElement ( index_1 . Markdown , null , task . description ) ) ) ) ;
34
- } ;
41
+ var Task = ( function ( _super ) {
42
+ __extends ( Task , _super ) ;
43
+ function Task ( ) {
44
+ _super . apply ( this , arguments ) ;
45
+ }
46
+ Task . prototype . render = function ( ) {
47
+ var _a = this . props , testRun = _a . testRun , task = _a . task , index = _a . index , isCurrentTask = _a . isCurrentTask , isCompletedTask = _a . isCompletedTask ;
48
+ var backgroundColor = isCompletedTask ? colors_1 . lightGreen200 : 'inherit' ;
49
+ return ( React . createElement ( List_1 . ListItem , { key : index , style : Object . assign ( { } , styles . task , { backgroundColor : backgroundColor } ) } , taskCheckbox_1 . default ( isCurrentTask , testRun ) , React . createElement ( "span" , { style : styles . index } , index + 1 , "." ) , React . createElement ( "div" , { style : styles . description } , React . createElement ( index_1 . Markdown , null , task . description ) ) ) ) ;
50
+ } ;
51
+ Task = __decorate ( [
52
+ react_redux_1 . connect ( function ( state , props ) { return ( {
53
+ testRun : state . testRun ,
54
+ isCurrentTask : state . taskPosition === props . index ,
55
+ isCompletedTask : state . taskPosition > props . index ,
56
+ } ) ; } ) ,
57
+ __metadata ( 'design:paramtypes' , [ ] )
58
+ ] , Task ) ;
59
+ return Task ;
60
+ } ( React . Component ) ) ;
35
61
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
36
62
exports . default = Task ;
0 commit comments