Skip to content

Instantly share code, notes, and snippets.

@xeBuz
Created May 30, 2023 13:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xeBuz/83f83d3af8b9d2504d93d4c221d80d8a to your computer and use it in GitHub Desktop.
Save xeBuz/83f83d3af8b9d2504d93d4c221d80d8a to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Define the state machine
const stateMachine = Machine({
id: 'projectIdeasOnBenevityStateMachine',
initial: 'new',
states: {
new: {
on: {
CENSORED: 'censored',
DRAFT: 'draft',
},
},
censored: {
on: {
AWAITING_APPROVAL: 'awaiting_approval',
AWAITING_RESUBMISSION: 'awaiting_resubmission',
CENSORED: 'censored',
DRAFT: 'draft',
GATHERING_SUPPORT: 'gathering_support',
GATHERING_SUPPORT_100: 'gathering_support_100',
GATHERING_SUPPORT_1K: 'gathering_support_1k',
GATHERING_SUPPORT_5K: 'gathering_support_5k',
PROJECT_NOT_APPROVED: 'project_not_approved',
},
},
draft: {
on: {
AWAITING_APPROVAL: 'awaiting_approval',
AWAITING_RESUBMISSION: 'awaiting_resubmission',
CENSORED: 'censored',
DRAFT: 'draft',
GATHERING_SUPPORT: 'gathering_support',
},
},
awaiting_approval: {
on: {
AWAITING_APPROVAL: 'awaiting_approval',
AWAITING_RESUBMISSION: 'awaiting_resubmission',
CENSORED: 'censored',
DRAFT: 'draft',
GATHERING_SUPPORT: 'gathering_support',
REJECTED: 'rejected',
},
},
awaiting_resubmission: {
on: {
AWAITING_APPROVAL: 'awaiting_approval',
AWAITING_RESUBMISSION: 'awaiting_resubmission',
CENSORED: 'censored',
DRAFT: 'draft',
GATHERING_SUPPORT: 'gathering_support',
},
},
rejected: {
on: {
AWAITING_APPROVAL: 'awaiting_approval',
GATHERING_SUPPORT: 'gathering_support',
},
},
expired: {
on: {
AWAITING_APPROVAL: 'awaiting_approval',
AWAITING_RESUBMISSION: 'awaiting_resubmission',
CENSORED: 'censored',
DRAFT: 'draft',
GATHERING_SUPPORT: 'gathering_support',
EXPIRED: 'expired',
},
},
gathering_support: {
on: {
ARCHIVED: 'archived',
AWAITING_APPROVAL: 'awaiting_approval',
AWAITING_RESUBMISSION: 'awaiting_resubmission',
CENSORED: 'censored',
DRAFT: 'draft',
EXPIRED: 'expired',
GATHERING_SUPPORT: 'gathering_support',
GATHERING_SUPPORT_100: 'gathering_support_100',
GATHERING_SUPPORT_1K: 'gathering_support_1k',
GATHERING_SUPPORT_5K: 'gathering_support_5k',
PROJECT_NOT_APPROVED: 'project_not_approved',
},
},
gathering_support_100: {
on: {
ARCHIVED: 'archived',
CENSORED: 'censored',
EXPIRED: 'expired',
GATHERING_SUPPORT_1K: 'gathering_support_1k',
},
},
gathering_support_1k: {
on: {
ARCHIVED: 'archived',
CENSORED: 'censored',
DRAFT: 'draft',
EXPIRED: 'expired',
GATHERING_SUPPORT_1K: 'gathering_support_1k',
GATHERING_SUPPORT_5K: 'gathering_support_5k',
},
},
gathering_support_5k: {
on: {
ARCHIVED: 'archived',
CENSORED: 'censored',
DRAFT: 'draft',
EXPIRED: 'expired',
GATHERING_SUPPORT_10K: 'gathering_support_10k',
GATHERING_SUPPORT_5K: 'gathering_support_5k',
IN_PRODUCTION: 'in_production',
},
},
gathering_support_10k: {
on: {
ARCHIVED: 'archived',
GATHERING_SUPPORT_10K: 'gathering_support_10k',
IN_REVIEW: 'in_review',
PROJECT_APPROVED: 'project_approved',
PROJECT_NOT_APPROVED: 'project_not_approved',
},
},
in_production: {
on: {
IN_PRODUCTION: 'in_production',
ON_SHELVES: 'on_shelves',
},
},
in_review: {
on: {
GATHERING_SUPPORT_10K: 'gathering_support_10k',
IN_REVIEW: 'in_review',
PROJECT_APPROVED: 'project_approved',
PROJECT_NOT_APPROVED: 'project_not_approved',
},
},
on_shelves: {
on: {
IN_PRODUCTION: 'in_production',
PROJECT_NOT_APPROVED: 'project_not_approved',
},
},
project_approved: {
on: {
IN_PRODUCTION: 'in_production',
ON_SHELVES: 'on_shelves',
},
},
project_not_approved: {
on: {
ARCHIVED: 'archived',
IN_REVIEW: 'in_review',
ON_SHELVES: 'on_shelves',
PROJECT_NOT_APPROVED: 'project_not_approved',
},
},
archived: {
type: 'final',
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment