Last active
          January 26, 2021 00:57 
        
      - 
      
- 
        Save pkellner/27db167b969f1b38feee786d85bd1f39 to your computer and use it in GitHub Desktop. 
    Generated by XState Viz: https://xstate.js.org/viz
  
        
  
    
      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
    
  
  
    
  | svccUiMachine1 = Machine({ | |
| id: 'svccUiMachine1', | |
| context: { | |
| currentCodeCampYear: '2019', | |
| codeCampYears: [ | |
| '2005', | |
| '2006', | |
| '2007', | |
| '2008', | |
| '2009', | |
| '2010', | |
| '2011', | |
| '2012', | |
| '2013', | |
| '2014', | |
| '2015', | |
| '2016', | |
| '2017', | |
| '2018', | |
| '2019', | |
| ], | |
| }, | |
| type: 'parallel', | |
| states: { | |
| codeCampYear: { | |
| on: { | |
| previousYear: { | |
| actions: assign({ | |
| count: (context, event) => { | |
| // NOTE: add guard stuff | |
| console.log('event', event); | |
| console.log('context', context); | |
| const currentIndex = codeCampYears.findIndex( | |
| (year) => year === event.currentCodeCampYear, | |
| ); | |
| console.log(currentIndex); | |
| context.currentCodeCampYear = | |
| context.codeCampYears[currentIndex - 1]; | |
| }, | |
| }), | |
| }, | |
| }, | |
| }, | |
| authenticationStatus: { | |
| initial: 'notAuthenticated', | |
| states: { | |
| notAuthenticated: { | |
| on: { loggedIn: 'authenticated' }, | |
| }, | |
| authenticated: { | |
| initial: 'hidingFavorites', | |
| on: { loggingOut: 'notAuthenticated' }, | |
| states: { | |
| showingFavorites: { | |
| on: { | |
| hideFavorites: 'hidingFavorites', | |
| }, | |
| }, | |
| hidingFavorites: { | |
| on: { | |
| showFavorites: 'showingFavorites', | |
| }, | |
| }, | |
| }, | |
| }, | |
| }, | |
| }, | |
| sessionsDisplayStatus: { | |
| initial: 'hidingSessions', | |
| states: { | |
| showingSessions: { | |
| on: { | |
| hideSessions: 'hidingSessions', | |
| }, | |
| }, | |
| hidingSessions: { | |
| on: { | |
| showSessions: 'showingSessions', | |
| }, | |
| }, | |
| }, | |
| }, | |
| theme: { | |
| initial: 'light', | |
| states: { | |
| light: { | |
| on: { | |
| setDarkTheme: 'dark', | |
| }, | |
| }, | |
| dark: { | |
| on: { | |
| setLightTheme: 'light', | |
| }, | |
| }, | |
| }, | |
| }, | |
| }, | |
| }); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment