@@ -28,30 +28,21 @@ var ProgressPage = (function (_super) {
2828 function ProgressPage ( ) {
2929 _super . apply ( this , arguments ) ;
3030 }
31- ProgressPage . prototype . canActivate = function ( isActive ) {
32- var _a = this . props , index = _a . index , position = _a . position , progress = _a . progress ;
33- var completed = progress . pages [ index ] ;
34- return isActive || completed ;
35- } ;
3631 ProgressPage . prototype . render = function ( ) {
37- console . log ( this . props ) ;
38- var _a = this . props , page = _a . page , position = _a . position , index = _a . index , progress = _a . progress , selectPage = _a . selectPage ;
39- var isActive = index === position . page ;
40- var canActivate = this . canActivate ( isActive ) ;
41- var completed = progress . pages [ index ] ;
42- return ( React . createElement ( List_1 . ListItem , { key : index , style : Object . assign ( { } , styles , ! canActivate ? { color : colors_1 . grey400 } : { } ) , primaryText : ( index + 1 ) + ". " + page . title , secondaryText : canActivate ? page . description : '' , leftIcon : progressIcon_1 . progressIcon ( completed , isActive ) , onClick : canActivate
43- ? selectPage . bind ( this , {
44- page : index
45- } )
32+ var _a = this . props , page = _a . page , pagePosition = _a . pagePosition , index = _a . index , progress = _a . progress , selectPage = _a . selectPage ;
33+ var isCompleted = progress . pages [ index ] || false ;
34+ var canActivate = index >= pagePosition ;
35+ return ( React . createElement ( List_1 . ListItem , { key : index , style : Object . assign ( { } , styles , ! canActivate ? { color : colors_1 . grey400 } : { } ) , primaryText : ( index + 1 ) + ". " + page . title , secondaryText : page . description , leftIcon : progressIcon_1 . progressIcon ( isCompleted , index === pagePosition ) , onClick : canActivate
36+ ? selectPage . bind ( this , index )
4637 : function ( ) { return ; } } ) ) ;
4738 } ;
4839 ;
4940 ProgressPage = __decorate ( [
5041 react_redux_1 . connect ( null , function ( dispatch ) {
5142 return {
52- selectPage : function ( position ) {
53- dispatch ( actions_1 . pageSet ( position ) ) ;
54- dispatch ( actions_1 . testsLoad ( ) ) ;
43+ selectPage : function ( pagePosition ) {
44+ dispatch ( actions_1 . pageSet ( pagePosition ) ) ;
45+ dispatch ( actions_1 . testsLoad ( pagePosition ) ) ;
5546 dispatch ( actions_1 . routeSet ( 'page' ) ) ;
5647 }
5748 } ;
0 commit comments