File tree Expand file tree Collapse file tree 4 files changed +10
-8
lines changed Expand file tree Collapse file tree 4 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -20,10 +20,9 @@ class StateMachine {
2020
2121 // format state as a string and send it to the client
2222 this . syncState = ( state : any ) : void => {
23- console . log ( state )
24- const stateValue : CR . MessageState = stateToString ( state . value )
23+ const stateValue : string = stateToString ( state . value )
2524 console . log ( `STATE: ${ stateValue } ` )
26- editorDispatch ( 'coderoad.send_state' , stateValue )
25+ editorDispatch ( 'coderoad.send_state' , { state : stateValue } )
2726 }
2827
2928 // callback on all state changes
Original file line number Diff line number Diff line change @@ -170,7 +170,10 @@ interface MessageData {
170170 progress : Progress
171171}
172172
173- type MessageState = string
173+ interface MessageState {
174+ state : string
175+ }
174176
175177
176- export type EditorDispatch = ( type : string , payload ?: MessageData | MessageState ) => void
178+ // todo: type each string param and payload
179+ export type EditorDispatch = ( type : string , payload ?: MessageData | MessageState | any ) => void
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ interface ReceivedEvent {
1313}
1414
1515const App = ( ) => {
16- const initialState = { SelectTutorial : ' Initial' }
16+ const initialState = 'SelectTutorial. Initial'
1717
1818 // set state machine state
1919 const [ state , setState ] = React . useState ( initialState )
Original file line number Diff line number Diff line change @@ -2,14 +2,14 @@ import * as React from 'react'
22import * as CR from 'typings'
33
44interface Props {
5- state : object
5+ state : string
66 position : CR . Position
77 progress : CR . Progress
88}
99
1010const Debugger = ( { state, position, progress } : Props ) => (
1111 < div style = { { backgroundColor : '#FFFF99' , color : 'black' , padding : '.5rem' } } >
12- < h4 > state: { JSON . stringify ( state ) } </ h4 >
12+ < h4 > state: { state } </ h4 >
1313 < p style = { { backgroundColor : 'khaki' , padding : '.5rem' } } > position: { JSON . stringify ( position ) } </ p >
1414 < p style = { { backgroundColor : 'moccasin' , padding : '.5rem' } } > progress: { JSON . stringify ( progress ) } </ p >
1515 </ div >
You can’t perform that action at this time.
0 commit comments