@@ -18,40 +18,15 @@ var ReactDOM = require('react-dom');
1818var react_redux_1 = require ( 'react-redux' ) ;
1919var Action = require ( '../../actions/actions' ) ;
2020var iconPath = 'material-ui/lib/svg-icons/' ;
21- var _components_1 = require ( '../_components' ) ;
2221var material_ui_1 = require ( 'material-ui' ) ;
23- var colors_1 = require ( 'material-ui/lib/styles/colors' ) ;
24- var classnames = require ( 'classnames' ) ;
2522var Complete = require ( iconPath + 'toggle/check-box' ) ;
2623var Incomplete = require ( iconPath + 'toggle/check-box-outline-blank' ) ;
2724var RunningTest = require ( iconPath + 'toggle/indeterminate-check-box' ) ;
28- function hintsShown ( task , hintPos ) {
29- if ( hintPos > - 1 && task . hints && task . hints . length > 0 ) {
30- return task . hints . slice ( 0 , hintPos + 1 ) ;
31- }
32- return null ;
33- }
34- function visibleTasks ( tasks , taskPosition ) {
35- return tasks . slice ( 0 , taskPosition + 1 ) ;
36- }
37- var TaskCheckbox = function ( _a ) {
38- var index = _a . index , taskPosition = _a . taskPosition , runTests = _a . runTests ;
39- var icon = null ;
40- if ( index < taskPosition ) {
41- icon = React . createElement ( Complete , { color :colors_1 . green500 } ) ;
42- }
43- else if ( index === taskPosition && runTests ) {
44- icon = React . createElement ( RunningTest , { color :colors_1 . orange500 } ) ;
45- }
46- else {
47- icon = React . createElement ( Incomplete , null ) ;
48- }
49- return ( React . createElement ( "span" , { className :'cr-task-checkbox' } , icon ) ) ;
50- } ;
5125var material_ui_2 = require ( 'material-ui' ) ;
5226var content_1 = require ( './content' ) ;
5327var hint_1 = require ( './hint' ) ;
5428var page_complete_1 = require ( './page-complete' ) ;
29+ var task_1 = require ( './task' ) ;
5530var Info = require ( iconPath + 'action/info' ) ;
5631var InfoOutline = require ( iconPath + 'action/info-outline' ) ;
5732var style = {
@@ -90,51 +65,17 @@ var default_1 = (function (_super) {
9065}
9166} ;
9267default_1 . prototype . render = function ( ) {
93- var _this = this ;
94- var _a = this . props , page = _a . page , taskPosition = _a . taskPosition , hintPosition = _a . hintPosition ;
95- var tasks = visibleTasks ( this . props . tasks , taskPosition ) ;
68+ var _a = this . props , page = _a . page , taskPosition = _a . taskPosition , hintPosition = _a . hintPosition , tasks = _a . tasks , runTests = _a . runTests ;
9669var currentTask = taskPosition <= tasks . length ?tasks [ taskPosition ] :null ;
9770var allComplete = taskPosition >= tasks . length ;
98- return ( React . createElement ( material_ui_2 . Paper , { style :style , zDepth :1 , className :'cr-page' } ,
99- React . createElement ( content_1 . default , { page :page } ) ,
100- React . createElement ( material_ui_1 . Divider , null ) ,
101- React . createElement ( material_ui_1 . List , { subheader :'Tasks' , className :'cr-tasks' , ref :'tasks' } ,
102- tasks . map ( function ( task , index ) {
103- var isCurrentTask = index === taskPosition ;
104- var isDisabledTask = index > taskPosition ;
105- var isCompletedTask = index < taskPosition ;
106- var isFinalTask = index >= tasks . length - 1 ;
107- return ( React . createElement ( "div" , null ,
108- React . createElement ( material_ui_1 . ListItem , { ref :'task' + index , className :classnames ( {
109- 'cr-task' :true ,
110- 'isCompletedTask' :isCompletedTask ,
111- 'isCurrentTask' :isCurrentTask ,
112- 'isDisabledTask' :isDisabledTask
113- } ) } ,
114- React . createElement ( TaskCheckbox , { index :index , taskPosition :taskPosition , runTests :_this . props . runTests } ) ,
115- React . createElement ( "span" , { className :'cr-task-index' } ,
116- index + 1 ,
117- "." ) ,
118- React . createElement ( "div" , { className :'cr-task-description' } ,
119- React . createElement ( _components_1 . MarkdownText , { text :task . description } )
120- ) )
121- ) ) ;
122- } ) ,
123- React . createElement ( hint_1 . TaskHints , { task :currentTask , hintPosition :hintPosition } ) ,
124- React . createElement ( page_complete_1 . PageCompleteMessage , { page :page } ) ,
125- React . createElement ( "div" , { ref :'listEnd' } ) ) ,
126- React . createElement ( "section" , { className :'cr-page-toolbar' } ,
127- React . createElement ( material_ui_2 . LinearProgress , { mode :'determinate' , value :taskProgress ( taskPosition , tasks . length ) , style :{ height :'6px' } } ) ,
128- React . createElement ( material_ui_2 . Toolbar , null ,
129- currentTask && currentTask . hints && currentTask . hints . length ?
130- React . createElement ( material_ui_2 . ToolbarGroup , { float :'left' } , hintPosition <= currentTask . hints . length - 2 ?
131- React . createElement ( material_ui_2 . FlatButton , { className :'cr-task-showHint' , icon :React . createElement ( InfoOutline , null ) , onClick :this . displayHint . bind ( this , currentTask ) } )
132- :React . createElement ( material_ui_2 . FlatButton , { className :'cr-task-showHint-disabled' , icon :React . createElement ( Info , null ) , disabled :true } ) )
133- :null ,
134- React . createElement ( material_ui_2 . ToolbarGroup , { float :'right' } , allComplete ?
135- React . createElement ( material_ui_2 . RaisedButton , { label :'Continue' , primary :true , onClick :this . props . callNextPage } )
136- :
137- React . createElement ( material_ui_2 . RaisedButton , { label :'Run' , secondary :true , onClick :this . props . callRunTests } ) ) ) ) ) ) ;
71+ return ( React . createElement ( material_ui_2 . Paper , { style :style , zDepth :1 , className :'cr-page' } , React . createElement ( content_1 . default , { page :page } ) , React . createElement ( material_ui_1 . Divider , null ) , React . createElement ( material_ui_1 . List , { subheader :'Tasks' , className :'cr-tasks' , ref :'tasks' } , React . createElement ( task_1 . Tasks , { tasks :tasks , taskPosition :taskPosition , runTests :runTests } ) , React . createElement ( hint_1 . TaskHints , { task :currentTask , hintPosition :hintPosition } ) , React . createElement ( page_complete_1 . PageCompleteMessage , { page :page } ) , React . createElement ( "div" , { ref :'listEnd' } ) ) , React . createElement ( "section" , { className :'cr-page-toolbar' } , React . createElement ( material_ui_2 . LinearProgress , { mode :'determinate' , value :taskProgress ( taskPosition , tasks . length ) , style :{ height :'6px' } } ) , React . createElement ( material_ui_2 . Toolbar , null , currentTask && currentTask . hints && currentTask . hints . length ?
72+ React . createElement ( material_ui_2 . ToolbarGroup , { float :'left' } , hintPosition <= currentTask . hints . length - 2 ?
73+ React . createElement ( material_ui_2 . FlatButton , { className :'cr-task-showHint' , icon :React . createElement ( InfoOutline , null ) , onClick :this . displayHint . bind ( this , currentTask ) } )
74+ :React . createElement ( material_ui_2 . FlatButton , { className :'cr-task-showHint-disabled' , icon :React . createElement ( Info , null ) , disabled :true } ) )
75+ :null , React . createElement ( material_ui_2 . ToolbarGroup , { float :'right' } , allComplete ?
76+ React . createElement ( material_ui_2 . RaisedButton , { label :'Continue' , primary :true , onClick :this . props . callNextPage } )
77+ :
78+ React . createElement ( material_ui_2 . RaisedButton , { label :'Run' , secondary :true , onClick :this . props . callRunTests } ) ) ) ) ) ) ;
13879} ;
13980default_1 = __decorate ( [
14081react_redux_1 . connect ( null , function ( dispatch , state ) {