@@ -3,7 +3,7 @@ import * as T from 'typings'
33import * as TT from 'typings/tutorial'
44import { css , jsx } from '@emotion/core'
55import Content from './Content'
6- import Step from './Step '
6+ import Steps from './Steps '
77
88const styles = {
99page :{
@@ -27,10 +27,7 @@ const styles = {
2727height :0 ,
2828borderBottom :'1px solid rgba(0, 0, 0, 0.1)' ,
2929} ,
30- tasks :{ } ,
31- steps :{
32- padding :'1rem 1rem' ,
33- } ,
30+
3431title :{
3532fontSize :'1.2rem' ,
3633fontWeight :'bold' as 'bold' ,
@@ -46,13 +43,9 @@ interface Props {
4643position :T . Position
4744processes :T . ProcessEvent [ ]
4845testStatus :T . TestStatus | null
49- onContinue ( ) :void
50- onRunTest ( ) :void
51- onLoadSolution ( ) :void
52- onOpenLogs ( channel :string ) :void
5346}
5447
55- const Level = ( { level, progress, position, onLoadSolution , currentStep, testStatus} :Props ) => {
48+ const Level = ( { level, progress, position, currentStep, testStatus} :Props ) => {
5649// hold state for hints for the level
5750const [ displayHintsIndex , setDisplayHintsIndex ] = React . useState < number [ ] > ( [ ] )
5851const setHintsIndex = ( index :number , value :number ) => {
@@ -94,36 +87,12 @@ const Level = ({ level, progress, position, onLoadSolution, currentStep, testSta
9487
9588{ level . content . length && steps . length ?< div css = { styles . separator } /> :null }
9689
97- { steps . length ?(
98- < div css = { styles . tasks } >
99- < div css = { styles . steps } >
100- { steps . map ( ( step :TT . Step | null , stepIndex :number ) => {
101- if ( ! step ) {
102- return null
103- }
104- let subtasks = null
105- if ( step ?. subtasks ) {
106- subtasks = step . subtasks . map ( ( subtask :string , subtaskIndex :number ) => ( {
107- name :subtask ,
108- pass :! ! ( testStatus ?. summary ?testStatus . summary [ subtaskIndex ] :false ) ,
109- } ) )
110- }
111- return (
112- < Step
113- key = { step . id }
114- status = { step . status || 'INCOMPLETE' }
115- content = { step . content }
116- onLoadSolution = { onLoadSolution }
117- subtasks = { subtasks }
118- hints = { step . hints }
119- hintIndex = { displayHintsIndex [ stepIndex ] }
120- setHintIndex = { ( value ) => setHintsIndex ( stepIndex , value ) }
121- />
122- )
123- } ) }
124- </ div >
125- </ div >
126- ) :null }
90+ < Steps
91+ steps = { steps }
92+ testStatus = { testStatus }
93+ setHintsIndex = { setHintsIndex }
94+ displayHintsIndex = { displayHintsIndex }
95+ />
12796
12897< div ref = { pageBottomRef } />
12998</ div >