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
const randomRange = (min, max) => | |
min + Math.random() * (max - min); | |
const machine = Machine( | |
{ | |
id: "Round as Individual Player", | |
type: "parallel", | |
states: { | |
"Player 1": { | |
id: "P1", |
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
const machine = Machine({ | |
id: "A Round - Team of 2 - By Hole", | |
type: "parallel", | |
states: { | |
"Player 1": { | |
id: "P1", | |
initial: "waiting", | |
states: { | |
waiting: { | |
on: { "START ROUND": "hole 1" }, |
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
const machine = Machine({ | |
id: "A Pro-Am Round - Team of 2", | |
type: "parallel", | |
states: { | |
"Player 1 - Amateur": { | |
id: "P1", | |
type: "parallel", | |
states: { | |
hole: { | |
initial: "none", |
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
const machine = Machine({ | |
id: "A Round for a Pro-Am Pair", | |
type: "parallel", | |
states: { | |
"Player 1 (Amateur)": { | |
id: "P1", | |
// onDone: | |
initial: "waiting", | |
states: { | |
waiting: { |
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
const machine = Machine({ | |
id: "Tuesday - Round 1", | |
initial: "playing", | |
states: { | |
playing: { | |
onDone: 'complete', | |
type: "parallel", | |
states: { | |
"course 1": { |
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
const machine = Machine({ | |
id: 'Tournament events during', | |
initial: 'Practice', | |
states: { | |
'Practice': { | |
initial: 'round 1', | |
states: { | |
'round 1': { | |
initial: 'playing', | |
states: { |
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
// Copied from: | |
// https://xstate-catalogue.com/machines/debounce | |
const fetchMachine = Machine({ | |
id: 'debounce', | |
initial: 'idle', | |
states: { | |
idle: { | |
on: { | |
GO: { | |
actions: 'assignActionToContext', |
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
const machine = Machine({ | |
id: 'Tournament', | |
initial: 'inactive', | |
states: { | |
inactive: { | |
on: { 'SCHEDULE TOURNAMENT': 'pre' }, | |
}, | |
pre: { | |
on: { 'START TOURNAMENT': 'during' }, | |
}, |
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
/* | |
TODO: | |
- LIVE status | |
- Pre and Post statuses | |
x delay notice (in context) | |
x switch category, e.g. Pro-Am | |
x loading data | |
x update data | |
x change sort direction | |
x change sort column |
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
const context = { | |
// TODO: separate machines for logged in/logged out | |
// logged out | |
email: '', | |
password: '', | |
passwordA: '', | |
passwordB: '', | |
username: '', | |
loginError: '', |