@@ -99,8 +99,6 @@ interface Props {
99
99
onRunTest ( ) :void
100
100
onLoadSolution ( ) :void
101
101
onOpenLogs ( channel :string ) :void
102
- displayHintsIndex :number [ ]
103
- setHintsIndex ( index :number , value :number ) :void
104
102
}
105
103
106
104
const Level = ( {
@@ -115,14 +113,31 @@ const Level = ({
115
113
onOpenLogs,
116
114
processes,
117
115
testStatus,
118
- displayHintsIndex,
119
- setHintsIndex,
120
116
} :Props ) => {
121
117
const level = tutorial . levels [ index ]
122
118
123
119
const [ title , setTitle ] = React . useState < string > ( level . title )
124
120
const [ content , setContent ] = React . useState < string > ( level . content )
125
121
122
+ // hold state for hints for the level
123
+ const [ displayHintsIndex , setDisplayHintsIndex ] = React . useState < number [ ] > ( [ ] )
124
+ const setHintsIndex = ( index :number , value :number ) => {
125
+ return setDisplayHintsIndex ( ( displayHintsIndex ) => {
126
+ const next = [ ...displayHintsIndex ]
127
+ next [ index ] = value
128
+ return next
129
+ } )
130
+ }
131
+ React . useEffect ( ( ) => {
132
+ console . log ( position . levelId )
133
+ console . log ( JSON . stringify ( position ) )
134
+ // set the hints to empty on level starts
135
+ setDisplayHintsIndex ( steps . map ( ( s ) => - 1 ) )
136
+ return ( ) => {
137
+ console . log ( 'LEVEL UNMOUNTED' )
138
+ }
139
+ } , [ position . levelId ] )
140
+
126
141
const menu = (
127
142
< ContentMenu
128
143
tutorial = { tutorial }