Skip to content

Instantly share code, notes, and snippets.

Avatar

Jae Task jaetask

View GitHub Profile
View machine.js
const offlineMachine = Machine(
{
id: 'offline',
initial: 'offline',
context: {
isForcedOffline: false,
},
states: {
offline: {
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
View machine.js
const pipelineItemMachine = Machine({
id: 'pipelineItem',
initial: 'compact',
context: {
quotes: []
},
states: {
compact: {
on: {
EXPAND: 'fetching'
View machine.js
const pipelineMachine = Machine(
{
id: 'pipeline',
initial: 'pipelineSearch',
context: {
pipelineQuery: '',
pipelineSearchIsDirty: false,
customerQuery: '',
dateFrom: '',
dateTo: '',
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
View machine.js
const addressMachine = Machine({
id: 'addresses',
initial: 'same_invoice_address',
context: {
address_line_1: '',
address_city: '',
address_postcode: '',
invoice_line_1: '',
invoice_city: '',
invoice_postcode: '',
View machine.js
const pageMachine = Machine({
id: 'page',
initial: 'visible',
context: {
isSent: false,
},
states: {
visible: {
View machine.js
// npm i -S 'array-move'
// import arrayMove from 'array-move';
const MIN_NUM_SURVEYS = 1;
const MAX_NUM_SURVEYS = 4;
const canAdd = context => context.surveys.length < MAX_NUM_SURVEYS;
const canClone = context => context.surveys.length < MAX_NUM_SURVEYS;
const canDelete = context => context.surveys.length > MIN_NUM_SURVEYS;