Skip to content

Instantly share code, notes, and snippets.

@zanthrash
Last active November 21, 2020 16:07
Show Gist options
  • Save zanthrash/3756421aaf23edb12fae9af216f62353 to your computer and use it in GitHub Desktop.
Save zanthrash/3756421aaf23edb12fae9af216f62353 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
Machine({
id: 'covid',
initial: 'disclaimer',
states: {
disclaimer: {
on: {
AGREE: "scenerio",
DISAGREE: "exit"
}
},
scenerio: {
on: {
POSITIVE_TEST: 'positive',
EXPOSED: 'exposed',
PREVENTION: 'prevention'
}
},
positive: {
id: "positive",
initial: "testedDate",
states: {
testedDate: {
on: {
NEXT: "symptomsAtTest",
}
},
symptomsAtTest: {
on: {
YES: "symptomsStartDate",
NO: "displayEndDates",
BACK: "testedDate",
}
},
symptomsStartDate: {
on: {
NEXT: "displayEndDates",
BACK: "symptomsAtTest",
}
},
displayEndDates: {
on: {
NEXT: "actionPlan",
BACK: "symptomsStartDate"
}
},
actionPlan:{},
},
on: {
RESTART: "#covid.scenerio"
}
},
exposed: {
id: "exposed",
initial: "overview",
states: {
overview: {
on: {
NEXT: "exposedDate",
}
},
exposedDate: {
on: {
BACK: "overview",
NEXT: "closeContact",
}
},
closeContact: {
on: {
NO_FURTHER_CONTACT: "displayEndDate",
NO_LIVE_WITH_ISOLATE: "displayEndDate",
YES_LIVE_WITH_POSITIVE: "displayEndDate"
}
},
displayEndDate: {
on: {
NEXT: "actionPlan",
BACK: "closeContact"
}
},
actionPlan: {}
},
on: {
RESTART: "#covid.scenerio",
}
},
prevention: {
id: "prevention",
initial: "overview",
states: {
overview: {
on: {
RESTART: "#covid.scenerio"
}
}
}
},
exit: {
type: "final"
},
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment