Last active
August 10, 2021 21:03
-
-
Save sea-witch/62154b4f9746629a0c9d340f99609d3e to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains 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: 'reportingMachine', | |
initial: 'selectReportType', | |
context: { | |
foo: 'boo', | |
}, | |
states: { | |
selectReportType: { | |
on: { | |
SELECT_SOCIAL_REPORT: { | |
target: 'socialReport', | |
}, | |
SELECT_GAME_REPORT: { | |
target: 'gameReport', | |
}, | |
}, | |
}, | |
socialReport: { | |
initial: 'selectingSocialReason', | |
states: { | |
selectingSocialReason: { | |
on: { | |
SELECT_SOCIAL_REASON: { | |
target: '#reportingMachine.blockUser', | |
// Set context? | |
}, | |
BACK: { | |
target: '#reportingMachine.selectReportType', | |
}, | |
}, | |
}, | |
}, | |
onDone: { | |
target: 'complete', | |
}, | |
}, | |
gameReport: { | |
initial: 'selectingGameReason', | |
states: { | |
selectingGameReason: { | |
on: { | |
SELECT_GAME_REASON: { | |
target: 'addingComment', | |
}, | |
BACK: { | |
target: '#reportingMachine.selectReportType', | |
}, | |
}, | |
}, | |
addingComment: { | |
on: { | |
SUBMIT_COMMENT: { | |
target: '#reportingMachine.blockUser', | |
}, | |
BACK: { | |
target: 'selectingGameReason', | |
}, | |
}, | |
}, | |
}, | |
onDone: { | |
target: 'complete', | |
}, | |
}, | |
blockUser: { | |
on: { | |
CONFIRM_BLOCK_USER: { | |
target: 'complete', | |
}, | |
DECLINE_BLOCK_USER: { | |
target: 'complete', | |
}, | |
}, | |
}, | |
complete: {type: 'final'}, | |
}, | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment