@@ -4,22 +4,13 @@ import * as CR from 'typings'
44
55import client from './services/apollo'
66import currentTutorial from './services/current'
7- import Debugger from './components/Debugger'
87import Routes from './Routes'
98
109interface ReceivedEvent {
1110 data : CR . Action
1211}
1312
1413const App = ( ) => {
15- const initialState = 'Start.Initial'
16-
17- // set state machine state
18- const [ state , setState ] = React . useState ( initialState )
19- const [ debuggerInfo , setDebuggerInfo ] = React . useState ( {
20- progress : { levels : { } , stages : { } , steps : { } , complete : false } ,
21- position : { levelId : '' , stageId : '' , stepId : '' } ,
22- } )
2314
2415 // event bus listener
2516 React . useEffect ( ( ) => {
@@ -28,17 +19,13 @@ const App = () => {
2819 const message = event . data
2920 // messages from core
3021
31- if ( message . type === 'SET_STATE' ) {
32- // SET_STATE - set state machine state
33- setState ( message . payload . state )
34-
35- } else if ( message . type === 'SET_DATA' ) {
22+ if ( message . type === 'SET_DATA' ) {
3623 // SET_DATA - set state machine context
3724 console . log ( 'SET_DATA updated' )
3825 const { progress, position } = message . payload
3926 if ( process . env . REACT_APP_DEBUG ) {
4027 console . log ( `Position: ${ position . levelId } /${ position . stageId } /${ position . stepId } ` )
41- setDebuggerInfo ( { progress, position } )
28+ // setDebuggerInfo({ progress, position })
4229 }
4330 console . log ( 'set currentTutorial' )
4431 currentTutorial . set ( { position, progress } )
@@ -53,18 +40,9 @@ const App = () => {
5340 }
5441 } , [ ] )
5542
56- // trigger progress when webview loaded
57- // React.useEffect(() => {
58- // editorDispatch('WEBVIEW_LOADED')
59- // }, [])
60-
61- // TODO: refactor cond to user <Router><Route> and accept first route as if/else if
6243 return (
6344 < ApolloProvider client = { client } >
64- < div >
65- { process . env . REACT_APP_DEBUG && < Debugger state = { state } { ...debuggerInfo } /> }
66- < Routes state = { state } />
67- </ div >
45+ < Routes />
6846 </ ApolloProvider >
6947 )
7048}
0 commit comments