@@ -6,50 +6,50 @@ import * as selectors from '../../../services/selectors'
66import Level from './Level'
77
88interface PageProps {
9- context : T . MachineContext
10- send ( action : T . Action ) : void
9+ context : T . MachineContext
10+ send ( action : T . Action ) : void
1111}
1212
1313const LevelSummaryPageContainer = ( props : PageProps ) => {
14- const { position, progress } = props . context
15-
16- const version = selectors . currentVersion ( props . context )
17- const levelData : G . Level = selectors . currentLevel ( props . context )
18-
19- const onContinue = ( ) : void => {
20- props . send ( {
21- type : 'LEVEL_NEXT' ,
22- payload : {
23- LevelId : position . levelId ,
24- } ,
25- } )
26- }
27-
28- const onLoadSolution = ( ) : void => {
29- props . send ( { type : 'STEP_SOLUTION_LOAD' } )
30- }
31-
32- const level : G . Level & {
33- status : T . ProgressStatus
34- index : number
35- steps : Array < G . Step & { status : T . ProgressStatus } >
36- } = {
37- ...levelData ,
38- index : version . data . levels . findIndex ( ( l : G . Level ) => l . id === position . levelId ) ,
39- status : progress . levels [ position . levelId ] ? 'COMPLETE' : 'ACTIVE' ,
40- steps : levelData . steps . map ( ( step : G . Step ) => {
41- // label step status for step component
42- let status : T . ProgressStatus = 'INCOMPLETE'
43- if ( progress . steps [ step . id ] ) {
44- status = 'COMPLETE'
45- } else if ( step . id === position . stepId ) {
46- status = 'ACTIVE'
47- }
48- return { ...step , status }
49- } ) ,
50- }
51-
52- return < Level level = { level } onContinue = { onContinue } onLoadSolution = { onLoadSolution } />
14+ const { position, progress, processes } = props . context
15+
16+ const version = selectors . currentVersion ( props . context )
17+ const levelData : G . Level = selectors . currentLevel ( props . context )
18+
19+ const onContinue = ( ) : void => {
20+ props . send ( {
21+ type : 'LEVEL_NEXT' ,
22+ payload : {
23+ LevelId : position . levelId ,
24+ } ,
25+ } )
26+ }
27+
28+ const onLoadSolution = ( ) : void => {
29+ props . send ( { type : 'STEP_SOLUTION_LOAD' } )
30+ }
31+
32+ const level : G . Level & {
33+ status : T . ProgressStatus
34+ index : number
35+ steps : Array < G . Step & { status : T . ProgressStatus } >
36+ } = {
37+ ...levelData ,
38+ index : version . data . levels . findIndex ( ( l : G . Level ) => l . id === position . levelId ) ,
39+ status : progress . levels [ position . levelId ] ? 'COMPLETE' : 'ACTIVE' ,
40+ steps : levelData . steps . map ( ( step : G . Step ) => {
41+ // label step status for step component
42+ let status : T . ProgressStatus = 'INCOMPLETE'
43+ if ( progress . steps [ step . id ] ) {
44+ status = 'COMPLETE'
45+ } else if ( step . id === position . stepId ) {
46+ status = 'ACTIVE'
47+ }
48+ return { ...step , status }
49+ } ) ,
50+ }
51+
52+ return < Level level = { level } onContinue = { onContinue } onLoadSolution = { onLoadSolution } processes = { processes } />
5353}
5454
5555export default LevelSummaryPageContainer
0 commit comments