Skip to content

prevent commands on reset tutorial #439

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

Merged
merged 2 commits into from
Aug 8, 2020
Merged
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
Next Next commit
prevent commands on reset tutorial
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
ShMcK committed Aug 8, 2020
commit b6501e007fd72f35e3150e448f435e374d9ec6c0
27 changes: 14 additions & 13 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,27 +89,28 @@ export interface MachineStateSchema {
states: {
Setup: {
states: {
Startup: {}
ValidateSetup: {}
Start: {}
SelectTutorial: {}
SetupNewTutorial: {}
StartTutorial: {}
Startup: Record<string, unknown>
ValidateSetup: Record<string, unknown>
Start: Record<string, unknown>
SelectTutorial: Record<string, unknown>
SetupNewTutorial: Record<string, unknown>
StartTutorial: Record<string, unknown>
}
}
Tutorial: {
states: {
Level: {
states: {
Load: {}
Normal: {}
TestRunning: {}
StepNext: {}
LevelComplete: {}
LoadNext: {}
Load: Record<string, unknown>
Normal: Record<string, unknown>
TestRunning: Record<string, unknown>
StepNext: Record<string, unknown>
LevelComplete: Record<string, unknown>
LoadNext: Record<string, unknown>
}
}
Completed: {}
Reset: Record<string, unknown>
Completed: Record<string, unknown>
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions web-app/src/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ const Routes = () => {
<Route paths={{ Tutorial: { Level: { Load: true } } }}>
<LoadingPage text="Loading Level..." processes={context.processes} />
</Route>
<Route paths={{ Tutorial: { Reset: true } }}>
<LoadingPage text="Resetting tutorial..." processes={context.processes} />
</Route>
<Route paths={{ Tutorial: { Level: true, Completed: true } }}>
<TutorialPage send={send} context={context} state={route.replace('Tutorial.', '')} />
</Route>
Expand Down
13 changes: 9 additions & 4 deletions web-app/src/services/state/machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export const createMachine = (options: any) => {
target: 'SetupNewTutorial',
actions: ['setTutorialContext'],
},
// TODO: handle completed tutorial differently
TUTORIAL_ALREADY_COMPLETE: {
target: 'Start',
actions: ['setStart'],
Expand Down Expand Up @@ -168,9 +167,7 @@ export const createMachine = (options: any) => {
RUN_TEST: {
actions: ['runTest'],
},
RUN_RESET: {
actions: ['runReset'],
},
RUN_RESET: '#reset-tutorial',
KEY_PRESS_ENTER: {
actions: ['runTest'],
},
Expand Down Expand Up @@ -234,6 +231,14 @@ export const createMachine = (options: any) => {
},
},
},
Reset: {
id: 'reset-tutorial',
onEntry: ['runReset'],
onExit: ['testClear'],
after: {
3000: '#tutorial',
},
},
Completed: {
id: 'completed-tutorial',
on: {
Expand Down