Last active
August 10, 2020 15:58
-
-
Save montogeek/bd1ef83a6bb2c6712cfe88e0779d02d4 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) | |
const fetchMachine = Machine({ | |
id: 'training', | |
initial: 'overview', | |
states: { | |
dashboard: { | |
id: 'dashboard', | |
type: 'final', | |
}, | |
overview: { | |
id: 'overview', | |
initial: 'idle', | |
states: { | |
idle: { | |
on: { | |
continue: '#exerciseInfo', | |
quit: 'quit', | |
}, | |
}, | |
quit: { | |
initial: 'opened', | |
states: { | |
opened: { | |
on: { | |
QUIT: '#dashboard', | |
RESUME: '#overview.idle', | |
}, | |
}, | |
}, | |
}, | |
}, | |
}, | |
exerciseInfo: { | |
id: 'exerciseInfo', | |
initial: 'idle', | |
states: { | |
idle: { | |
on: { | |
start: '#countdown', | |
showInstructions: 'instructions', | |
showSettings: 'settings', | |
skip: 'skip', | |
quit: 'quit', | |
}, | |
}, | |
instructions: { | |
on: { | |
close: 'idle', | |
}, | |
}, | |
settings: { | |
on: { | |
saveSettings: 'idle', | |
close: 'idle', | |
}, | |
}, | |
skip: { | |
initial: 'opened', | |
states: { | |
opened: { | |
on: { | |
SKIP: '#exerciseInfo', | |
RESUME: '#exerciseInfo', | |
}, | |
}, | |
}, | |
}, | |
quit: { | |
initial: 'opened', | |
states: { | |
opened: { | |
on: { | |
QUIT: '#dashboard', | |
RESUME: '#exerciseInfo', | |
}, | |
}, | |
}, | |
}, | |
}, | |
}, | |
countdown: { | |
id: 'countdown', | |
initial: 'idle', | |
states: { | |
idle: { | |
on: { | |
quit: 'quit', | |
finish: '#exerciseExecution', | |
}, | |
}, | |
quit: { | |
initial: 'opened', | |
states: { | |
opened: { | |
on: { | |
QUIT: '#dashboard', | |
RESUME: '#countdown', | |
}, | |
}, | |
}, | |
}, | |
}, | |
}, | |
exerciseExecution: { | |
id: 'exerciseExecution', | |
initial: 'idle', | |
states: { | |
idle: { | |
on: { | |
pause: 'paused', | |
finishSet: 'countdown', | |
finishExercise: 'success', | |
finishEncouraging: 'success.encouraging', | |
finishAllExercises: 'success.complete', | |
skip: 'skip', | |
quit: 'quit', | |
}, | |
}, | |
paused: { | |
initial: 'idle', | |
states: { | |
idle: { | |
on: { | |
continue: '#exerciseExecution.idle', | |
finishSet: 'countdown', | |
finishExercise: 'success', | |
finishEncouraging: 'success.encouraging', | |
finishAllExercises: 'success.complete', | |
skip: 'skip', | |
quit: 'quit', | |
}, | |
}, | |
countdown: { | |
initial: 'idle', | |
states: { | |
idle: { | |
on: { | |
quit: 'quit', | |
finish: '#exerciseExecution', | |
}, | |
}, | |
quit: { | |
initial: 'opened', | |
states: { | |
opened: { | |
on: { | |
QUIT: '#dashboard', | |
RESUME: '#exerciseExecution.countdown', | |
}, | |
}, | |
}, | |
}, | |
}, | |
}, | |
success: { | |
initial: 'general', | |
states: { | |
general: { | |
initial: 'idle', | |
states: { | |
idle: { | |
on: { | |
quit: 'quit', | |
continue: '#exerciseInfo', | |
}, | |
}, | |
quit: { | |
initial: 'opened', | |
states: { | |
opened: { | |
on: { | |
QUIT: '#dashboard', | |
RESUME: '#exerciseExecution.success.general', | |
}, | |
}, | |
}, | |
}, | |
}, | |
}, | |
encouraging: { | |
initial: 'idle', | |
states: { | |
idle: { | |
on: { | |
quit: 'quit', | |
continue: '#exerciseInfo', | |
}, | |
}, | |
quit: { | |
initial: 'opened', | |
states: { | |
opened: { | |
on: { | |
QUIT: '#dashboard', | |
RESUME: '#exerciseExecution.success.encouraging', | |
}, | |
}, | |
}, | |
}, | |
}, | |
}, | |
complete: { | |
initial: 'idle', | |
states: { | |
idle: { | |
on: { | |
quit: 'quit', | |
continue: '#overview', | |
}, | |
}, | |
quit: { | |
initial: 'opened', | |
states: { | |
opened: { | |
on: { | |
QUIT: '#dashboard', | |
RESUME: '#exerciseExecution.success.complete', | |
}, | |
}, | |
}, | |
}, | |
}, | |
}, | |
}, | |
}, | |
skip: { | |
initial: 'opened', | |
states: { | |
opened: { | |
on: { | |
SKIP: '#exerciseInfo', | |
RESUME: '#exerciseExecution.paused', | |
}, | |
}, | |
}, | |
}, | |
quit: { | |
initial: 'opened', | |
states: { | |
opened: { | |
on: { | |
QUIT: '#dashboard', | |
RESUME: '#exerciseExecution.paused', | |
}, | |
}, | |
}, | |
}, | |
}, | |
}, | |
countdown: { | |
initial: 'idle', | |
states: { | |
idle: { | |
on: { | |
quit: 'quit', | |
finish: '#exerciseExecution', | |
}, | |
}, | |
quit: { | |
initial: 'opened', | |
states: { | |
opened: { | |
on: { | |
QUIT: '#dashboard', | |
RESUME: '#exerciseExecution.countdown', | |
}, | |
}, | |
}, | |
}, | |
}, | |
}, | |
success: { | |
initial: 'general', | |
states: { | |
general: { | |
initial: 'idle', | |
states: { | |
idle: { | |
on: { | |
quit: 'quit', | |
continue: '#exerciseInfo', | |
}, | |
}, | |
quit: { | |
initial: 'opened', | |
states: { | |
opened: { | |
on: { | |
QUIT: '#dashboard', | |
RESUME: '#exerciseExecution.success.general', | |
}, | |
}, | |
}, | |
}, | |
}, | |
}, | |
encouraging: { | |
initial: 'idle', | |
states: { | |
idle: { | |
on: { | |
quit: 'quit', | |
continue: '#exerciseInfo', | |
}, | |
}, | |
quit: { | |
initial: 'opened', | |
states: { | |
opened: { | |
on: { | |
QUIT: '#dashboard', | |
RESUME: '#exerciseExecution.success.encouraging', | |
}, | |
}, | |
}, | |
}, | |
}, | |
}, | |
complete: { | |
initial: 'idle', | |
states: { | |
idle: { | |
on: { | |
quit: 'quit', | |
continue: '#overview', | |
}, | |
}, | |
quit: { | |
initial: 'opened', | |
states: { | |
opened: { | |
on: { | |
QUIT: '#dashboard', | |
RESUME: '#exerciseExecution.success.complete', | |
}, | |
}, | |
}, | |
}, | |
}, | |
}, | |
}, | |
}, | |
skip: { | |
initial: 'opened', | |
states: { | |
opened: { | |
on: { | |
SKIP: '#exerciseInfo', | |
RESUME: '#exerciseExecution', | |
}, | |
}, | |
}, | |
}, | |
quit: { | |
initial: 'opened', | |
states: { | |
opened: { | |
on: { | |
QUIT: '#dashboard', | |
RESUME: '#exerciseExecution', | |
}, | |
}, | |
}, | |
}, | |
}, | |
}, | |
}, | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment