Skip to content

Fix/continue #255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cleanup
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
ShMcK committed Apr 18, 2020
commit a23f9978f3c83d4c61700722607fbcf818da5d62
9 changes: 4 additions & 5 deletions src/channel/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,14 @@ class Channel implements Channel {
}
// communicate to client the tutorial & stepProgress state
this.send({ type: 'LOAD_STORED_TUTORIAL', payload: { env, tutorial, progress, position } })

return
} catch (e) {
const error = {
type: 'UnknownError',
message: `Location: Editor startup\n\n${e.message}`,
}
this.send({ type: 'EDITOR_STARTUP_FAILED', payload: { error } })
}
return

// clear tutorial local storage
case 'TUTORIAL_CLEAR':
Expand Down Expand Up @@ -203,14 +202,14 @@ class Channel implements Channel {

// report back to the webview that setup is complete
this.send({ type: 'TUTORIAL_CONFIGURED' })
return
} catch (e) {
const error = {
type: 'UnknownError',
message: `Location: EditorTutorialConfig.\n\n ${e.message}`,
}
this.send({ type: 'TUTORIAL_CONFIGURE_FAIL', payload: { error } })
}
return
case 'EDITOR_TUTORIAL_CONTINUE_CONFIG':
try {
const tutorialContinue: TT.Tutorial | null = this.context.tutorial.get()
Expand All @@ -224,14 +223,14 @@ class Channel implements Channel {
})
// update the current stepId on startup
vscode.commands.executeCommand(COMMANDS.SET_CURRENT_STEP, action.payload.stepId)
return
} catch (e) {
const error = {
type: 'UnknownError',
message: `Location: Editor tutorial continue config.\n\n ${e.message}`,
}
this.send({ type: 'CONTINUE_FAILED', payload: { error } })
}
return
case 'EDITOR_VALIDATE_SETUP':
try {
// check workspace is selected
Expand Down Expand Up @@ -272,14 +271,14 @@ class Channel implements Channel {
return
}
this.send({ type: 'SETUP_VALIDATED' })
return
} catch (e) {
const error = {
type: 'UknownError',
message: e.message,
}
this.send({ type: 'VALIDATE_SETUP_FAILED', payload: { error } })
}
return
case 'EDITOR_REQUEST_WORKSPACE':
openWorkspace()
return
Expand Down
2 changes: 1 addition & 1 deletion src/services/logger/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LOG } from '../../environment'

export type Log = string | object
export type Log = string | object | null

const logger = (...messages: Log[]): void => {
if (!LOG) {
Expand Down
2 changes: 0 additions & 2 deletions web-app/src/containers/Tutorial/Level/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ const Level = ({ level, onContinue, onLoadSolution, processes, testStatus }: Pro
currentStep = level.steps.length
}

console.log(`currentStep: ${currentStep}`)

const pageBottomRef = React.useRef(null)

const scrollToBottom = () => {
Expand Down
3 changes: 3 additions & 0 deletions web-app/src/services/state/actions/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as TT from 'typings/tutorial'
import { assign, send, ActionFunctionMap } from 'xstate'
import * as selectors from '../../selectors'
import onError from '../../../services/sentry/onError'
import logger from 'services/logger'

const contextActions: ActionFunctionMap<T.MachineContext, T.MachineEvent> = {
// @ts-ignore
Expand Down Expand Up @@ -100,6 +101,8 @@ const contextActions: ActionFunctionMap<T.MachineContext, T.MachineEvent> = {

progress.levels[levelId] = true

logger('PROGRESS', progress)

return progress
},
}),
Expand Down
5 changes: 4 additions & 1 deletion web-app/src/services/state/machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ export const createMachine = (options: any) => {
onEntry: ['loadLevel', 'checkLevelCompleted'],
on: {
START_LEVEL: 'Normal',
START_COMPLETED_LEVEL: 'LevelComplete',
START_COMPLETED_LEVEL: {
target: 'LevelComplete',
actions: ['updateLevelProgress'],
},
},
},
Normal: {
Expand Down