@@ -7,7 +7,10 @@ import Tasks from './Tasks';
7
7
import Hints from './Hints' ;
8
8
import PageToolbar from './PageToolbar' ;
9
9
import ProgressBar from './ProgressBar' ;
10
- import { pageSelector , tasksSelector } from '../../selectors' ;
10
+ import {
11
+ pageSelector , tasksSelector , pageCompletedSelector , taskSelector ,
12
+ taskProgressSelector
13
+ } from '../../selectors' ;
11
14
12
15
const styles = {
13
16
width : '100%' ,
@@ -22,16 +25,18 @@ const styles = {
22
25
taskPosition : state . taskPosition ,
23
26
hintPosition : state . hintPosition ,
24
27
pagePosition : state . pagePosition ,
28
+ completed : pageCompletedSelector ( state ) ,
29
+ task : taskSelector ( state ) ,
30
+ taskProgress : taskProgressSelector ( state ) ,
25
31
} ) )
26
32
export default class Page extends React . Component < {
27
33
page ?: CR . Page , tasks ?: CR . Task [ ] , taskPosition ?: number ,
28
- hintPosition ?: number , testRun ?: boolean ,
29
- progress ?: CR . Progress , pagePosition ?: number
34
+ hintPosition ?: number , testRun ?: boolean , task ?: CR . Task
35
+ progress ?: CR . Progress , pagePosition ?: number , completed ?: boolean ,
36
+ taskProgress ?: number
30
37
} , { } > {
31
38
render ( ) {
32
- const { page, tasks, taskPosition, hintPosition, testRun, progress, pagePosition} = this . props ;
33
- const task = taskPosition <= tasks . length ? tasks [ taskPosition ] : null ;
34
- const completed = progress . pages [ pagePosition ] ;
39
+ const { page, tasks, taskPosition, hintPosition, testRun, progress, pagePosition, completed, task, visibleTasks, taskProgress} = this . props ;
35
40
return (
36
41
< section style = { styles } className = 'cr-page' >
37
42
< ContentCard
@@ -40,7 +45,7 @@ export default class Page extends React.Component<{
40
45
/>
41
46
42
47
< Tasks
43
- tasks = { tasks }
48
+ tasks = { tasks . slice ( 0 , taskPosition + 1 ) }
44
49
taskPosition = { taskPosition }
45
50
testRun = { testRun }
46
51
completed = { completed }
@@ -56,8 +61,7 @@ export default class Page extends React.Component<{
56
61
hintPosition = { hintPosition }
57
62
/>
58
63
< ProgressBar
59
- taskLength = { tasks . length }
60
- taskPosition = { taskPosition }
64
+ taskProgress = { taskProgress }
61
65
completed = { completed }
62
66
/>
63
67
</ PageToolbar >
0 commit comments